-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY for EC keys #277
Conversation
This test is only run on softokn since decrypting CMS encrypted with EC keys requires the PKCS#11 token to support CKM_ECDH1_DERIVE mechanism *with* shared data. SoftHSM2 support ECDH1 derivation mechanism with no shared data only. Signed-off-by: manison <manison@users.noreply.github.com>
@manison this looks interesting. |
It's during This is the backtrace:
The |
Ok, I see how this is messed up, but it is what it is. |
Agreed.
Wouldn't it be enough to check the object handle and/or slot id? |
I guess that will work, yeah. |
This is required for EVP_PKEY_set1_encoded_public_key (used by CMS_decrypt_set1_pkey_and_peer for example). Signed-off-by: manison <manison@users.noreply.github.com>
ee39710
to
11d8f68
Compare
I added the check to verify we only set public key to mock objects. |
Looks good |
Sadly we have some CI woes lately, but this looks good, so I'll merge and fix CI later. |
This PR implements
set_params
method for EC keys that allows assigningOSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY
parameter. This parameter is required forEVP_PKEY_set1_encoded_public_key
to function properly. This function is in turn used byCMS_decrypt_set1_pkey_and_peer
so without this decrypting a CMS does not work at all.This PR also adds a test to check CMS encrypt/decrypt using an EC key. Since decrypting a CMS uses
CKM_ECDH1_DERIVE
mechanism with shared data the test is being run on nss-softokn only. Although SoftHSM2 also supports ECDH1 derivation mechanism it currently (softhsm/SoftHSMv2#599) only does when no shared data is specified.