Packages

package crypto

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

  1. trait AdaptorSign extends Sign with AsyncAdaptorSign
  2. sealed trait AesDecryptionException extends Exception
  3. final case class AesEncryptedData(cipherText: ByteVector, iv: AesIV) extends 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 extends AnyVal with NetworkElement with Product with Serializable

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

  5. final case class AesKey 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. final case class AesPassword 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. case class DoubleSha256Digest(bytes: ByteVector) extends HashDigest with Product with Serializable

    Represents the result of SHA256(SHA256())

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

    The big endian version of DoubleSha256Digest

  23. case class ECAdaptorSignature(bytes: ByteVector) extends NetworkElement with Product with Serializable
  24. sealed abstract class ECDigitalSignature extends NetworkElement

    Created by chris on 2/26/16.

  25. sealed trait ECKeyBytes extends NetworkElement

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

  26. 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.

  27. 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).

  28. case class ECPublicKey(_bytes: ByteVector) extends BaseECKey with PublicKey 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.

  29. case class ECPublicKeyBytes(bytes: ByteVector) extends ECKeyBytes with PublicKey with Product with Serializable

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

  30. 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

  31. 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.

  32. abstract class FiniteFieldMember[F <: FiniteFieldMember[F]] extends NetworkElement
  33. abstract class FiniteFieldObject[F <: FiniteFieldMember[F]] extends Factory[F]
  34. 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.

  35. sealed trait HashDigest extends NetworkElement
  36. 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.

  37. trait MaskedToString extends AnyRef

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

  38. 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

  39. sealed trait PublicKey extends NetworkElement

    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].

  40. sealed trait RipeMd160Digest extends HashDigest

    Represents the result of RIPEMD160()

  41. sealed trait RipeMd160DigestBE extends HashDigest

    Represents the result of RIPEMD160() big endian

  42. case class SchnorrDigitalSignature(rx: SchnorrNonce, sig: FieldElement) extends NetworkElement with Product with Serializable
  43. case class SchnorrNonce(bytes: ByteVector) extends NetworkElement with Product with Serializable
  44. case class SchnorrPublicKey(bytes: ByteVector) extends NetworkElement with Product with Serializable
  45. sealed trait SecpPoint extends NetworkElement

    Represents a point on the secp256k1 elliptic curve.

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

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

  47. sealed trait Sha1Digest extends HashDigest

    Represents the result of SHA1()

  48. sealed trait Sha1DigestBE extends HashDigest
  49. sealed trait Sha256Digest extends HashDigest

    Represents the result of SHA256()

  50. sealed trait Sha256DigestBE extends HashDigest

    Represents the result of SHA256()

  51. sealed trait Sha256Hash160Digest extends HashDigest

    Represents the result of RIPEMD160(SHA256())

  52. sealed trait Sha256Hash160DigestBE extends HashDigest

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

  53. trait Sign extends AsyncSign
  54. case class SipHashKey(bytes: ByteVector) extends NetworkElement with Product with Serializable
  55. trait StringFactory[+T] extends AnyRef

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

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 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 CryptoParams extends CryptoParams
  17. object CryptoRuntimeFactory extends CryptoRuntimeFactory
    Attributes
    protected
  18. object CryptoUtil extends CryptoUtil
  19. object CurveCoordinate extends FiniteFieldObject[CurveCoordinate] with Serializable
  20. object DERSignatureUtil extends DERSignatureUtil
  21. 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)

  22. object DoubleSha256Digest extends Factory[DoubleSha256Digest] with Serializable
  23. object DoubleSha256DigestBE extends Factory[DoubleSha256DigestBE] with Serializable
  24. case object DummyECDigitalSignature extends ECDigitalSignature with Product with Serializable

    The point of this case object is to help with fee estimation an average ECDigitalSignature is 72 bytes in size Technically this number can vary, 72 bytes is the most likely though according to https://en.bitcoin.it/wiki/Elliptic_Curve_Digital_Signature_Algorithm

  25. object ECAdaptorSignature extends Factory[ECAdaptorSignature] with Serializable
  26. object ECDigitalSignature extends Factory[ECDigitalSignature]
  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 EmptyDigitalSignature extends ECDigitalSignature with Product with Serializable
  32. object FieldElement extends FiniteFieldObject[FieldElement] with Serializable
  33. object LibSecp256k1CryptoRuntime extends LibSecp256k1CryptoRuntime
  34. case object LowRDummyECDigitalSignature extends ECDigitalSignature with Product with Serializable

    The point of this case object is to help with fee estimation when using low r signing.

    The point of this case object is to help with fee estimation when using low r signing. Technically this number can vary, 71 bytes is the most likely when using low r signing

  35. object PBKDF2

  36. object RipeMd160Digest extends Factory[RipeMd160Digest]
  37. object RipeMd160DigestBE extends Factory[RipeMd160DigestBE]
  38. object SchnorrDigitalSignature extends Factory[SchnorrDigitalSignature] with Serializable
  39. object SchnorrNonce extends Factory[SchnorrNonce] with Serializable
  40. object SchnorrPublicKey extends Factory[SchnorrPublicKey] with Serializable
  41. object SecpPoint
  42. 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).

  43. object Sha1Digest extends Factory[Sha1Digest]
  44. object Sha1DigestBE extends Factory[Sha1DigestBE]
  45. object Sha256Digest extends Factory[Sha256Digest]
  46. object Sha256DigestBE extends Factory[Sha256DigestBE]
  47. object Sha256Hash160Digest extends Factory[Sha256Hash160Digest]
  48. object Sha256Hash160DigestBE extends Factory[Sha256Hash160DigestBE]
  49. object Sign

Ungrouped