feat: Guard against malformed ciphertext

This commit is contained in:
2023-06-15 16:42:17 +02:00
parent f1ec8d1793
commit 6c301ab88f
5 changed files with 42 additions and 30 deletions

View File

@@ -261,7 +261,11 @@ class OmemoDoubleRatchet {
}
final plaintext = await aes256CbcDecrypt(ciphertext, keys.encryptionKey, keys.iv);
return Result(plaintext);
if (plaintext.isType<MalformedCiphertextError>()) {
return Result(plaintext.get<MalformedCiphertextError>());
}
return Result(plaintext.get<List<int>>());
}
/// Checks whether we could decrypt the payload in [header] with a skipped key. If yes,