>> From: [email protected] On Behalf Of Jonas Schnelli >> Sent: Wednesday, 30 November, 2011 09:57 > >> I try to pre-calculate the size of a EVP_Seal encrypted buffer >> (just the seal, exkl. keys). How do i precalculate that? I assume >> with some blocksize stuff (i'm a crypto novice). >> I'm using AES256 as EVP_CIPHER. > > The 'seal' or 'envelope' operation actually produces symmetrically > encrypted data PLUS PK-encrypted/wrapped (nonce) key and optionally > IV, and typically some recipient-identifier information. These > are meaningless and unusable separately. I assume you mean to ask > about only the encrypted "bulk" data.
Yes. I mean the bulk data. The length of the encrypted session key and IV is known. > > If you use a block mode that requires padding (CBC or ECB, but don't > use ECB unless you know what you're doing), the ciphertext will be > up to one block longer than the plaintext, thus buffersize (if you > use a single buffer instead of pieces) must be at least one block > longer. In general this is EVP_CIPHER_[CTX_]block_size(ciph) and for > AES it is 16 bytes. If you use a stream mode (CFB, OFB, CTR) (or a > stream cipher, which AES isn't) ciphertext is same size as plaintext. Thanks for that! I try now to implement this and will read more about CFB/OFB/CTR. Thanks -- Jonas ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [email protected] Automated List Manager [email protected]
