deriveKey method
- required KeyAlgorithm encryptionAlgorithm,
- required Key ephemeralKey,
- required Key recipientKey,
- required bool receive,
Derives an ECDH-ES shared key for anonymous encryption.
Throws an AskarKeyException if key derivation fails.
Implementation
Key deriveKey({
required KeyAlgorithm encryptionAlgorithm,
required Key ephemeralKey,
required Key recipientKey,
required bool receive,
}) {
try {
return Key(
askarKeyDeriveEcdhEs(
encryptionAlgorithm,
ephemeralKey.handle,
recipientKey.handle,
algId,
apu,
apv,
receive,
).getValueOrException(),
);
} catch (e) {
throw AskarKeyException('Failed to derive key: $e');
}
}