EVP_KEY_cmp and -_parameters issues

Johannes.Heinz at telekom.de Johannes.Heinz at telekom.de
Thu Jul 25 09:01:06 UTC 2019


I have a question to following situation with RSA and DH structures:
I'm testing these in separated unit tests.
Both test cases (each one for RSA and DH) are doing the same:

I'm creating a new DH or RSA structure, filling it with my params (pqg ...) and convert it to an EVP_PKEY (for example: EVP_PKEY_assign_DH => pkey1)
Next step, I'm writing and reading this structure with these functions:
PEM_write_bio_PrivateKey() (not PEM_write_bio_PrivateKey_traditional() ) (with password)
EVP_PKEY* pkey2 = PEM_read_bio_PrivateKey() (with same password)
(or even without a password)

Now I want to compare these two EVP_PKEY* variables (pkey1 and pkey2) and for that I can use these two functions:
EVP_PKEY_cmp(pkey1, pkey2) (compares components and params)
EVP_PKEY_cmp_parameters(pkey1, pkey2) (compares params)

Now the Problem:
Even the tests work the same way, the one with RSA only accept the compare-function "EVP_PKEY_cmp" and not the other one.
The one with DH is only with the "EVP_PKEY_cmp_parameters" successful.

Question:
Why can the first compare function find the components and params of the RSA structure (and even after the PEM_write_bio...) and not of the DH?
Also, why it's with the second compare function (only params) the other way around (keys match in DH unit test and not in RSA unit test)?

Greetings
Johannes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20190725/316c0bba/attachment-0001.html>


More information about the openssl-users mailing list