<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected? in Secure Authentication</title>
    <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2252084#M1955</link>
    <description>&lt;P&gt;Hi, all.&lt;/P&gt;&lt;P&gt;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).&lt;BR /&gt;However, when I attempted verification, it failed.&lt;BR /&gt;Suspecting a program bug, I tried verifying using the OpenSSL command-line tool.&lt;/P&gt;&lt;P&gt;The results are as follows.&lt;BR /&gt;# openssl cms -verify -in signed.data -inform DER -content content.data -binary -CAfile ../ca.pem -out /dev/null&lt;BR /&gt;CMS Verification failure&lt;BR /&gt;20A0A39CFFFF0000:error:1700009E:CMS routines:CMS_SignerInfo_verify:verification failure:/usr/src/debug/openssl/3.3.1/crypto/cms/cms_sd.c:958:&lt;/P&gt;&lt;P&gt;Based on the error message, adding the -no_attr_verify flag successfully passed the verification.&lt;BR /&gt;# openssl cms -verify -in signed.data -inform DER -content content.data -binary -CAfile ../ca.pem -out /dev/null -no_attr_verify&lt;BR /&gt;CMS Verification successful&lt;/P&gt;&lt;P&gt;Now, here's my question:&lt;BR /&gt;&amp;nbsp;Is this the correct behavior?&lt;BR /&gt;&amp;nbsp;Is it fundamentally wrong to attempt to generate a CMS using keys stored in the HSM?&lt;BR /&gt;&amp;nbsp;We're planning to implement the attachment format next. Are there any issues with that?&lt;/P&gt;&lt;P&gt;I apologize for my poor writing, but I appreciate your understanding.&lt;/P&gt;&lt;P&gt;best reguards.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Dec 2025 09:02:16 GMT</pubDate>
    <dc:creator>norisan</dc:creator>
    <dc:date>2025-12-01T09:02:16Z</dc:date>
    <item>
      <title>CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2252084#M1955</link>
      <description>&lt;P&gt;Hi, all.&lt;/P&gt;&lt;P&gt;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).&lt;BR /&gt;However, when I attempted verification, it failed.&lt;BR /&gt;Suspecting a program bug, I tried verifying using the OpenSSL command-line tool.&lt;/P&gt;&lt;P&gt;The results are as follows.&lt;BR /&gt;# openssl cms -verify -in signed.data -inform DER -content content.data -binary -CAfile ../ca.pem -out /dev/null&lt;BR /&gt;CMS Verification failure&lt;BR /&gt;20A0A39CFFFF0000:error:1700009E:CMS routines:CMS_SignerInfo_verify:verification failure:/usr/src/debug/openssl/3.3.1/crypto/cms/cms_sd.c:958:&lt;/P&gt;&lt;P&gt;Based on the error message, adding the -no_attr_verify flag successfully passed the verification.&lt;BR /&gt;# openssl cms -verify -in signed.data -inform DER -content content.data -binary -CAfile ../ca.pem -out /dev/null -no_attr_verify&lt;BR /&gt;CMS Verification successful&lt;/P&gt;&lt;P&gt;Now, here's my question:&lt;BR /&gt;&amp;nbsp;Is this the correct behavior?&lt;BR /&gt;&amp;nbsp;Is it fundamentally wrong to attempt to generate a CMS using keys stored in the HSM?&lt;BR /&gt;&amp;nbsp;We're planning to implement the attachment format next. Are there any issues with that?&lt;/P&gt;&lt;P&gt;I apologize for my poor writing, but I appreciate your understanding.&lt;/P&gt;&lt;P&gt;best reguards.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Dec 2025 09:02:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2252084#M1955</guid>
      <dc:creator>norisan</dc:creator>
      <dc:date>2025-12-01T09:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2252196#M1958</link>
      <description>Additional information:&lt;BR /&gt;The key pair is obtained using the OpenSSL provider (sssProvider), while the certificate utilizes the cryptoki crate + libsss_pkcs11.so.&lt;BR /&gt;The key (and certificate) uses ECDSA with a 384-bit key.</description>
      <pubDate>Mon, 01 Dec 2025 10:13:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2252196#M1958</guid>
      <dc:creator>norisan</dc:creator>
      <dc:date>2025-12-01T10:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2255500#M1971</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/235368"&gt;@norisan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Apologies the late reply&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please provide more details about your sign process?&lt;/P&gt;
&lt;P&gt;How are you using the provider to sign the data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 18:42:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2255500#M1971</guid>
      <dc:creator>carlos_o</dc:creator>
      <dc:date>2025-12-04T18:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2255619#M1972</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/241501"&gt;@carlos_o&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply.&lt;BR /&gt;The general flow is as follows.&lt;BR /&gt;*&amp;nbsp;The programming language is Rust.&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Error handling and other details have been omitted.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    // 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&amp;lt;Private&amp;gt; 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
    ....&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;Are there any additional steps required when using data obtained from SE050?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Dec 2025 01:47:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2255619#M1972</guid>
      <dc:creator>norisan</dc:creator>
      <dc:date>2025-12-05T01:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2257423#M1976</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/235368"&gt;@norisan&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;When you try to verify the signature with openssl you are not using the provider to the SE05.&lt;/P&gt;
&lt;P&gt;openssl in command line need the "--provider" option to use it.&lt;/P&gt;
&lt;P&gt;Please reveiw the example scripts at \SE-PLUG-TRUST-MW_04.07.01\simw-top\sss\plugin\openssl_provider\scripts&lt;/P&gt;
&lt;P&gt;The supported programming languages are listed in the prerequisites of each development environment given at the&amp;nbsp;Plug &amp;amp; Trust Middleware documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 20:29:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2257423#M1976</guid>
      <dc:creator>carlos_o</dc:creator>
      <dc:date>2025-12-08T20:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2257701#M1978</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/241501"&gt;@carlos_o&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;BR /&gt;Are you saying to add the “-provider” option when verifying with the openssl command?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;# 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:&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;“-signer” specifies the ID of the certificate object.&lt;BR /&gt;However, the error remains the same(Is my approach wrong?).&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2025 07:08:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2257701#M1978</guid>
      <dc:creator>norisan</dc:creator>
      <dc:date>2025-12-09T07:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2259503#M1979</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/235368"&gt;@norisan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2025 22:44:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2259503#M1979</guid>
      <dc:creator>carlos_o</dc:creator>
      <dc:date>2025-12-10T22:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2263413#M1994</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/241501"&gt;@carlos_o&lt;/a&gt;&amp;nbsp;and everyone!&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; CMS is not listed to be supported with the Plug and Trust MW.&lt;BR /&gt;I was pretty disappointed with the above, but after some trial and error, it worked out, so I'm reporting back.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;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 =&amp;gt; Set the actual path
activate           = 1&lt;/LI-CODE&gt;&lt;P&gt;There are several parts I don't fully understand, but I'm reporting that it worked for now.&lt;/P&gt;&lt;P&gt;If you know the reason, I'd appreciate an explanation.&lt;/P&gt;&lt;P&gt;I hope this helps someone else too.&lt;/P&gt;&lt;P&gt;That's all for now.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Dec 2025 07:54:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2263413#M1994</guid>
      <dc:creator>norisan</dc:creator>
      <dc:date>2025-12-16T07:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: CMS Verification Fails with SE050-Stored Key Unless -no_attr_verify: Is This Expected?</title>
      <link>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2264147#M1995</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/235368"&gt;@norisan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for sharing the workaround you found.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Dec 2025 17:15:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Secure-Authentication/CMS-Verification-Fails-with-SE050-Stored-Key-Unless-no-attr/m-p/2264147#M1995</guid>
      <dc:creator>carlos_o</dc:creator>
      <dc:date>2025-12-16T17:15:29Z</dc:date>
    </item>
  </channel>
</rss>

