Introduction
We want to access a private key stored on se050 from the mod_ssl (openssl-based) of the Apache web server and perform TLS communication.
https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#page-header
# To use a private key from a PKCS#11 token:
SSLCertificateKeyFile "pkcs11:token=My%20Token%20Name;id=45"
Hardware
Software
- PlugAndTrust: v04.05.01
- openssl: 3.0.12
Tried it
To verify communication with SE050 using pkcs#11, we first attempted to create a key.
# openssl genpkey \
> -provider pkcs11prov \
> -algorithm EC \
> -pkeyopt ec_paramgen_curve:P-256 \
> -pkeyopt pkcs11_id:01 \
> -pkeyopt pkcs11_label:MyNewKey
genpkey: Error setting pkcs11_id:01 parameter:
20001EBB7F000000:error:03000093:digital envelope routines:default_fixup_args:command not supported:crypto/evp/ctrl_params_translate.c:580:[action:2, state:4] name=pkcs11_id, value=01
openssl.cnf :
openssl_conf = openssl_init
[openssl_init]
providers = provider_sect
[provider_sect]
default = default_sect
pkcs11 = pkcs11_sect
[default_sect]
activate = 1
[pkcs11_sect]
identity = pkcs11prov
module = /usr/lib/ossl-modules/pkcs11prov.so
pkcs11_module = /usr/lib/libsss_pkcs11.so
activate = 1
Using the "-out" option successfully generated the key, but it was generated as a file.
# openssl genpkey -provider pkcs11prov -provider default \
> -algorithm EC \
> -pkeyopt ec_paramgen_curve:P-256 \
> -out "pkcs11:id=%01;object=MyNewKey"
Questions
- Is it possible to communicate with SE050 using PKCS#11 with openssl3.x (provider-based)? The following is engine-based.
https://docs.nxp.com/bundle/LLDPUG_L6.1.36_2.1.0/page/topics/pkcs_11_based_openssl_engine_third-part... - Are the openssl.cnf file and the libraries being used incorrect?
- Is the command you used to generate the key incorrect?
I look forward to your response.