On Sat, Mar 4, 2017 at 2:31 PM, Aapo Talvensaari aapo.talvensaari@gmail.com wrote:
On Sat, Mar 4, 2017 at 12:18 PM, Gabriel Ivașcu ivascu.gabriel59@gmail.com wrote:
Hi,
Can I get some instructions on how to use an IV (initialization vector) when doing an AES 256 encryption/decryption?
The AES documentation [0] provides no information on how to pass the IV to the AES functions,
Please check here: https://github.com/bungle/lua-resty-nettle/blob/master/lib/resty/nettle/aes....
Thanks for your response, Aapo!
I learned eventually that you have to explicitly use the CBC mode [0] if you want to pass an IV, since the AES functions [1] use the ECB mode as default.
Also, I found this useful example [2] of how use the CBC mode with Twofish, which I adapted to use AES instead.
[0] https://www.lysator.liu.se/~nisse/nettle/nettle.html#CBC [1] https://www.lysator.liu.se/~nisse/nettle/nettle.html#AES [2] https://stackoverflow.com/questions/33003118/nettle-twofish-cbc
Regards, Gabriel