encryptAndSignCore function
Implementation
Future<Map<String, String>> encryptAndSignCore({
required String plainText,
required List<String> keys,
required String senderPgpPrivateKey,
String? secretKey,
}) async {
secretKey ??= generateRandomSecret(32);
final cipherText =
await aesEncrypt(plainText: plainText, secretKey: secretKey);
final encryptedSecret = await pgpEncrypt(plainText: secretKey, keys: keys);
final signature = await sign(
message: cipherText,
privateKey: senderPgpPrivateKey,
);
return {
'cipherText': cipherText,
'encryptedSecret': encryptedSecret,
'signature': signature,
'sigType': 'pgp',
'encType': 'pgp',
};
}