IV Size Mismatch in AES-256-GCM Encryption Between Node.js and Rust

PressRex profile image
by PressRex
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

Read full topic

Source: View source

PressRex profile image
by PressRex

Subscribe to New Posts

Lorem ultrices malesuada sapien amet pulvinar quis. Feugiat etiam ullamcorper pharetra vitae nibh enim vel.

Success! Now Check Your Email

To complete Subscribe, click the confirmation link in your inbox. If it doesn’t arrive within 3 minutes, check your spam folder.

Ok, Thanks

Read More