[openssl-users] i2d_ d2i_ b2i_ i2b_ functions and EVP_PKEY
Serj
rasjv at yandex.com
Tue Feb 3 10:18:20 UTC 2015
Hello.
I see many functions have prefixes: i2d_ d2i_ b2i_ i2b_
For example:
i2d_PublicKey
i2d_PrivateKey
d2i_PublicKey
d2i_PrivateKey
b2i_PublicKey
b2i_PrivateKey
i2b_PublicKey_bio
i2b_PrivateKey_bio
I think these letters: 'i', 'd', 'b' have some meaning. Can somebody help me to understand what they are mean?
And one more question.
In accordance to: https://www.openssl.org/docs/crypto/EVP_PKEY_new.html, EVP_PKEY structure is used by OpenSSL to store private keys. But there are above functions which use as parameters pointer to EVP_PKEY structure and as they are named they can work with both public and private keys. So the questions are:
1. can we save to EVP_PKEY structure public key not private?
2. can we save to EVP_PKEY structure public and private keys at once?
For example:
EVP_PKEY * pkey;
pkey = EVP_PKEY_new();
RSA * rsa;
rsa = RSA_generate_key(...)
EVP_PKEY_assign_RSA(pkey, rsa);
What key or keys will be in pkey after that?
--
Best Regards,
Serj
More information about the openssl-users
mailing list