CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?

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

CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?

Jump to solution
1,948 Views
norisan
Contributor II

Hi, all.

Using Rust and FFI with OpenSSL library functions, I performed a CMS signature using the key (and certificate) stored in SE050 (in detached format for now).
However, when I attempted verification, it failed.
Suspecting a program bug, I tried verifying using the OpenSSL command-line tool.

The results are as follows.
# openssl cms -verify -in signed.data -inform DER -content content.data -binary -CAfile ../ca.pem -out /dev/null
CMS Verification failure
20A0A39CFFFF0000:error:1700009E:CMS routines:CMS_SignerInfo_verify:verification failure:/usr/src/debug/openssl/3.3.1/crypto/cms/cms_sd.c:958:

Based on the error message, adding the -no_attr_verify flag successfully passed the verification.
# openssl cms -verify -in signed.data -inform DER -content content.data -binary -CAfile ../ca.pem -out /dev/null -no_attr_verify
CMS Verification successful

Now, here's my question:
 Is this the correct behavior?
 Is it fundamentally wrong to attempt to generate a CMS using keys stored in the HSM?
 We're planning to implement the attachment format next. Are there any issues with that?

I apologize for my poor writing, but I appreciate your understanding.

best reguards.

Tags (4)
0 Kudos
Reply
1 Solution
1,014 Views
norisan
Contributor II

Hi, @carlos_o and everyone!

> CMS is not listed to be supported with the Plug and Trust MW.
I was pretty disappointed with the above, but after some trial and error, it worked out, so I'm reporting back.

After creating a config file with the following content, exporting it as the environment variable OPENSSL_CONF, and then running the program, I successfully generated signed data that passed verification, including signedAttrs verification.

openssl_conf = openssl_init

[openssl_init]
providers = provider_sect

[provider_sect]
default = default_sect
base    = base_sect
pkcs11  = pkcs11_sect

[default_sect]
activate = 1

[base_sect]
activate = 1

[pkcs11_sect]
pkcs11-module-path = /path/to/libsss_pkcs11.so => Set the actual path
activate           = 1

There are several parts I don't fully understand, but I'm reporting that it worked for now.

If you know the reason, I'd appreciate an explanation.

I hope this helps someone else too.

That's all for now.

View solution in original post

8 Replies
1,926 Views
norisan
Contributor II
Additional information:
The key pair is obtained using the OpenSSL provider (sssProvider), while the certificate utilizes the cryptoki crate + libsss_pkcs11.so.
The key (and certificate) uses ECDSA with a 384-bit key.
0 Kudos
Reply
1,852 Views
carlos_o
NXP TechSupport
NXP TechSupport

Hi @norisan 

Apologies the late reply 

Could you please provide more details about your sign process?

How are you using the provider to sign the data?

 

0 Kudos
Reply
1,833 Views
norisan
Contributor II

Hi @carlos_o 

Thank you for your reply.
The general flow is as follows.
* The programming language is Rust.
   Error handling and other details have been omitted.


    // load providers
    let def_pv = CString::new("default")?;
    SSL_PROVIDER_load(ptr::null_mut(), def_pv.as_ptr());
    let sss_pv = CString::new("sssProvider")?;
    SSL_PROVIDER_load(ptr::null_mut(), sss_pv.as_ptr());

    // uri for get private key from SE050
    let uri = CString::new("nxp:0xXXXXXXXX".to_string())?;

    // get store
    let store = OSSL_STORE_open(
        c_uri.as_ptr(),
        std::ptr::null(),
        std::ptr::null_mut(),
        None,
        std::ptr::null_mut(),
    );

    // got a pkey
    let mut pkey: *mut openssl_bindings::EVP_PKEY = ptr::null_mut();
    loop {
        let info = openssl_bindings::OSSL_STORE_load(store);
        let info_type = openssl_bindings::OSSL_STORE_INFO_get_type(info);
            let got = openssl_bindings::OSSL_STORE_INFO_get1_PKEY(info);
            pkey = got;
            break;
        }
    }

    // Generate PKey<Private> from EVP_PKEY*
    let pkey_ptr: *mut openssl_sys::EVP_PKEY = pkey as *mut openssl_sys::EVP_PKEY;
    let private_key = PKey::from_ptr(pkey_ptr);

    // The end entity is obtained via PKCS#11 (cryptoki crate + libsss_pkcs11.so).
    // [0]: End Entity [1]: Intermediate CA [2]: Root CA
    let certs = ...;

    let client_cert = certs[0];

    // Generate a CA chain from certificates
    let cert_chain = ...;

    let flags = CMS_BINARY | CMS_STREAM | CMS_DETACHED;

    // Generate CMS
    let cms = CMS_sign(
        ptr::null_mut(),
        ptr::null_mut(),
        cert_chain,
        ptr::null_mut(),
        flags | CMS_PARTIAL,
    );

    // Add SignerInfo
    let signer = CMS_add1_signer(
        cms,
        client_cert,
        private_key,
        EVP_sha384(),
        0,
    );

    // Implement the signature
    // input_bio is generated from the file to be signed
    CMS_final(cms, input_bio, ptr::null_mut(), flags);

    // Output CMS signed data
    ....

 
Signature data generated using SoftHSM2 or a file (PKCS#12 file) for key and certificate acquisition can be successfully verified without adding the ‘-no_attr_verify’ option to the openssl command.

Are there any additional steps required when using data obtained from SE050?

Thanks.

0 Kudos
Reply
1,653 Views
carlos_o
NXP TechSupport
NXP TechSupport

Hi @norisan ,

When you try to verify the signature with openssl you are not using the provider to the SE05.

openssl in command line need the "--provider" option to use it.

Please reveiw the example scripts at \SE-PLUG-TRUST-MW_04.07.01\simw-top\sss\plugin\openssl_provider\scripts

The supported programming languages are listed in the prerequisites of each development environment given at the Plug & Trust Middleware documentation.

 

0 Kudos
Reply
1,598 Views
norisan
Contributor II

Hi @carlos_o,

Thanks for your reply.
Are you saying to add the “-provider” option when verifying with the openssl command?

# EX_SSS_BOOT_SSS_PORT=/dev/i2c-4:0x48 \
    openssl cms -verify \
    --provider default \
    --provider sssProvider \
    -propquery "?nxp_prov.signature.ecdsa=yes,?nxp_prov.keymgmt.ec=yes" \
    -signer nxp:0xXXXXXXXX \
    -in sign.data \
    -inform DER \
    -content content.data \
    -binary \
    -CAfile ca.pem \
    -out /dev/null
App   :INFO :Using PortName='/dev/i2c-4:0x48' (ENV: EX_SSS_BOOT_SSS_PORT=/dev/i2c-4:0x48)
sss   :INFO :atr (Len=35)
      01 A0 00 00    03 96 04 03    E8 00 FE 02    0B 03 E8 00
      01 00 00 00    00 64 13 88    0A 00 65 53    45 30 35 31
      00 00 00
sss   :WARN :Communication channel is Plain.
sss   :WARN :!!!Not recommended for production use.!!!
CMS Verification failure
20606D8BFFFF0000:error:1700009E:CMS routines:CMS_SignerInfo_verify:verification failure:/usr/src/debug/openssl/3.3.1/crypto/cms/cms_sd.c:958:

 

“-signer” specifies the ID of the certificate object.
However, the error remains the same(Is my approach wrong?).

The only example provided in the directory you mentioned is for “pkeyutl” (openssl_EccSign.py). Since it is unsuitable for signing and verification using CMS_sign() and CMS_verify(), is that why no examples exist for those functions?

0 Kudos
Reply
1,525 Views
carlos_o
NXP TechSupport
NXP TechSupport

Hi @norisan 

The "--provider" option is to make sure that you are using the provider to the S05 to do the verify. When the verify fails without "-no_attr_verify" means that the signed attributes don't match. CMS is not listed to be supported with the Plug and Trust MW.

0 Kudos
Reply
1,015 Views
norisan
Contributor II

Hi, @carlos_o and everyone!

> CMS is not listed to be supported with the Plug and Trust MW.
I was pretty disappointed with the above, but after some trial and error, it worked out, so I'm reporting back.

After creating a config file with the following content, exporting it as the environment variable OPENSSL_CONF, and then running the program, I successfully generated signed data that passed verification, including signedAttrs verification.

openssl_conf = openssl_init

[openssl_init]
providers = provider_sect

[provider_sect]
default = default_sect
base    = base_sect
pkcs11  = pkcs11_sect

[default_sect]
activate = 1

[base_sect]
activate = 1

[pkcs11_sect]
pkcs11-module-path = /path/to/libsss_pkcs11.so => Set the actual path
activate           = 1

There are several parts I don't fully understand, but I'm reporting that it worked for now.

If you know the reason, I'd appreciate an explanation.

I hope this helps someone else too.

That's all for now.

988 Views
carlos_o
NXP TechSupport
NXP TechSupport

Hi @norisan 

Thanks for sharing the workaround you found. 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2252084%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ECMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252084%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%20all.%3C%2FP%3E%3CP%3EUsing%20Rust%20and%20FFI%20with%20OpenSSL%20library%20functions%2C%20I%20performed%20a%20CMS%20signature%20using%20the%20key%20(and%20certificate)%20stored%20in%20SE050%20(in%20detached%20format%20for%20now).%3CBR%20%2F%3EHowever%2C%20when%20I%20attempted%20verification%2C%20it%20failed.%3CBR%20%2F%3ESuspecting%20a%20program%20bug%2C%20I%20tried%20verifying%20using%20the%20OpenSSL%20command-line%20tool.%3C%2FP%3E%3CP%3EThe%20results%20are%20as%20follows.%3CBR%20%2F%3E%23%20openssl%20cms%20-verify%20-in%20signed.data%20-inform%20DER%20-content%20content.data%20-binary%20-CAfile%20..%2Fca.pem%20-out%20%2Fdev%2Fnull%3CBR%20%2F%3ECMS%20Verification%20failure%3CBR%20%2F%3E20A0A39CFFFF0000%3Aerror%3A1700009E%3ACMS%20routines%3ACMS_SignerInfo_verify%3Averification%20failure%3A%2Fusr%2Fsrc%2Fdebug%2Fopenssl%2F3.3.1%2Fcrypto%2Fcms%2Fcms_sd.c%3A958%3A%3C%2FP%3E%3CP%3EBased%20on%20the%20error%20message%2C%20adding%20the%20-no_attr_verify%20flag%20successfully%20passed%20the%20verification.%3CBR%20%2F%3E%23%20openssl%20cms%20-verify%20-in%20signed.data%20-inform%20DER%20-content%20content.data%20-binary%20-CAfile%20..%2Fca.pem%20-out%20%2Fdev%2Fnull%20-no_attr_verify%3CBR%20%2F%3ECMS%20Verification%20successful%3C%2FP%3E%3CP%3ENow%2C%20here's%20my%20question%3A%3CBR%20%2F%3E%26nbsp%3BIs%20this%20the%20correct%20behavior%3F%3CBR%20%2F%3E%26nbsp%3BIs%20it%20fundamentally%20wrong%20to%20attempt%20to%20generate%20a%20CMS%20using%20keys%20stored%20in%20the%20HSM%3F%3CBR%20%2F%3E%26nbsp%3BWe're%20planning%20to%20implement%20the%20attachment%20format%20next.%20Are%20there%20any%20issues%20with%20that%3F%3C%2FP%3E%3CP%3EI%20apologize%20for%20my%20poor%20writing%2C%20but%20I%20appreciate%20your%20understanding.%3C%2FP%3E%3CP%3Ebest%20reguards.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2252196%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252196%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EAdditional%20information%3A%3CBR%20%2F%3EThe%20key%20pair%20is%20obtained%20using%20the%20OpenSSL%20provider%20(sssProvider)%2C%20while%20the%20certificate%20utilizes%20the%20cryptoki%20crate%20%2B%20libsss_pkcs11.so.%3CBR%20%2F%3EThe%20key%20(and%20certificate)%20uses%20ECDSA%20with%20a%20384-bit%20key.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2255500%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2255500%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%2F235368%22%20target%3D%22_blank%22%3E%40norisan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EApologies%20the%20late%20reply%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECould%20you%20please%20provide%20more%20details%20about%20your%20sign%20process%3F%3C%2FP%3E%0A%3CP%3EHow%20are%20you%20using%20the%20provider%20to%20sign%20the%20data%3F%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2255619%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2255619%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%2F241501%22%20target%3D%22_blank%22%3E%40carlos_o%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20reply.%3CBR%20%2F%3EThe%20general%20flow%20is%20as%20follows.%3CBR%20%2F%3E*%26nbsp%3BThe%20programming%20language%20is%20Rust.%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3BError%20handling%20and%20other%20details%20have%20been%20omitted.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%20%20%20%20%2F%2F%20load%20providers%0A%20%20%20%20let%20def_pv%20%3D%20CString%3A%3Anew(%22default%22)%3F%3B%0A%20%20%20%20SSL_PROVIDER_load(ptr%3A%3Anull_mut()%2C%20def_pv.as_ptr())%3B%0A%20%20%20%20let%20sss_pv%20%3D%20CString%3A%3Anew(%22sssProvider%22)%3F%3B%0A%20%20%20%20SSL_PROVIDER_load(ptr%3A%3Anull_mut()%2C%20sss_pv.as_ptr())%3B%0A%0A%20%20%20%20%2F%2F%20uri%20for%20get%20private%20key%20from%20SE050%0A%20%20%20%20let%20uri%20%3D%20CString%3A%3Anew(%22nxp%3A0xXXXXXXXX%22.to_string())%3F%3B%0A%0A%20%20%20%20%2F%2F%20get%20store%0A%20%20%20%20let%20store%20%3D%20OSSL_STORE_open(%0A%20%20%20%20%20%20%20%20c_uri.as_ptr()%2C%0A%20%20%20%20%20%20%20%20std%3A%3Aptr%3A%3Anull()%2C%0A%20%20%20%20%20%20%20%20std%3A%3Aptr%3A%3Anull_mut()%2C%0A%20%20%20%20%20%20%20%20None%2C%0A%20%20%20%20%20%20%20%20std%3A%3Aptr%3A%3Anull_mut()%2C%0A%20%20%20%20)%3B%0A%0A%20%20%20%20%2F%2F%20got%20a%20pkey%0A%20%20%20%20let%20mut%20pkey%3A%20*mut%20openssl_bindings%3A%3AEVP_PKEY%20%3D%20ptr%3A%3Anull_mut()%3B%0A%20%20%20%20loop%20%7B%0A%20%20%20%20%20%20%20%20let%20info%20%3D%20openssl_bindings%3A%3AOSSL_STORE_load(store)%3B%0A%20%20%20%20%20%20%20%20let%20info_type%20%3D%20openssl_bindings%3A%3AOSSL_STORE_INFO_get_type(info)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20let%20got%20%3D%20openssl_bindings%3A%3AOSSL_STORE_INFO_get1_PKEY(info)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20pkey%20%3D%20got%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20break%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%0A%20%20%20%20%2F%2F%20Generate%20PKey%3CPRIVATE%3E%20from%20EVP_PKEY*%0A%20%20%20%20let%20pkey_ptr%3A%20*mut%20openssl_sys%3A%3AEVP_PKEY%20%3D%20pkey%20as%20*mut%20openssl_sys%3A%3AEVP_PKEY%3B%0A%20%20%20%20let%20private_key%20%3D%20PKey%3A%3Afrom_ptr(pkey_ptr)%3B%0A%0A%20%20%20%20%2F%2F%20The%20end%20entity%20is%20obtained%20via%20PKCS%2311%20(cryptoki%20crate%20%2B%20libsss_pkcs11.so).%0A%20%20%20%20%2F%2F%20%5B0%5D%3A%20End%20Entity%20%5B1%5D%3A%20Intermediate%20CA%20%5B2%5D%3A%20Root%20CA%0A%20%20%20%20let%20certs%20%3D%20...%3B%0A%0A%20%20%20%20let%20client_cert%20%3D%20certs%5B0%5D%3B%0A%0A%20%20%20%20%2F%2F%20Generate%20a%20CA%20chain%20from%20certificates%0A%20%20%20%20let%20cert_chain%20%3D%20...%3B%0A%0A%20%20%20%20let%20flags%20%3D%20CMS_BINARY%20%7C%20CMS_STREAM%20%7C%20CMS_DETACHED%3B%0A%0A%20%20%20%20%2F%2F%20Generate%20CMS%0A%20%20%20%20let%20cms%20%3D%20CMS_sign(%0A%20%20%20%20%20%20%20%20ptr%3A%3Anull_mut()%2C%0A%20%20%20%20%20%20%20%20ptr%3A%3Anull_mut()%2C%0A%20%20%20%20%20%20%20%20cert_chain%2C%0A%20%20%20%20%20%20%20%20ptr%3A%3Anull_mut()%2C%0A%20%20%20%20%20%20%20%20flags%20%7C%20CMS_PARTIAL%2C%0A%20%20%20%20)%3B%0A%0A%20%20%20%20%2F%2F%20Add%20SignerInfo%0A%20%20%20%20let%20signer%20%3D%20CMS_add1_signer(%0A%20%20%20%20%20%20%20%20cms%2C%0A%20%20%20%20%20%20%20%20client_cert%2C%0A%20%20%20%20%20%20%20%20private_key%2C%0A%20%20%20%20%20%20%20%20EVP_sha384()%2C%0A%20%20%20%20%20%20%20%200%2C%0A%20%20%20%20)%3B%0A%0A%20%20%20%20%2F%2F%20Implement%20the%20signature%0A%20%20%20%20%2F%2F%20input_bio%20is%20generated%20from%20the%20file%20to%20be%20signed%0A%20%20%20%20CMS_final(cms%2C%20input_bio%2C%20ptr%3A%3Anull_mut()%2C%20flags)%3B%0A%0A%20%20%20%20%2F%2F%20Output%20CMS%20signed%20data%0A%20%20%20%20....%3C%2FPRIVATE%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3CBR%20%2F%3ESignature%20data%20generated%20using%20SoftHSM2%20or%20a%20file%20(PKCS%2312%20file)%20for%20key%20and%20certificate%20acquisition%20can%20be%20successfully%20verified%20without%20adding%20the%20%E2%80%98-no_attr_verify%E2%80%99%20option%20to%20the%20openssl%20command.%3C%2FP%3E%3CP%3EAre%20there%20any%20additional%20steps%20required%20when%20using%20data%20obtained%20from%20SE050%3F%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2257423%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2257423%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F235368%22%20target%3D%22_blank%22%3E%40norisan%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%0A%3CP%3EWhen%20you%20try%20to%20verify%20the%20signature%20with%20openssl%20you%20are%20not%20using%20the%20provider%20to%20the%20SE05.%3C%2FP%3E%0A%3CP%3Eopenssl%20in%20command%20line%20need%20the%20%22--provider%22%20option%20to%20use%20it.%3C%2FP%3E%0A%3CP%3EPlease%20reveiw%20the%20example%20scripts%20at%20%5CSE-PLUG-TRUST-MW_04.07.01%5Csimw-top%5Csss%5Cplugin%5Copenssl_provider%5Cscripts%3C%2FP%3E%0A%3CP%3EThe%20supported%20programming%20languages%20are%20listed%20in%20the%20prerequisites%20of%20each%20development%20environment%20given%20at%20the%26nbsp%3BPlug%20%26amp%3B%20Trust%20Middleware%20documentation.%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2257701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2257701%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241501%22%20target%3D%22_blank%22%3E%40carlos_o%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EThanks%20for%20your%20reply.%3CBR%20%2F%3EAre%20you%20saying%20to%20add%20the%20%E2%80%9C-provider%E2%80%9D%20option%20when%20verifying%20with%20the%20openssl%20command%3F%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%23%20EX_SSS_BOOT_SSS_PORT%3D%2Fdev%2Fi2c-4%3A0x48%20%5C%0A%20%20%20%20openssl%20cms%20-verify%20%5C%0A%20%20%20%20--provider%20default%20%5C%0A%20%20%20%20--provider%20sssProvider%20%5C%0A%20%20%20%20-propquery%20%22%3Fnxp_prov.signature.ecdsa%3Dyes%2C%3Fnxp_prov.keymgmt.ec%3Dyes%22%20%5C%0A%20%20%20%20-signer%20nxp%3A0xXXXXXXXX%20%5C%0A%20%20%20%20-in%20sign.data%20%5C%0A%20%20%20%20-inform%20DER%20%5C%0A%20%20%20%20-content%20content.data%20%5C%0A%20%20%20%20-binary%20%5C%0A%20%20%20%20-CAfile%20ca.pem%20%5C%0A%20%20%20%20-out%20%2Fdev%2Fnull%0AApp%20%20%20%3AINFO%20%3AUsing%20PortName%3D'%2Fdev%2Fi2c-4%3A0x48'%20(ENV%3A%20EX_SSS_BOOT_SSS_PORT%3D%2Fdev%2Fi2c-4%3A0x48)%0Asss%20%20%20%3AINFO%20%3Aatr%20(Len%3D35)%0A%20%20%20%20%20%2001%20A0%2000%2000%20%20%20%2003%2096%2004%2003%20%20%20%20E8%2000%20FE%2002%20%20%20%200B%2003%20E8%2000%0A%20%20%20%20%20%2001%2000%2000%2000%20%20%20%2000%2064%2013%2088%20%20%20%200A%2000%2065%2053%20%20%20%2045%2030%2035%2031%0A%20%20%20%20%20%2000%2000%2000%0Asss%20%20%20%3AWARN%20%3ACommunication%20channel%20is%20Plain.%0Asss%20%20%20%3AWARN%20%3A!!!Not%20recommended%20for%20production%20use.!!!%0ACMS%20Verification%20failure%0A20606D8BFFFF0000%3Aerror%3A1700009E%3ACMS%20routines%3ACMS_SignerInfo_verify%3Averification%20failure%3A%2Fusr%2Fsrc%2Fdebug%2Fopenssl%2F3.3.1%2Fcrypto%2Fcms%2Fcms_sd.c%3A958%3A%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%E2%80%9C-signer%E2%80%9D%20specifies%20the%20ID%20of%20the%20certificate%20object.%3CBR%20%2F%3EHowever%2C%20the%20error%20remains%20the%20same(Is%20my%20approach%20wrong%3F).%3C%2FP%3E%3CP%3EThe%20only%20example%20provided%20in%20the%20directory%20you%20mentioned%20is%20for%20%E2%80%9Cpkeyutl%E2%80%9D%20(openssl_EccSign.py).%20Since%20it%20is%20unsuitable%20for%20signing%20and%20verification%20using%20CMS_sign()%20and%20CMS_verify()%2C%20is%20that%20why%20no%20examples%20exist%20for%20those%20functions%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2259503%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2259503%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%2F235368%22%20target%3D%22_blank%22%3E%40norisan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20%22--provider%22%20option%20is%20to%20make%20sure%20that%20you%20are%20using%20the%20provider%20to%20the%20S05%20to%20do%20the%20verify.%20When%20the%20verify%20fails%20without%20%22-no_attr_verify%22%20means%20that%20the%20signed%20attributes%20don't%20match.%20CMS%20is%20not%20listed%20to%20be%20supported%20with%20the%20Plug%20and%20Trust%20MW.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2263413%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2263413%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241501%22%20target%3D%22_blank%22%3E%40carlos_o%3C%2FA%3E%26nbsp%3Band%20everyone!%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%26gt%3B%20CMS%20is%20not%20listed%20to%20be%20supported%20with%20the%20Plug%20and%20Trust%20MW.%3CBR%20%2F%3EI%20was%20pretty%20disappointed%20with%20the%20above%2C%20but%20after%20some%20trial%20and%20error%2C%20it%20worked%20out%2C%20so%20I'm%20reporting%20back.%3CBR%20%2F%3E%3CBR%20%2F%3EAfter%20creating%20a%20config%20file%20with%20the%20following%20content%2C%20exporting%20it%20as%20the%20environment%20variable%20OPENSSL_CONF%2C%20and%20then%20running%20the%20program%2C%20I%20successfully%20generated%20signed%20data%20that%20passed%20verification%2C%20including%20signedAttrs%20verification.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Eopenssl_conf%20%3D%20openssl_init%0A%0A%5Bopenssl_init%5D%0Aproviders%20%3D%20provider_sect%0A%0A%5Bprovider_sect%5D%0Adefault%20%3D%20default_sect%0Abase%20%20%20%20%3D%20base_sect%0Apkcs11%20%20%3D%20pkcs11_sect%0A%0A%5Bdefault_sect%5D%0Aactivate%20%3D%201%0A%0A%5Bbase_sect%5D%0Aactivate%20%3D%201%0A%0A%5Bpkcs11_sect%5D%0Apkcs11-module-path%20%3D%20%2Fpath%2Fto%2Flibsss_pkcs11.so%20%3D%26gt%3B%20Set%20the%20actual%20path%0Aactivate%20%20%20%20%20%20%20%20%20%20%20%3D%201%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EThere%20are%20several%20parts%20I%20don't%20fully%20understand%2C%20but%20I'm%20reporting%20that%20it%20worked%20for%20now.%3C%2FP%3E%3CP%3EIf%20you%20know%20the%20reason%2C%20I'd%20appreciate%20an%20explanation.%3C%2FP%3E%3CP%3EI%20hope%20this%20helps%20someone%20else%20too.%3C%2FP%3E%3CP%3EThat's%20all%20for%20now.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2264147%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20CMS%20Verification%20Fails%20with%20SE050-Stored%20Key%20Unless%20-no_attr_verify%3A%20Is%20This%20Expected%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2264147%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%2F235368%22%20target%3D%22_blank%22%3E%40norisan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20for%20sharing%20the%20workaround%20you%20found.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E