receiverUnwrapKey method

Key receiverUnwrapKey({
  1. required KeyAlgorithm keyWrappingAlgorithm,
  2. required KeyAlgorithm encryptionAlgorithm,
  3. required Key recipientKey,
  4. required Key ephemeralKey,
  5. required Key senderKey,
  6. required Uint8List ciphertext,
  7. Uint8List? nonce,
  8. Uint8List? tag,
  9. 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;
}