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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,484 次查看
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.

标记 (4)
0 项奖励
回复
1 解答
550 次查看
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.

在原帖中查看解决方案

8 回复数
1,462 次查看
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 项奖励
回复
1,388 次查看
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 项奖励
回复
1,369 次查看
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 项奖励
回复
1,189 次查看
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 项奖励
回复
1,134 次查看
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 项奖励
回复
1,061 次查看
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 项奖励
回复
551 次查看
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.

524 次查看
carlos_o
NXP TechSupport
NXP TechSupport

Hi @norisan 

Thanks for sharing the workaround you found. 

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2252084%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E9%99%A4%E9%9D%9E%E4%BD%BF%E7%94%A8%20-no_attr_verify%EF%BC%8C%E5%90%A6%E5%88%99%E4%BD%BF%E7%94%A8%20SE050-Stored%20Key%20%E6%97%B6%20CMS%20%E9%AA%8C%E8%AF%81%E5%A4%B1%E8%B4%A5%EF%BC%9A%E8%BF%99%E6%98%AF%E9%A2%84%E6%9C%9F%E7%9A%84%E5%90%97%EF%BC%9F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2252084%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E5%A4%A7%E5%AE%B6%E5%A5%BD%3C%2FP%3E%3CP%3E%E6%88%91%E4%BD%BF%E7%94%A8%20Rust%20%E5%92%8C%E5%B8%A6%E6%9C%89%20OpenSSL%20%E5%BA%93%E5%87%BD%E6%95%B0%E7%9A%84%20FFI%EF%BC%8C%E4%BD%BF%E7%94%A8%E5%AD%98%E5%82%A8%E5%9C%A8%20SE050%20%E4%B8%AD%E7%9A%84%E5%AF%86%E9%92%A5%EF%BC%88%E5%92%8C%E8%AF%81%E4%B9%A6%EF%BC%89%EF%BC%88%E6%9A%82%E6%97%B6%E9%87%87%E7%94%A8%E5%88%86%E7%A6%BB%E6%A0%BC%E5%BC%8F%EF%BC%89%E6%89%A7%E8%A1%8C%E4%BA%86%20CMS%20%E7%AD%BE%E5%90%8D%E3%80%82%3CBR%20%2F%3E%E4%BD%86%E6%98%AF%EF%BC%8C%E5%BD%93%E6%88%91%E5%B0%9D%E8%AF%95%E9%AA%8C%E8%AF%81%E6%97%B6%EF%BC%8C%E5%8D%B4%E5%A4%B1%E8%B4%A5%E4%BA%86%E3%80%82%3CBR%20%2F%3E%E6%88%91%E6%80%80%E7%96%91%E6%98%AF%E7%A8%8B%E5%BA%8F%E9%94%99%E8%AF%AF%EF%BC%8C%E4%BA%8E%E6%98%AF%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%20OpenSSL%20%E5%91%BD%E4%BB%A4%E8%A1%8C%E5%B7%A5%E5%85%B7%E8%BF%9B%E8%A1%8C%E9%AA%8C%E8%AF%81%E3%80%82%3C%2FP%3E%3CP%3E%E7%BB%93%E6%9E%9C%E5%A6%82%E4%B8%8B%3CBR%20%2F%3E%23%20openssl%20cms-verify-in%20signed.data-inform%20DER-content.data-binary-caFile%2Fca.pem%20out%20%2Fdev%2Fnull%20CMS%20%E9%AA%8C%E8%AF%81%E5%A4%B1%E8%B4%A5%2020a0a39cffff00000%3A%20%E9%94%99%E8%AF%AF%3A1700009E%3A%20CM%20%3CBR%20%2F%3E%20S%20%E4%BE%8B%E7%A8%8B%3Acms_signerinfo_verify%3A%20%E9%AA%8C%E8%AF%81%E5%A4%B1%E8%B4%A5%EF%BC%9A%2Fusr%2Fsrc%2Fdebug%2Fopenssl%2F3.3.1%2Fcrypto%2Fcms%2Fcms_sd.c%3A%20958%EF%BC%9A%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%E6%A0%B9%E6%8D%AE%E9%94%99%E8%AF%AF%E4%BF%A1%E6%81%AF%EF%BC%8C%E6%B7%BB%E5%8A%A0%20-no_attr_verify%20%E6%A0%87%E8%AE%B0%E6%88%90%E5%8A%9F%E9%80%9A%E8%BF%87%E4%BA%86%E9%AA%8C%E8%AF%81%E3%80%82%3CBR%20%2F%3E%23%20openssl%20cms%20-verify%20-in%20signed.data%20-inform%20DER%20-content%20content.data%20-%E4%BA%8C%E8%BF%9B%E5%88%B6%20-CAfile%20..%2Fca.pem%20-out%20%2Fdev%2Fnull%20-no_attr_verify%3CBR%20%2F%3ECMS%20%E9%AA%8C%E8%AF%81%E6%88%90%E5%8A%9F%3C%2FP%3E%3CP%3E%E7%8E%B0%E5%9C%A8%EF%BC%8C%E6%88%91%E7%9A%84%E9%97%AE%E9%A2%98%E6%9D%A5%E4%BA%86%EF%BC%9A%3CBR%20%2F%3E%3CBR%20%2F%3E%20%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%E5%AD%98%E5%82%A8%E5%9C%A8%20HSM%20%E4%B8%AD%E7%9A%84%E5%AF%86%E9%92%A5%E7%94%9F%E6%88%90%20CMS%20%E6%98%AF%E5%90%A6%E5%AD%98%E5%9C%A8%E6%A0%B9%E6%9C%AC%E6%80%A7%E9%94%99%E8%AF%AF%EF%BC%9F%3CBR%20%2F%3E%20%E6%88%91%E4%BB%AC%E8%AE%A1%E5%88%92%E4%B8%8B%E4%B8%80%E6%AD%A5%E5%AE%9E%E6%96%BD%E9%99%84%E4%BB%B6%E6%A0%BC%E5%BC%8F%E3%80%82%E6%9C%89%E4%BB%80%E4%B9%88%E9%97%AE%E9%A2%98%E5%90%97%EF%BC%9F%3C%2FP%3E%3CP%3E%E6%88%91%E4%B8%BA%E6%88%91%E7%9A%84%E6%8B%99%E5%8A%A3%E6%96%87%E7%AC%94%E9%81%93%E6%AD%89%EF%BC%8C%E4%BD%86%E6%88%91%E6%84%9F%E8%B0%A2%E6%82%A8%E7%9A%84%E7%90%86%E8%A7%A3%E3%80%82%3C%2FP%3E%3CP%3E%E6%9C%80%E5%A5%BD%E7%9A%84%E7%A5%9D%E6%84%BF%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%3E%E5%85%B6%E4%BB%96%E4%BF%A1%E6%81%AF%EF%BC%9A%3CBR%20%2F%3E%E5%AF%86%E9%92%A5%E5%AF%B9%E4%BD%BF%E7%94%A8%20OpenSSL%20%E6%8F%90%E4%BE%9B%E7%A8%8B%E5%BA%8F%20(sssProvider)%20%E8%8E%B7%E5%8F%96%EF%BC%8C%E8%AF%81%E4%B9%A6%E5%88%99%E4%BD%BF%E7%94%A8%20cryptoki%20crate%20%2B%20libsss_pkcs11.so%E3%80%82%3CBR%20%2F%3E%E5%AF%86%E9%92%A5%EF%BC%88%E5%92%8C%E8%AF%81%E4%B9%A6%EF%BC%89%E4%BD%BF%E7%94%A8%20384%20%E4%BD%8D%E5%AF%86%E9%92%A5%E7%9A%84%20ECDSA%E3%80%82%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%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%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%3C%2FP%3E%0A%3CP%3E%E6%8A%B1%E6%AD%89%E8%BF%9F%E5%A4%8D%20%3C%2FP%3E%0A%3CP%3E%E8%83%BD%E5%90%A6%E8%AF%A6%E7%BB%86%E4%BB%8B%E7%BB%8D%E4%B8%80%E4%B8%8B%E4%BD%A0%E4%BB%AC%E7%9A%84%E6%A0%87%E5%BF%97%E5%88%B6%E4%BD%9C%E8%BF%87%E7%A8%8B%EF%BC%9F%3C%2FP%3E%0A%3CP%3E%E6%82%A8%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8%E6%8F%90%E4%BE%9B%E5%95%86%E6%9D%A5%E7%AD%BE%E7%BD%B2%E6%95%B0%E6%8D%AE%EF%BC%9F%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%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%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%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%E6%82%A8%E7%9A%84%E7%AD%94%E5%A4%8D%E3%80%82%3CBR%20%2F%3E%E4%B8%80%E8%88%AC%E6%B5%81%E7%A8%8B%E5%A6%82%E4%B8%8B%3CBR%20%2F%3E*%20%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80%E4%B8%BA%20Rust%E3%80%82%3CBR%20%2F%3E%20%20%E9%94%99%E8%AF%AF%E5%A4%84%E7%90%86%E5%92%8C%E5%85%B6%E4%BB%96%E7%BB%86%E8%8A%82%E7%9C%81%E7%95%A5%E3%80%82%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%20translate%3D%22no%22%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%3CBR%20%2F%3E%E4%BD%BF%E7%94%A8%20SoftHSM2%20%E6%88%96%E7%94%A8%E4%BA%8E%E8%8E%B7%E5%8F%96%E5%AF%86%E9%92%A5%E5%92%8C%E8%AF%81%E4%B9%A6%E7%9A%84%E6%96%87%E4%BB%B6%EF%BC%88PKCS%2312%20%E6%96%87%E4%BB%B6%EF%BC%89%E7%94%9F%E6%88%90%E7%9A%84%E7%AD%BE%E5%90%8D%E6%95%B0%E6%8D%AE%EF%BC%8C%E6%97%A0%E9%9C%80%E5%9C%A8%20openssl%20%E5%91%BD%E4%BB%A4%E4%B8%AD%E6%B7%BB%E5%8A%A0%22-no_attr_verify%20%22%E9%80%89%E9%A1%B9%E5%8D%B3%E5%8F%AF%E6%88%90%E5%8A%9F%E9%AA%8C%E8%AF%81%E3%80%82%3C%2FP%3E%3CP%3E%E4%BD%BF%E7%94%A8%E4%BB%8E%20SE050%20%E8%8E%B7%E5%8F%96%E7%9A%84%E6%95%B0%E6%8D%AE%E6%97%B6%EF%BC%8C%E6%98%AF%E5%90%A6%E8%BF%98%E9%9C%80%E8%A6%81%E5%85%B6%E4%BB%96%E6%AD%A5%E9%AA%A4%EF%BC%9F%3C%2FP%3E%3CP%3E%E8%B0%A2%E8%B0%A2%E3%80%82%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%3E%E5%97%A8%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F235368%22%20target%3D%22_blank%22%3E%EF%BC%8C%40norisan%3C%2FA%3E%E3%80%81%3C%2FP%3E%0A%3CP%3E%E5%BD%93%E6%82%A8%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%20openssl%20%E9%AA%8C%E8%AF%81%E7%AD%BE%E5%90%8D%E6%97%B6%EF%BC%8C%E6%82%A8%E6%B2%A1%E6%9C%89%E4%BD%BF%E7%94%A8%20SE05%20%E7%9A%84%E6%8F%90%E4%BE%9B%E7%A8%8B%E5%BA%8F%E3%80%82%3C%2FP%3E%0A%3CP%3E%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%AD%E7%9A%84%20openssl%20%E9%9C%80%E8%A6%81%22--provider%22%20%E9%80%89%E9%A1%B9%E6%89%8D%E8%83%BD%E4%BD%BF%E7%94%A8%E3%80%82%3C%2FP%3E%0A%3CP%3E%E8%AF%B7%E6%9F%A5%E7%9C%8B%20%5CSE-PLUG-TRUST-MW_04.07.01%5Csimw-top%5Csss%5Cplugin%5Copenssl_provider%5Cscripts%20%E4%B8%8B%E7%9A%84%E7%A4%BA%E4%BE%8B%E8%84%9A%E6%9C%AC%3C%2FP%3E%0A%3CP%3EPlug%20%26amp%3B%20Trust%20%E4%B8%AD%E9%97%B4%E4%BB%B6%E6%96%87%E6%A1%A3%E4%B8%AD%E7%BB%99%E5%87%BA%E7%9A%84%E6%AF%8F%E4%B8%AA%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E7%9A%84%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6%E4%B8%AD%E5%88%97%E5%87%BA%E4%BA%86%E6%94%AF%E6%8C%81%E7%9A%84%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80%E3%80%82%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%3E%E4%BD%A0%E5%A5%BD%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%E3%80%81%3C%2FP%3E%3CP%3E%E6%84%9F%E8%B0%A2%E6%82%A8%E7%9A%84%E7%AD%94%E5%A4%8D%E3%80%82%3CBR%20%2F%3E%E4%BD%A0%E6%98%AF%E8%AF%B4%E4%BD%BF%E7%94%A8%20openssl%20%E5%91%BD%E4%BB%A4%E9%AA%8C%E8%AF%81%E6%97%B6%E8%A6%81%E6%B7%BB%E5%8A%A0%22-provider%20%22%E9%80%89%E9%A1%B9%EF%BC%9F%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%20translate%3D%22no%22%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%22-signer%20%22%E6%8C%87%E5%AE%9A%E8%AF%81%E4%B9%A6%E5%AF%B9%E8%B1%A1%E7%9A%84%20ID%E3%80%82%3CBR%20%2F%3E%E4%BD%86%E6%98%AF%EF%BC%8C%E9%94%99%E8%AF%AF%E4%BE%9D%E6%97%A7%EF%BC%88%E6%88%91%E7%9A%84%E6%96%B9%E6%B3%95%E6%98%AF%E5%90%A6%E6%9C%89%E8%AF%AF%EF%BC%9F%EF%BC%89%3C%2FP%3E%3CP%3E%E6%82%A8%E6%8F%90%E5%88%B0%E7%9A%84%E7%9B%AE%E5%BD%95%E4%B8%AD%E6%8F%90%E4%BE%9B%E7%9A%84%E5%94%AF%E4%B8%80%E7%A4%BA%E4%BE%8B%E6%98%AF%20%22pkeyutl%22%EF%BC%88openssl_EccSign.py%EF%BC%89%E3%80%82%E6%97%A2%E7%84%B6%E5%AE%83%E4%B8%8D%E9%80%82%E5%90%88%E4%BD%BF%E7%94%A8%20CMS_sign()%20%E5%92%8C%20CMS_verify()%E8%BF%9B%E8%A1%8C%E7%AD%BE%E5%90%8D%E5%92%8C%E9%AA%8C%E8%AF%81%EF%BC%8C%E8%BF%99%E6%98%AF%E5%90%A6%E5%B0%B1%E6%98%AF%E8%BF%99%E4%BA%9B%E5%87%BD%E6%95%B0%E6%B2%A1%E6%9C%89%E7%A4%BA%E4%BE%8B%E7%9A%84%E5%8E%9F%E5%9B%A0%EF%BC%9F%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%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%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%3C%2FP%3E%0A%3CP%3E%22--provider%22%20%E9%80%89%E9%A1%B9%E7%94%A8%E4%BA%8E%E7%A1%AE%E4%BF%9D%E4%BD%BF%E7%94%A8%20S05%20%E7%9A%84%E6%8F%90%E4%BE%9B%E7%A8%8B%E5%BA%8F%E8%BF%9B%E8%A1%8C%E9%AA%8C%E8%AF%81%E3%80%82%E5%BD%93%E6%A0%A1%E9%AA%8C%E5%A4%B1%E8%B4%A5%E8%80%8C%E6%B2%A1%E6%9C%89%22-no_attr_verify%22%20%E6%97%B6%EF%BC%8C%E8%A1%A8%E7%A4%BA%E7%AD%BE%E5%90%8D%E5%B1%9E%E6%80%A7%E4%B8%8D%E5%8C%B9%E9%85%8D%E3%80%82%E5%8D%B3%E6%8F%92%E5%8D%B3%E7%94%A8%20MW%20%E4%B8%8D%E6%94%AF%E6%8C%81%20CMS%E3%80%82%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%3E%E5%97%A8%EF%BC%8C%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%E5%92%8C%E5%A4%A7%E5%AE%B6%E5%A5%BD%EF%BC%81%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3E%26gt%3B%3CBR%20%2F%3E%E6%88%91%E5%AF%B9%E4%B8%8A%E8%BF%B0%E6%83%85%E5%86%B5%E7%9B%B8%E5%BD%93%E5%A4%B1%E6%9C%9B%EF%BC%8C%E4%BD%86%E7%BB%8F%E8%BF%87%E4%B8%80%E7%95%AA%E5%B0%9D%E8%AF%95%E5%90%8E%EF%BC%8C%E8%BF%98%E6%98%AF%E6%88%90%E5%8A%9F%E4%BA%86%EF%BC%8C%E6%89%80%E4%BB%A5%E6%88%91%E5%90%91%E5%A4%A7%E5%AE%B6%E6%B1%87%E6%8A%A5%E4%B8%80%E4%B8%8B%E3%80%82%20%E5%9C%A8%E5%88%9B%E5%BB%BA%E4%BA%86%E5%8C%85%E5%90%AB%E4%BB%A5%E4%B8%8B%E5%86%85%E5%AE%B9%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E3%80%81%E5%B0%86%E5%85%B6%E5%AF%BC%E5%87%BA%E4%B8%BA%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%20OPENSSL_CONF%20%E5%B9%B6%E8%BF%90%E8%A1%8C%E7%A8%8B%E5%BA%8F%E5%90%8E%EF%BC%8C%E6%88%91%E6%88%90%E5%8A%9F%E7%94%9F%E6%88%90%E4%BA%86%E9%80%9A%E8%BF%87%E9%AA%8C%E8%AF%81%E7%9A%84%E7%AD%BE%E5%90%8D%E6%95%B0%E6%8D%AE%EF%BC%8C%E5%8C%85%E6%8B%AC%20signedAttrs%20%E9%AA%8C%E8%AF%81%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%20translate%3D%22no%22%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%3E%E6%9C%89%E5%87%A0%E4%B8%AA%E9%83%A8%E5%88%86%E6%88%91%E8%BF%98%E4%B8%8D%E5%AE%8C%E5%85%A8%E6%98%8E%E7%99%BD%EF%BC%8C%E4%BD%86%E6%88%91%E8%A6%81%E6%8A%A5%E5%91%8A%E7%9A%84%E6%98%AF%EF%BC%8C%E5%AE%83%E6%9A%82%E6%97%B6%E8%B5%B7%E4%BD%9C%E7%94%A8%E4%BA%86%E3%80%82%3C%2FP%3E%3CP%3E%E5%A6%82%E6%9E%9C%E4%BD%A0%E7%9F%A5%E9%81%93%E5%8E%9F%E5%9B%A0%EF%BC%8C%E5%B8%8C%E6%9C%9B%E4%BD%A0%E8%83%BD%E8%A7%A3%E9%87%8A%E4%B8%80%E4%B8%8B%E3%80%82%3C%2FP%3E%3CP%3E%E5%B8%8C%E6%9C%9B%E8%BF%99%E4%B9%9F%E8%83%BD%E5%B8%AE%E5%8A%A9%E5%88%B0%E5%85%B6%E4%BB%96%E4%BA%BA%E3%80%82%3C%2FP%3E%3CP%3E%E5%B0%B1%E5%88%B0%E8%BF%99%E9%87%8C%E5%90%A7%E3%80%82%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%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%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%3C%2FP%3E%0A%3CP%3E%E6%84%9F%E8%B0%A2%E6%82%A8%E5%88%86%E4%BA%AB%E6%89%BE%E5%88%B0%E7%9A%84%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95%E3%80%82%20%3C%2FP%3E%3C%2FLINGO-BODY%3E