final class SynchronizerCryptoPureApi extends CryptoPureApi
Wraps the CryptoPureApi to include static synchronizer parameters, ensuring that during signature verification and decryption (both asymmetric and symmetric), the static synchronizer parameters are explicitly checked. This is crucial because a malicious counter participant could potentially use a downgraded scheme. For other methods, such as key generation, signing, or encryption by this (honest) participant, we rely on the synchronizer handshake to ensure that only supported schemes within the synchronizer are used.
TODO(#20714): decryption checks come in a separate PR
- Alphabetic
- By Inheritance
- SynchronizerCryptoPureApi
- CryptoPureApi
- PasswordBasedEncryptionOps
- RandomOps
- HashOps
- HmacOps
- SigningOps
- EncryptionOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new SynchronizerCryptoPureApi(staticSynchronizerParameters: StaticSynchronizerParameters, pureCrypto: CryptoPureApi)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def build(purpose: HashPurpose, algorithm: HashAlgorithm = defaultHashAlgorithm): HashBuilder
Creates a HashBuilder for computing a hash with the given purpose.
Creates a HashBuilder for computing a hash with the given purpose. For different purposes
purpose1
andpurpose2
, all implementations must ensure that it is computationally infeasible to find a sequencebs
of com.google.protobuf.ByteStrings such thatbs.foldLeft(hashBuilder(purpose1))((b, hb) => hb.add(b)).finish
andbs.foldLeft(hashBuilder(purpose2))((b, hb) => hb.add(b)).finish
yield the same hash.- Definition Classes
- HashOps
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def createSymmetricKey(bytes: SecureRandomness, scheme: SymmetricKeyScheme): Either[EncryptionKeyCreationError, SymmetricKey]
Creates a symmetric key with the specified scheme for the given randomness.
Creates a symmetric key with the specified scheme for the given randomness.
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- def decryptWith[M](encrypted: Encrypted[M], symmetricKey: SymmetricKey)(deserialize: (ByteString) => Either[DeserializationError, M]): Either[DecryptionError, M]
Decrypts a message encrypted using
encryptWith
Decrypts a message encrypted using
encryptWith
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- def decryptWith[M](encrypted: AsymmetricEncrypted[M], privateKey: EncryptionPrivateKey)(deserialize: (ByteString) => Either[DeserializationError, M]): Either[DecryptionError, M]
Decrypts a message encrypted using
encryptWith
Decrypts a message encrypted using
encryptWith
- Definition Classes
- EncryptionOps
- def decryptWithInternal[M](encrypted: AsymmetricEncrypted[M], privateKey: EncryptionPrivateKey)(deserialize: (ByteString) => Either[DeserializationError, M]): Either[DecryptionError, M]
- Attributes
- protected[crypto]
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- def decryptWithPassword[M](pbencrypted: PasswordBasedEncrypted, password: String)(deserialize: (ByteString) => Either[DeserializationError, M]): Either[PasswordBasedEncryptionError, M]
- Definition Classes
- PasswordBasedEncryptionOps
- def defaultEncryptionAlgorithmSpec: EncryptionAlgorithmSpec
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- def defaultHashAlgorithm: HashAlgorithm
- Definition Classes
- SynchronizerCryptoPureApi → HashOps
- def defaultHmacAlgorithm: HmacAlgorithm
- Definition Classes
- HmacOps
- def defaultPbkdfScheme: PbkdfScheme
- Attributes
- protected[crypto]
- Definition Classes
- SynchronizerCryptoPureApi → PasswordBasedEncryptionOps
- def defaultSigningAlgorithmSpec: SigningAlgorithmSpec
- Definition Classes
- SynchronizerCryptoPureApi → SigningOps
- def defaultSymmetricKeyScheme: SymmetricKeyScheme
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- def deriveSymmetricKey(password: String, symmetricKeyScheme: SymmetricKeyScheme, pbkdfScheme: PbkdfScheme, saltO: Option[SecureRandomness]): Either[PasswordBasedEncryptionError, PasswordBasedEncryptionKey]
Derive a symmetric encryption key from a given password.
Derive a symmetric encryption key from a given password.
- password
The password used to derive the key
- symmetricKeyScheme
The intended symmetric encryption scheme for the password-based encryption.
- pbkdfScheme
The password-based key derivation function (PBKDF) scheme to derive a key from the password.
- saltO
The optional salt used for the key derivation. If none is a given a random salt is generated.
- Definition Classes
- SynchronizerCryptoPureApi → PasswordBasedEncryptionOps
- def digest(purpose: HashPurpose, bytes: ByteString, algorithm: HashAlgorithm = defaultHashAlgorithm): Hash
Convenience method for
build(purpose).addWithoutLengthPrefix(bytes).finish
Convenience method for
build(purpose).addWithoutLengthPrefix(bytes).finish
- Definition Classes
- HashOps
- def encryptDeterministicWith[M <: HasToByteString](message: M, publicKey: EncryptionPublicKey, encryptionAlgorithmSpec: EncryptionAlgorithmSpec)(implicit traceContext: TraceContext): Either[EncryptionError, AsymmetricEncrypted[M]]
Deterministically encrypts the given bytes using the given public key.
Deterministically encrypts the given bytes using the given public key. This is unsafe for general use and it's only used to encrypt the decryption key of each view
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- def encryptSymmetricWith[M <: HasToByteString](message: M, symmetricKey: SymmetricKey): Either[EncryptionError, Encrypted[M]]
Encrypts the bytes of the serialized message using the given symmetric key.
Encrypts the bytes of the serialized message using the given symmetric key. Where the message embedded protocol version determines the message serialization.
- Definition Classes
- EncryptionOps
- def encryptWith[M <: HasToByteString](message: M, publicKey: EncryptionPublicKey, encryptionAlgorithmSpec: EncryptionAlgorithmSpec): Either[EncryptionError, AsymmetricEncrypted[M]]
Encrypts the bytes of the serialized message using the given public key.
Encrypts the bytes of the serialized message using the given public key.
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- def encryptWithPassword(message: ByteString, password: String, symmetricKeyScheme: SymmetricKeyScheme = defaultSymmetricKeyScheme, pbkdfScheme: PbkdfScheme = defaultPbkdfScheme): Either[PasswordBasedEncryptionError, PasswordBasedEncrypted]
- Definition Classes
- PasswordBasedEncryptionOps
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def generateRandomByteString(length: Int): ByteString
- Definition Classes
- RandomOps
- def generateRandomBytes(length: Int): Array[Byte]
- Attributes
- protected[crypto]
- Definition Classes
- SynchronizerCryptoPureApi → RandomOps
- def generateSecureRandomness(length: Int): SecureRandomness
- Definition Classes
- RandomOps
- def generateSymmetricKey(scheme: SymmetricKeyScheme): Either[EncryptionKeyGenerationError, SymmetricKey]
Generates and returns a random symmetric key using the specified scheme.
Generates and returns a random symmetric key using the specified scheme.
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hmacWithSecret(secret: HmacSecret, message: ByteString, algorithm: HmacAlgorithm = defaultHmacAlgorithm): Either[HmacError, Hmac]
- Definition Classes
- HmacOps
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def sign(hash: Hash, signingKey: SigningPrivateKey, usage: NonEmpty[Set[SigningKeyUsage]], signingAlgorithmSpec: SigningAlgorithmSpec = defaultSigningAlgorithmSpec)(implicit traceContext: TraceContext): Either[SigningError, Signature]
Signs the given hash using the private signing key.
Signs the given hash using the private signing key.
- usage
the usage we intend to enforce. If multiple usages are enforced, at least one of them must be satisfied. In other words, the provided signing key's usage must intersect with the specified usages.
- Definition Classes
- SigningOps
- def signBytes(bytes: ByteString, signingKey: SigningPrivateKey, usage: NonEmpty[Set[SigningKeyUsage]], signingAlgorithmSpec: SigningAlgorithmSpec = defaultSigningAlgorithmSpec)(implicit traceContext: TraceContext): Either[SigningError, Signature]
Preferably, we sign a hash; however, we also allow signing arbitrary bytes when necessary.
Preferably, we sign a hash; however, we also allow signing arbitrary bytes when necessary.
- Attributes
- protected[crypto]
- Definition Classes
- SynchronizerCryptoPureApi → SigningOps
- def supportedEncryptionAlgorithmSpecs: NonEmpty[Set[EncryptionAlgorithmSpec]]
- Definition Classes
- SynchronizerCryptoPureApi → EncryptionOps
- def supportedSigningAlgorithmSpecs: NonEmpty[Set[SigningAlgorithmSpec]]
- Definition Classes
- SynchronizerCryptoPureApi → SigningOps
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def verifySignature(bytes: ByteString, publicKey: SigningPublicKey, signature: Signature, usage: NonEmpty[Set[SigningKeyUsage]])(implicit traceContext: TraceContext): Either[SignatureCheckError, Unit]
- Definition Classes
- SynchronizerCryptoPureApi → SigningOps
- def verifySignature(hash: Hash, publicKey: SigningPublicKey, signature: Signature, usage: NonEmpty[Set[SigningKeyUsage]])(implicit traceContext: TraceContext): Either[SignatureCheckError, Unit]
Confirms if the provided signature is a valid signature of the payload using the public key
Confirms if the provided signature is a valid signature of the payload using the public key
- Definition Classes
- SynchronizerCryptoPureApi → SigningOps
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])