Packages

package crypto

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package musig

Type Members

  1. trait AdaptorSign extends Sign with AsyncAdaptorSign
  2. sealed trait AesDecryptionException extends Exception
  3. case class AesEncryptedData(cipherText: ByteVector, iv: AesIV) extends NetworkElement with Product with Serializable

    Represents a encrypted cipher text with it's accompanying initialization vector (IV).

    Represents a encrypted cipher text with it's accompanying initialization vector (IV). Both the cipher text and the IV is needed to decrypt the cipher text.

  4. final case class AesIV(bytes: ByteVector) extends AnyVal with NetworkElement with Product with Serializable

    Represents an initialization vector (IV) used in AES encryption.

  5. case class AesKey(bytes: ByteVector) extends MaskedToString with NetworkElement with Product with Serializable

    Represents a encryption/decryption key.

    Represents a encryption/decryption key. AES keys can be converted to SecretKeys, and have certain length requirements.

  6. case class AesPassword(value: String) extends MaskedToString with Product with Serializable
  7. final case class AesSalt(bytes: ByteVector) extends AnyVal with Product with Serializable

    Represents a salt used to derive a AES key from a human-readable passphrase.

  8. trait AsyncAdaptorSign extends AsyncSign
  9. trait AsyncSign extends AnyRef

    This is meant to be an abstraction for a org.bitcoins.crypto.ECPrivateKey, sometimes we will not have direct access to a private key in memory -- for instance if that key is on a hardware device -- so we need to create an abstraction of the signing process.

    This is meant to be an abstraction for a org.bitcoins.crypto.ECPrivateKey, sometimes we will not have direct access to a private key in memory -- for instance if that key is on a hardware device -- so we need to create an abstraction of the signing process. Fundamentally a private key takes in a scodec.bits.ByteVector and returns a ECDigitalSignature That is what this abstraction is meant to represent. If you have a ECPrivateKey in your application, you can get it's Sign type by doing this:

    val key = ECPrivateKey() val sign: scodec.bits.ByteVector => Future[ECDigitalSignature] = key.signFunction

    If you have a hardware wallet, you will need to implement the protocol to send a message to the hardware device. The type signature of the function you implement must be scodec.bits.ByteVector => Future[ECDigitalSignature]

  10. sealed abstract class BaseECKey extends NetworkElement

    Created by chris on 2/16/16.

    Created by chris on 2/16/16. Represents a fully parsed and validated ECDSA private or public key.

  11. trait BouncycastleCryptoRuntime extends CryptoRuntime

    This is an implementation of CryptoRuntime that defaults to Bouncy Castle (https://bouncycastle.org/) and java.security.

  12. trait CryptoBytesUtil extends AnyRef

    Created by chris on 2/26/16.

  13. sealed trait CryptoContext extends AnyRef
  14. trait CryptoNumberUtil extends AnyRef
  15. sealed abstract class CryptoParams extends AnyRef

    Created by chris on 3/29/16.

    Created by chris on 3/29/16. This trait represents all of the default parameters for our elliptic curve

  16. trait CryptoRuntime extends AnyRef

    Trait that should be extended by specific runtimes like javascript or the JVM to support crypto functions needed for bitcoin-s

  17. sealed trait CryptoRuntimeFactory extends AnyRef
    Attributes
    protected
  18. trait CryptoUtil extends CryptoRuntime

    Utility cryptographic functions This is a proxy for the underlying implementation of CryptoRuntime such as LibSecp256k1CryptoRuntime.

    Utility cryptographic functions This is a proxy for the underlying implementation of CryptoRuntime such as LibSecp256k1CryptoRuntime.

    This is necessary so that the core module doesn't need to be refactored to add support for multiple platforms, it can keep referencing CryptoUtil

  19. case class CurveCoordinate(bytes: ByteVector) extends FiniteFieldMember[CurveCoordinate] with Product with Serializable
  20. sealed abstract class DERSignatureUtil extends AnyRef

    Created by chris on 3/23/16.

  21. abstract class DigitalSignature extends NetworkElement
  22. case class DoubleSha256Digest(bytes: ByteVector) extends HashDigest with Product with Serializable

    Represents the result of SHA256(SHA256())

  23. case class DoubleSha256DigestBE(bytes: ByteVector) extends HashDigest with Product with Serializable

    The big endian version of DoubleSha256Digest

  24. case class ECAdaptorSignature(bytes: ByteVector) extends NetworkElement with Product with Serializable
  25. case class ECDigitalSignature(bytes: ByteVector) extends DigitalSignature with Product with Serializable

    Created by chris on 2/26/16.

  26. sealed abstract class ECKeyBytes extends NetworkElement

    Represents the raw bytes which are meant to represent an ECKey without deserializing.

  27. case class ECPrivateKey(bytes: ByteVector) extends BaseECKey with AdaptorSign with MaskedToString with Product with Serializable

    Created by chris on 2/16/16.

    Created by chris on 2/16/16. A valid deserialized private key.

    Note that there is no notion of compressed vs. decompressed as there is in Wallet Import Format (WIF), if dealing with external wallets then ECPrivateKeyBytes may be needed.

  28. case class ECPrivateKeyBytes(bytes: ByteVector, isCompressed: Boolean = true) extends ECKeyBytes with MaskedToString with Product with Serializable

    Represents a serialization sensitive ECPrivateKey (such as is used in WIF).

  29. case class ECPublicKey(bytes: ByteVector) extends BaseECKey with ECPublicKeyApi with Product with Serializable

    Created by chris on 2/16/16.

    Created by chris on 2/16/16. A valid deserialized ECDSA public key.

    This class wraps some underlying _bytes but after checking that these _bytes are valid, all serializations (compressed and decompressed) of this public key are (lazily) computed where the decompressed version is used internally for computation and the compressed version is provided by the NetworkElement::bytes member.

    Note that 0x00 is not a valid ECPublicKey but is a valid SecpPoint meaning that if you are doing computations on public key (points) that may have intermediate 0x00 values, then you should convert using toPoint, do computation, and then convert back toPublicKey in the end.

  30. sealed trait ECPublicKeyApi extends PublicKey

    Represents any type which wraps public key bytes which can be used for ECDSA verification.

    Represents any type which wraps public key bytes which can be used for ECDSA verification. Should always be instantiated with class X extends PublicKey[X].

  31. case class ECPublicKeyBytes(bytes: ByteVector) extends ECKeyBytes with ECPublicKeyApi with Product with Serializable

    Wraps raw ECPublicKey bytes without doing any validation or deserialization (may be invalid).

  32. abstract class Factory[+T] extends AnyRef

    Created by chris on 2/26/16.

    Created by chris on 2/26/16. Trait to implement ubiquitous factory functions across our codebase

  33. case class FieldElement(bytes: ByteVector) extends FiniteFieldMember[FieldElement] with Product with Serializable

    Represents integers modulo the secp256k1 field size: pow(2,256) - 0x1000003D1.

    Represents integers modulo the secp256k1 field size: pow(2,256) - 0x1000003D1.

    Supports arithmetic for these elements including +, -, *, and inverses. Supports 32 byte serialization as is needed for ECPrivateKeys.

  34. abstract class FiniteFieldMember[F <: FiniteFieldMember[F]] extends NetworkElement
  35. abstract class FiniteFieldObject[F <: FiniteFieldMember[F]] extends Factory[F]
  36. class HMacDSAKCalculatorWithEntropy extends DSAKCalculator

    Entirely copied from HMacDSAKCalculator with an added entropy parameter as well as two lines added adding the entropy to the hash.

    Entirely copied from HMacDSAKCalculator with an added entropy parameter as well as two lines added adding the entropy to the hash.

    For a reference in secp256k1, see nonce_function_rfc6979 in secp256k1.c For a description of the altered part, see RFC 6979 section 3.2d here https://tools.ietf.org/html/rfc6979#section-3.2

    The added lines are marked below with comments.

  37. sealed trait HashDigest extends NetworkElement
  38. sealed trait HashType extends AnyRef

    Created by chris on 1/18/16.

  39. sealed trait KeyParity extends NetworkElement
  40. trait LibSecp256k1CryptoRuntime extends CryptoRuntime

    This is an implementation of CryptoRuntime that defaults to libsecp256k1 (https://github.com/bitcoin-core/secp256k1) when possible.

    This is an implementation of CryptoRuntime that defaults to libsecp256k1 (https://github.com/bitcoin-core/secp256k1) when possible. All unsupported functions are delegated to BouncycastleCryptoRuntime.

  41. trait MaskedToString extends AnyRef

    Meant to provide a simple trait that masks the default to string for sensitive classes

  42. trait NetworkElement extends Any

    Created by chris on 1/14/16.

    Created by chris on 1/14/16. This represents a element that can be serialized to be sent over the network

  43. trait PublicKey extends NetworkElement
  44. sealed trait RipeMd160Digest extends HashDigest

    Represents the result of RIPEMD160()

  45. sealed trait RipeMd160DigestBE extends HashDigest

    Represents the result of RIPEMD160() big endian

  46. case class SIGHASH_ALL(num: Int) extends HashType with Product with Serializable

    defaultValue is the underlying value of the HashType.

    defaultValue is the underlying value of the HashType. The last byte of a signature determines the HashType. https://en.bitcoin.it/wiki/OP_CHECKSIG

  47. case class SIGHASH_ALL_ANYONECANPAY(num: Int) extends HashType with Product with Serializable
  48. case class SIGHASH_ANYONECANPAY(num: Int) extends HashType with Product with Serializable
  49. case class SIGHASH_NONE(num: Int) extends HashType with Product with Serializable
  50. case class SIGHASH_NONE_ANYONECANPAY(num: Int) extends HashType with Product with Serializable
  51. case class SIGHASH_SINGLE(num: Int) extends HashType with Product with Serializable
  52. case class SIGHASH_SINGLE_ANYONECANPAY(num: Int) extends HashType with Product with Serializable
  53. case class SchnorrDigitalSignature(rx: SchnorrNonce, sig: FieldElement, hashTypeOpt: Option[HashType]) extends DigitalSignature with Product with Serializable
  54. case class SchnorrNonce(bytes: ByteVector) extends NetworkElement with Product with Serializable
  55. case class SchnorrPublicKey(bytes: ByteVector) extends PublicKey with Product with Serializable
  56. sealed trait SecpPoint extends NetworkElement

    Represents a point on the secp256k1 elliptic curve.

  57. case class SecpPointFinite(x: CurveCoordinate, y: CurveCoordinate) extends SecpPoint with Product with Serializable

    A non-identity point, (x, y), on the secp256k1 elliptic curve.

  58. sealed trait Sha1Digest extends HashDigest

    Represents the result of SHA1()

  59. sealed trait Sha1DigestBE extends HashDigest
  60. sealed trait Sha256Digest extends HashDigest

    Represents the result of SHA256()

  61. sealed trait Sha256DigestBE extends HashDigest

    Represents the result of SHA256()

  62. sealed trait Sha256Hash160Digest extends HashDigest

    Represents the result of RIPEMD160(SHA256())

  63. sealed trait Sha256Hash160DigestBE extends HashDigest

    Represents the result of RIPEMD160(SHA256()) big endian

  64. sealed trait Sha3_256Digest extends HashDigest

    Represents the result of SHA3-256()

  65. sealed trait Sha3_256DigestBE extends HashDigest

    Represents the result of SHA3-256()

  66. trait Sign extends AsyncSign
  67. case class SipHashKey(bytes: ByteVector) extends NetworkElement with Product with Serializable
  68. trait StringFactory[+T] extends AnyRef

    A common factory trait that can be re-used to deserialize a string to a type t

  69. case class XOnlyPubKey(bytes: ByteVector) extends PublicKey with Product with Serializable

    Represents the x-coordinate of an ECPublicKey, with undetermined y-coordinate parity

Value Members

  1. object AdaptorUtil

    Implements the ECDSA Adaptor Signing Specification: https://github.com/discreetlogcontracts/dlcspecs/blob/d01595b70269d4204b05510d19bba6a4f4fcff23/ECDSA-adaptor.md

    Implements the ECDSA Adaptor Signing Specification: https://github.com/discreetlogcontracts/dlcspecs/blob/d01595b70269d4204b05510d19bba6a4f4fcff23/ECDSA-adaptor.md

    Note that the naming is not entirely consistent between the specification and this file in hopes of making this code more readable.

    The naming in this file more closely matches the naming in the secp256k1-zkp implementation: https://github.com/ElementsProject/secp256k1-zkp/tree/master/src/modules/ecdsa_adaptor

    Legend: x <> privKey X <> pubKey y <> adaptorSecret Y <> adaptorPoint/adaptor messageHash <> dataToSign/data/message R_a <> untweakedNonce R <> tweakedNonce proof <> (e, s)

  2. object AesCrypt

    Provides functionality for encrypting and decrypting with AES

  3. object AesEncryptedData extends Factory[AesEncryptedData] with Serializable
  4. object AesException
  5. object AesIV extends Serializable
  6. object AesKey extends Serializable
  7. object AesPassword extends StringFactory[AesPassword] with Serializable
  8. object AesSalt extends Factory[AesSalt] with Serializable
  9. object AsyncSign
  10. object BouncyCastleCryptoParams
  11. object BouncyCastleUtil
  12. object BouncycastleCryptoRuntime extends BouncycastleCryptoRuntime
  13. object CryptoBytesUtil extends CryptoBytesUtil
  14. object CryptoContext
  15. object CryptoNumberUtil extends CryptoNumberUtil
  16. object CryptoOrdering
  17. object CryptoParams extends CryptoParams
  18. object CryptoRuntimeFactory extends CryptoRuntimeFactory
    Attributes
    protected
  19. object CryptoUtil extends CryptoUtil
  20. object CurveCoordinate extends FiniteFieldObject[CurveCoordinate] with Serializable
  21. object DERSignatureUtil extends DERSignatureUtil
  22. object DLEQUtil

    Implements the DLEQ ZKP Specification: https://github.com/discreetlogcontracts/dlcspecs/blob/d01595b70269d4204b05510d19bba6a4f4fcff23/ECDSA-adaptor.md

    Implements the DLEQ ZKP Specification: https://github.com/discreetlogcontracts/dlcspecs/blob/d01595b70269d4204b05510d19bba6a4f4fcff23/ECDSA-adaptor.md

    Note that the naming is not entirely consistent between the specification and this file in hopes of making this code more readable.

    The naming in this file more closely matches the naming in the secp256k1-zkp implementation: https://github.com/ElementsProject/secp256k1-zkp/tree/master/src/modules/ecdsa_adaptor

    Legend: x <> fe X <> p1/point y <> adaptorSecret Y <> adaptorPoint/adaptor Z <> p2/tweakedPoint a <> k A_G <> r1 A_Y <> r2 b <> e c <> s proof <> (e, s)

  23. object DoubleSha256Digest extends Factory[DoubleSha256Digest] with Serializable
  24. object DoubleSha256DigestBE extends Factory[DoubleSha256DigestBE] with Serializable
  25. object ECAdaptorSignature extends Factory[ECAdaptorSignature] with Serializable
  26. object ECDigitalSignature extends Factory[ECDigitalSignature] with Serializable
  27. object ECPrivateKey extends Factory[ECPrivateKey] with Serializable
  28. object ECPrivateKeyBytes extends Factory[ECPrivateKeyBytes] with Serializable
  29. object ECPublicKey extends Factory[ECPublicKey] with Serializable
  30. object ECPublicKeyBytes extends Factory[ECPublicKeyBytes] with Serializable
  31. case object EvenParity extends KeyParity with Product with Serializable
  32. object FieldElement extends FiniteFieldObject[FieldElement] with Serializable
  33. object HashType extends Factory[HashType]
  34. object KeyParity extends Factory[KeyParity]
  35. object LibSecp256k1CryptoRuntime extends LibSecp256k1CryptoRuntime
  36. object NetworkElement
  37. case object OddParity extends KeyParity with Product with Serializable
  38. object PBKDF2

  39. object RipeMd160Digest extends Factory[RipeMd160Digest]
  40. object RipeMd160DigestBE extends Factory[RipeMd160DigestBE]
  41. object SIGHASH_ALL extends Serializable
  42. case object SIGHASH_DEFAULT extends HashType with Product with Serializable
  43. object SchnorrDigitalSignature extends Factory[SchnorrDigitalSignature] with Serializable
  44. object SchnorrNonce extends Factory[SchnorrNonce] with Serializable
  45. object SchnorrPublicKey extends Factory[SchnorrPublicKey] with Serializable
  46. object SecpPoint
  47. case object SecpPointInfinity extends SecpPoint with Product with Serializable

    The point at infinity, this is the secp256k1 group identity element meaning p + 0x00 = 0x00 + p = p for any point p and p + (-p) = 0x00.

    The point at infinity, this is the secp256k1 group identity element meaning p + 0x00 = 0x00 + p = p for any point p and p + (-p) = 0x00.

    Note that this does not correspond to a valid ECPublicKey just like FieldElement.zero does not correspond to a valid private key (and in fact 0x00 = FieldElement.zero*G).

  48. object Sha1Digest extends Factory[Sha1Digest]
  49. object Sha1DigestBE extends Factory[Sha1DigestBE]
  50. object Sha256Digest extends Factory[Sha256Digest]
  51. object Sha256DigestBE extends Factory[Sha256DigestBE]
  52. object Sha256Hash160Digest extends Factory[Sha256Hash160Digest]
  53. object Sha256Hash160DigestBE extends Factory[Sha256Hash160DigestBE]
  54. object Sha3_256Digest extends Factory[Sha3_256Digest]
  55. object Sha3_256DigestBE extends Factory[Sha3_256DigestBE]
  56. object Sign
  57. object XOnlyPubKey extends Factory[XOnlyPubKey] with Serializable

Ungrouped