On Thu, Apr 22, 2004, Eric Morris wrote: > Dr. Henson, > > Can you interleave encryption and decryption without repeated calls to > EVP_CipherInit and/or EVP_CipherFinal? > If not, which calls are required between encryption calls and decryption > calls? >
As I indicated you are best using two contexts for this purpose. The context is set up according to the initial operation (decrypt or encrypt) and these are two distinct operations in most cases (stream ciphers are an exception) and additional state information is stored in the context. You can't reuse the context and swap operations without a call to EVP_CipherFinal() which will output any partial block with appropriate padding on encryption. However on decryption the call would check padding and strip it: if the data to be decrypted can really arrive in fairly arbitrary size chunks that isn't what you'd want. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]