Closed albertlt closed 3 years ago
Ok, so I put the IV as class variable. It seems that the lib automatically change the key after each encrypt. If I put the IV inside the encrypt function, it doesn't change anymore. Is that expected behaviour?
The IV changes on each encrypted block. That’s why examples explicitly keep iv aside and use always fresh copy. Otherwise it’s usual to send the IV to the other side as part of encrypted data.
Hope this helps.
- 2021 v 12:53, albertlt @.***>:
Ok, so I put the IV as class variable. It seems that the lib automatically change the key after each encrypt. If I put the IV inside the encrypt function, it doesn't change anymore. Is that expected behaviour?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
nvm, error logic in my app. thank you for the great lib :)
Hello. I encrypted text: "4A31D880" with aes key: { 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61 }. and IV: {0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30}. paddingMode::Null.
First encrypt: ZIANFxqhMhVqryJ/QjFW7A== Second encrypt: Jl+J50IW7L6NniwCw3eZFg== Third encrypt: tPhroIswnTtFeUd5IyeX/g==
Key and IV never change. If I restart the esp32, the encryption will goes back to first one. The first one can be decrypted correctly, the rest cant. Why is that?