feat: Guard against malformed ciphertext
This commit is contained in:
@@ -13,22 +13,10 @@ class SkippingTooManyKeysError extends OmemoError {}
|
||||
/// Triggered by the Session Manager if the message key is not encrypted for the device.
|
||||
class NotEncryptedForDeviceError extends OmemoError {}
|
||||
|
||||
/// Triggered by the Session Manager when there is no key for decrypting the message.
|
||||
class NoDecryptionKeyException extends OmemoError implements Exception {
|
||||
String errMsg() => 'No key available for decrypting the message';
|
||||
}
|
||||
|
||||
/// Triggered by the Session Manager when the identifier of the used Signed Prekey
|
||||
/// is neither the current SPK's identifier nor the old one's.
|
||||
class UnknownSignedPrekeyError extends OmemoError {}
|
||||
|
||||
/// Triggered by the Session Manager when the received Key Exchange message does not meet
|
||||
/// the requirement that a key exchange, given that the ratchet already exists, must be
|
||||
/// sent after its creation.
|
||||
class InvalidKeyExchangeException extends OmemoError implements Exception {
|
||||
String errMsg() => 'The key exchange was sent before the last kex finished';
|
||||
}
|
||||
|
||||
/// Triggered by the OmemoManager when we could not encrypt a message as we have
|
||||
/// no key material available. That happens, for example, when we want to create a
|
||||
/// ratchet session with a JID we had no session with but fetching the device bundle
|
||||
@@ -38,3 +26,11 @@ class NoKeyMaterialAvailableError extends OmemoError {}
|
||||
/// A non-key-exchange message was received that was encrypted for our device, but we have no ratchet with
|
||||
/// the device that sent the message.
|
||||
class NoSessionWithDeviceError extends OmemoError {}
|
||||
|
||||
/// Caused when the AES-256 CBC decryption failed.
|
||||
class MalformedCiphertextError extends OmemoError {
|
||||
MalformedCiphertextError(this.ex);
|
||||
|
||||
/// The exception that was raised while decryption.
|
||||
final Object ex;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user