senderWrapKey method
- required KeyAlgorithm keyWrappingAlgorithm,
- required Key ephemeralKey,
- required Key recipientKey,
- required Key cek,
Wraps a key for the sender using the derived key.
Returns an EncryptedBuffer containing the wrapped key.
Implementation
EncryptedBuffer senderWrapKey({
required KeyAlgorithm keyWrappingAlgorithm,
required Key ephemeralKey,
required Key recipientKey,
required Key cek,
}) {
final derived = deriveKey(
encryptionAlgorithm: keyWrappingAlgorithm,
ephemeralKey: ephemeralKey,
recipientKey: recipientKey,
receive: false,
);
final encryptedBuffer = derived.wrapKey(other: cek);
derived.handle.free();
return encryptedBuffer;
}