Regarding Encrypted datalength

Tomas Mraz tomas at openssl.org
Mon Oct 3 06:01:19 UTC 2022


As I wrote before, there is no such function. There is only the
EVP_PKEY_get_size() which gives you the maximum length the encrypted
data can have for a given key.

If you do not know the length of the ciphertext for the
EVP_PKEY_decrypt() call, you can use the EVP_PKEY_get_size() value,
compare it with the data length of your data and if it is smaller, use
it as the ciphertext length in the EVP_PKEY_decrypt() call. That should
work fine - at least with the algorithms currently supported by
OpenSSL.

On Sat, 2022-10-01 at 22:16 +0000, ANUJ SHARMA wrote:
> Hi,
> Just wanted to know that is there any Openssl/EVP_PKEY function where
> I pass the encrypted data and encryption method and get the size of
> encrypted data.
> Something like:
> EncryptedDataLen=OpensslFunc(encrypted_data,encryption_method)
> 
> Thanks for your helping in advance.

-- 
Tomáš Mráz, OpenSSL



More information about the openssl-users mailing list