Initializerswift-crypto 3.8.0Crypto
init(privateKey:ciphersuite:info:encapsulatedKey:presharedKey:presharedKeyIdentifier:)
Creates a recipient in preshared key (PSK) mode.
HPKE.swift:247init<SK>(privateKey: SK, ciphersuite: Ciphersuite, info: Data, encapsulatedKey: Data, presharedKey psk: SymmetricKey, presharedKeyIdentifier pskID: Data) throws where SK : HPKEDiffieHellmanPrivateKey
Parameters
- privateKey
The recipient’s private key for decrypting the incoming messages.
- ciphersuite
The cipher suite that defines the cryptographic algorithms to use.
- info
Data that the key derivation function uses to compute the symmetric key material. The sender and the recipient need to use the same
info
data.- encapsulatedKey
The encapsulated symmetric key that the sender provides.
- psk
A preshared key (PSK) that the sender and the recipient both hold.
- pskID
An identifier for the PSK.
The Receiver
decrypts messages in PSK mode using the encapsulated key with the key schedule information (info
data), in addition to a symmetric encryption key that the sender and recipient both know in advance.
Other members in extension
Type members
init<SK>(privateKey: SK, ciphersuite: Ciphersuite, info: Data, encapsulatedKey: Data
) throws Creates a recipient in base mode.
init<SK>(privateKey: SK, ciphersuite: Ciphersuite, info: Data, encapsulatedKey: Data, authenticatedBy: SK.PublicKey
) throws Creates a recipient in authentication mode.
Instance members
func exportSecret<Context>(context: Context, outputByteCount: Int
) throws -> SymmetricKey Exports a secret given domain-separation context and the desired output length.
func open<C>(C
) throws -> Data Decrypts a message, if the ciphertext is valid.
func open<C, AD>(C, authenticating: AD
) throws -> Data Decrypts a message, if the ciphertext is valid, verifying the integrity of additional authentication data.