OpenSSL
Configure OpenSSL for signing with PKCS#11 Engine
Prerequisites to sign files using OpenSSL
- OpenSSL 3.x.x Installed.
- Setup OpenSSL PKCS#11 engine.
Install OpenSSL
To install OpenSSL, OpenSSL PKCS11
engine and P11tool, execute the following command:
- Ubuntu
sudo apt install -y openssl libengine-pkcs11-openssl gnutls-bin xxd - RHEL
sudo dnf install openssl openssl-pkcs11 gnutls vim-common
Setup and configure PKCS11 library
openssl_conf = openssl_init
[openssl_init]
engines = engine_section
[engine_section]
pkcs11 = pkcs11_section
[pkcs11_section]
#Path to the OpenSSL PKCS11 Engine
dynamic_path = "<Path to libpkcs11.so>"
MODULE_PATH = <Path to AVXPKCS11.so>Note:
- The above openssl.conf file is auto-generated after running the SIGN+_Installer executable. It consists of the required openssl configuration details and the <Path to AVXPKCS11.so> is dynamically generated after installation. This file is required for using openssl with AppViewX PKCS#11 provider to sign and verify files.
- The libpkcs11.so path depends on the Linux distribution and OpenSSL
version and has to be manually entered in the generated
openssl.conf file. Note: By default, the README File and the openssl.conf file is generated with the default location of libpkcs11.so in Ubuntu 20.04, 22.04, 24.04 and OpenSSL Version 3. Modify the path based on OS or any custom location based on requirement.
- Ubuntu 20.04, 22.04, 24.04: /usr/lib/x86_64-linux-gnu/engines-3/libpkcs11.so
- RHEL 9: /usr/lib64/engines-3/libpkcs11.so
Sign software artifacts with OpenSSL using AppViewX PKCS11 library and PKCS#11 Engine
Prerequisites
- Configure Openssl to sign using PKCS11 Engine.
- Run the AppViewX SIGN+ Installer to install the prerequisites required to sign using AppViewX PKCS#11 Provider.
- Modify the configurations in the generated openssl.conf file based on requirements.
Sign with OpenSSL dgst
OPENSSL_CONF=<path_to_openssl_conf_file> openssl dgst -engine pkcs11 -keyform engine -sign
"pkcs11:object=<key_alias_name>;type=private" <digest_algorithm> -out <signed output file>
<file_to_sign>The <path_to_openssl_conf_file>,
<key_alias_name> and <digest algorithm>
parameters are auto generated based on the signing policy configurations
in the README after running the SIGN+ Installer.Verify with OpenSSL dgst
- Extract the public key from the signing
certificate
The <certificate_path> parameter is auto generated in the README after running the SIGN+ Installer.openssl x509 -inform der -in <certificate_path> -pubkey -noout > <output_file_path.pem> - Verify the signed file using the above extracted public key
openssl
The <digest algorithm> parameter is auto generated in the README after running the SIGN+ Installer.openssl dgst -verify <path to public key> -signature <signed output file> <digest algorithm> <signed_file_to_verify>
Sign Authenticode files with Osslsigncode using AppViewX PKCS11 library and PKCS#11 Engine
Use
Osslsigncode to sign and timestamp Authenticode files such as:
- .arx
- .cbx
- .crx
- .cpl
- .dbx
- .deploy
- .dll
- .drx
- .exe
- .msi
- .msm
- .msp
- .ocx
- .sys
Prerequisites
- Configure Openssl to sign using PKCS#11 Engine
- Run the AppViewX SIGN+ Installer to install the prerequisites required to sign using AppViewX PKCS#11 Provider.
Install Osslsigncode
apt install osslsigncode
Sign with Osslsigncode
osslsigncode sign -pkcs11engine <path_to_libpkcs11.so> -pkcs11module <path_to_AVXPKCS11.so>
-certs <path_to_certificate> -key 'pkcs11:object=<keypair alias>;type=private' -in <file_to
be_signed> -out <output_signed_file> -h <digest algorithm> -t <timestamp_url>- <path_to_libpkcs11.so>: Path to openssl engine libpkcs11.so file. By default this is populated with the path of the libpkcs11.so file in Ubuntu 20.04, 22.04, 24.04 and OpenSSL Engine 3.
- <path_to_AVXPKCS11.so>: Path to AVXPKCS11.so file.
- <path_to_certificate>: Path to the signing certificate.
- <keypair alias>: Alias Name of the Signing Certificate.
- <digest_algorithm>: Specifies the hashing algorithm.
- <timestamp_url>: Specifies the timestamping URL.
- <file_to be_signed>: Path to the file to be signed.
- <output_signed_file>: Path of signed file.
Note: Osslsigncode throws an error during
signing if the output signed file already exists.