Request: Implement C_UnwrapKey in SIMW Top PKCS#11 (SE05X) for CMS ECDH

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Request: Implement C_UnwrapKey in SIMW Top PKCS#11 (SE05X) for CMS ECDH

680 Views
vishwaec08
Contributor I

Hello NXP Team,

We need C_UnwrapKey (AES-CBC/AES-CBC-PAD) implemented in SE05X SDK PKCS#11 to enable CMS ECDH handle-only decrypt on SE05X.

Currently C_UnwrapKey returns CKR_FUNCTION_NOT_SUPPORTED in sss_pkcs11_pal_core.c. The flow requires unwrapping the CMS CEK on-token using the derived AES handle plus the 16-byte IV from CMS.

 

Regards
Vishwa

0 Kudos
Reply
2 Replies

644 Views
vishwaec08
Contributor I

Hi,

The overall idea is that we want to encrypt and decrypt the data using OpenSSL CMS with an EC key.

For reference, the OpenSSL commands are listed below.

pkcs11-tool --module /usr/lib/libsss_pkcs11.so --slot 1 --keypairgen --key-type EC:prime256v1 --label "sss:20202022"

OPENSSL_CONF=engine.conf openssl req -engine pkcs11 -new -key "pkcs11:object=sss:20202022;type=private" -keyform engine -out ec_req.pem -x509 -subj "/CN=Test EC" -days 365

OPENSSL_CONF=engine.conf openssl x509 -engine pkcs11 -signkey "pkcs11:object=sss:20202022;type=private" -keyform engine -in ec_req.pem -out ec_cert.pem

openssl cms -encrypt -binary -outform DER -aes128 -in smcont.txt -recip ec_cert.pem -out test_ec.cms

OPENSSL_CONF=engine.conf openssl cms -decrypt -binary -inform DER -engine pkcs11 -keyform engine -inkey "pkcs11:object=sss:20202022;type=private" -recip ec_cert.pem -in test_ec.cms -out smtst.txt

 

0 Kudos
Reply

658 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @vishwaec08 ,

 

I have forwarded your feature request to the expert team, and will let you know when I have any feedback from there.

 

Thanks for your patience!

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2295622%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERequest%3A%20Implement%20C_UnwrapKey%20in%20SIMW%20Top%20PKCS%2311%20(SE05X)%20for%20CMS%20ECDH%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2295622%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20NXP%20Team%2C%3C%2FP%3E%3CP%3EWe%20need%20C_UnwrapKey%20(AES-CBC%2FAES-CBC-PAD)%20implemented%20in%20SE05X%20SDK%20PKCS%2311%20to%20enable%20CMS%20ECDH%20handle-only%20decrypt%20on%20SE05X.%3CBR%20%2F%3E%3CBR%20%2F%3ECurrently%20C_UnwrapKey%20returns%20CKR_FUNCTION_NOT_SUPPORTED%20in%20sss_pkcs11_pal_core.c.%20The%20flow%20requires%20unwrapping%20the%20CMS%20CEK%20on-token%20using%20the%20derived%20AES%20handle%20plus%20the%2016-byte%20IV%20from%20CMS.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ERegards%3CBR%20%2F%3E%3CSPAN%3EVishwa%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2295797%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Request%3A%20Implement%20C_UnwrapKey%20in%20SIMW%20Top%20PKCS%2311%20(SE05X)%20for%20CMS%20ECDH%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2295797%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EThe%20overall%20idea%20is%20that%20we%20want%20to%20encrypt%20and%20decrypt%20the%20data%20using%20OpenSSL%20CMS%20with%20an%20EC%20key.%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20reference%2C%20the%20OpenSSL%20commands%20are%20listed%20below.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Epkcs11-tool%20--module%20%2Fusr%2Flib%2Flibsss_pkcs11.so%20--slot%201%20--keypairgen%20--key-type%20EC%3Aprime256v1%20--label%20%22sss%3A20202022%22%3C%2FP%3E%3CP%3EOPENSSL_CONF%3Dengine.conf%20openssl%20req%20-engine%20pkcs11%20-new%20-key%20%22pkcs11%3Aobject%3Dsss%3A20202022%3Btype%3Dprivate%22%20-keyform%20engine%20-out%20ec_req.pem%20-x509%20-subj%20%22%2FCN%3DTest%20EC%22%20-days%20365%3C%2FP%3E%3CP%3EOPENSSL_CONF%3Dengine.conf%20openssl%20x509%20-engine%20pkcs11%20-signkey%20%22pkcs11%3Aobject%3Dsss%3A20202022%3Btype%3Dprivate%22%20-keyform%20engine%20-in%20ec_req.pem%20-out%20ec_cert.pem%3C%2FP%3E%3CP%3Eopenssl%20cms%20-encrypt%20-binary%20-outform%20DER%20-aes128%20-in%20smcont.txt%20-recip%20ec_cert.pem%20-out%20test_ec.cms%3CBR%20%2F%3E%3CBR%20%2F%3EOPENSSL_CONF%3Dengine.conf%20openssl%20cms%20-decrypt%20-binary%20-inform%20DER%20-engine%20pkcs11%20-keyform%20engine%20-inkey%20%22pkcs11%3Aobject%3Dsss%3A20202022%3Btype%3Dprivate%22%20-recip%20ec_cert.pem%20-in%20test_ec.cms%20-out%20smtst.txt%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2295665%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Request%3A%20Implement%20C_UnwrapKey%20in%20SIMW%20Top%20PKCS%2311%20(SE05X)%20for%20CMS%20ECDH%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2295665%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F213664%22%20target%3D%22_blank%22%3E%40vishwaec08%3C%2FA%3E%26nbsp%3B%EF%BC%8C%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EI%20have%20forwarded%20your%20feature%20request%20to%20the%20expert%20team%2C%20and%20will%20let%20you%20know%20when%20I%20have%20any%20feedback%20from%20there.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EThanks%20for%20your%20patience!%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EHave%20a%20great%20day%2C%3CBR%20%2F%3EKan%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E-------------------------------------------------------------------------------%3CBR%20%2F%3ENote%3A%3CBR%20%2F%3E-%20If%20this%20post%20answers%20your%20question%2C%20please%20click%20the%20%22Mark%20Correct%22%20button.%20Thank%20you!%3CBR%20%2F%3E-%20We%20are%20following%20threads%20for%207%20weeks%20after%20the%20last%20post%2C%20later%20replies%20are%20ignored%3CBR%20%2F%3EPlease%20open%20a%20new%20thread%20and%20refer%20to%20the%20closed%20one%2C%20if%20you%20have%20a%20related%20question%20at%20a%20later%20point%20in%20time.%3CBR%20%2F%3E-------------------------------------------------------------------------------%3C%2FP%3E%3C%2FLINGO-BODY%3E