mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-09 00:15:23 -04:00
crypto: Mac then decrypt in the PkDecryption compat module
This commit is contained in:
@@ -106,12 +106,12 @@ impl PkDecryption {
|
||||
|
||||
let keys = Keys::new(shared_secret);
|
||||
|
||||
let cipher = Aes256CbcDec::new(keys.aes_key(), keys.iv());
|
||||
let decrypted = cipher.decrypt_padded_vec_mut::<Pkcs7>(&message.ciphertext)?;
|
||||
|
||||
let hmac = keys.hmac();
|
||||
hmac.verify_truncated_left(&message.mac)?;
|
||||
|
||||
let cipher = Aes256CbcDec::new(keys.aes_key(), keys.iv());
|
||||
let decrypted = cipher.decrypt_padded_vec_mut::<Pkcs7>(&message.ciphertext)?;
|
||||
|
||||
Ok(decrypted)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user