I'm trying to implement a decryption service in rust.
The rust-crypto crate doesn't work on my machine (Apple M1 Max) because the symbol _rust_crypto_util_fixed_time_eq_asm
isn't defined.
After switching to the aes-gcm crate (v0.10.3), the program now doesn't immediately fail but instead the decryption fails internally and just returns an aead::Error
.
The key, iv (nonce) and decrypted data are correct (tested with a Java program). There is no tag present.
Have I missed something out? Besides the missing question marks, I've just used the sample code from the AES-GCM crate documentation.
The code:
use aes_gcm::{aead::{Aead, AeadCore, KeyInit}, Nonce, Key, Aes128Gcm};
fn main() {
let key = hex::decode("some_hex_string").expect("Decoding failed");
let key = Key::<Aes128Gcm>::from_slice(key.as_ref());
let cipher = Aes128Gcm::new(&key);
let iv: [u8; 12] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
let nonce = Nonce::from_slice(&iv);
let plaintext = cipher.decrypt(nonce, decryped_byte_array.as_ref());
}
Crypto
API.