IV Size Mismatch in AES-256-GCM Encryption Between Node.js and Rust
I am working with AES-256-GCM encryption in both Node.js and Rust using the aes_gcm
library, but I am encountering an issue with the IV (Initialization Vector). When I use a 16-byte IV in Node.js with the crypto
module, both encryption and decryption work fine. However, when I encrypt data in Node.js with a 16-byte IV and try to decrypt it in Rust, the Rust AES crate does not support a 16-byte IV. It only supports a 12-byte IV.
assertion left == right
failed
- left: 16*
- right: 12*
Note: I can run with the RUST_BACKTRACE=1
environment variable to display a backtrace.
What is the reason behind this, and what would be the best solution to resolve this issue?
1 post - 1 participant
Source: View source