I'm working on text encryption using AES. I'm saving the key and encrypted text in files, but what should i do with IV?
The IV is usually stored with the ciphertext. Prefixing the IV is commonplace as you need the IV at the start when performing decryption. As the IV is usually one block in size, you do not have to store the size of the IV if you know the block cipher used. Beware that AES-GCM, a popular authenticated mode of encryption, is most effective with a 12 byte IV.
Note that the IV is binary and often consist of randomized bytes. Neither the IV nor the ciphertext are likely to consist of valid characters. You need a encoding format such as base 64 or - less commonly - hexadecimals if you need to store the IV and ciphertext as text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With