receiverUnwrapKey method
- required KeyAlgorithm keyWrappingAlgorithm,
- required KeyAlgorithm encryptionAlgorithm,
- required Key recipientKey,
- required Key ephemeralKey,
- required Key senderKey,
- required Uint8List ciphertext,
- Uint8List? nonce,
- Uint8List? tag,
- required Uint8List ccTag,
Unwraps a key for the receiver using the derived key.
Returns a Key containing the unwrapped key.
Implementation
Key receiverUnwrapKey({
required KeyAlgorithm keyWrappingAlgorithm,
required KeyAlgorithm encryptionAlgorithm,
required Key recipientKey,
required Key ephemeralKey,
required Key senderKey,
required Uint8List ciphertext,
Uint8List? nonce,
Uint8List? tag,
required Uint8List ccTag,
}) {
final derived = deriveKey(
encryptionAlgorithm: keyWrappingAlgorithm,
ephemeralKey: ephemeralKey,
recipientKey: recipientKey,
receive: true,
senderKey: senderKey,
ccTag: ccTag,
);
final unwrappedKey = derived.unwrapKey(
tag: tag,
nonce: nonce,
ciphertext: ciphertext,
algorithm: encryptionAlgorithm,
);
derived.handle.free();
return unwrappedKey;
}