openBase static method
Single-shot OpenBase(enc, skR, info, aad, ct).
Implementation
static Future<Uint8List> openBase({
required TspDecryptionKey recipient,
required Uint8List enc,
required List<int> info,
required List<int> aad,
required List<int> ciphertext,
}) async {
if (enc.length != recipient.kem.encLength) {
throw TspDecryptionException(
'encapsulated key is ${enc.length} bytes, expected ${recipient.kem.encLength}',
);
}
final sharedSecret = await recipient.decapsulate(enc);
final schedule = keySchedule(
kemId: recipient.kem.id,
sharedSecret: sharedSecret,
info: info,
);
return ChaCha20Poly1305.open(
key: schedule.key,
nonce: schedule.baseNonce,
aad: aad,
ciphertextAndTag: ciphertext,
);
}