hosseintahami
hosseintahami

Reputation: 1

Get key and Iv and type of encryption from EVP_CIPHER_CTX or EVP_CIPHER?

I'm trying to get iv and key and other things like name of crypto system like from EVP_CIPHER_CTX *ctx or EVP_CIPHER *kt in OpenSSL. I searched a lot but no function found that returns key and iv.

Upvotes: 0

Views: 450

Answers (1)

Matt Caswell
Matt Caswell

Reputation: 9492

The EVP_CIPHER object represents the abstract implementation of a particular cipher. It remains unchanged no matter how many times you use it and does not store the IV or key.

The EVP_CIPHER_CTX stores data specific to a particular encryption or decryption. The original IV that you set in the EVP_CIPHER_CTX can be obtained using the function EVP_CIPHER_CTX_original_iv():

const unsigned char *EVP_CIPHER_CTX_original_iv(const EVP_CIPHER_CTX *ctx);

It is not currently possible to get the key back.

Upvotes: 1

Related Questions