I have a situation where an application may switch from reading to writing and back again at random. Do I need a ctx context each for decryption / encryption, or can I use the same ctx in sequence on the file?

When switching from reading to writing (and vice versa), do I need to detect this change and call EVP_CipherInit_ex to alter the context ctx accordingly? Furthermore, do I need to call EVP_CipherFinal before the call to EVP_CipherInit to finalize the ctx for the prior mode?

My next question involves the encryption of very short strings (less than the cipher block size)... does the ctx "buffer" these short strings until either another call to the Update function fills out the block and/or the Final function is called? I will have unpredictable string lengths being encrypted, and I do not want to introduce padding into the middle of the encrypted files.

Thanks for your help...

- Eric Morris
NC State University

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to