782 questions
0
votes
0
answers
18
views
How to sign CertificateSigningRequestBuilder by pkcs11 key?
I want to create a CSR and later a certificate, and both must be signed by a private key stored in an HSM, accessed through PKCS#11 using the python-pkcs11 library.
from cryptography import x509
from ...
0
votes
1
answer
69
views
PKCS11 error at KeyStore.getEntry(alias, null) at Java 22 statement
I'm developing SOAP envelope signing code in a Java environment. My code running properly when I use the RSA_SHA256 signature algorithm with proper smart card based pkcs11. I have another smart card ...
0
votes
0
answers
87
views
How to execute PKCS11 with a Yubikey in Docker
When I try to execute PKCS#11 functions (with python-pkcs11 and ykcs11) inside a Docker container, it fails in decrypt with DeviceError.
This is the code:
with get_pkcs11_token().open(user_pin=pin) as ...
1
vote
1
answer
120
views
How do I digitally sign a PDF file using a physical PKI card from Python?
I'm trying to create an app where the user will fill a form and a PDF template will be filled with that info, then get digitally signed and sent via e-mail.
I have been trying to sign with PyHanko, ...
0
votes
0
answers
81
views
Net.Pkcs11Interop.Common.Pkcs11Exception: 'Method C_Sign returned CKR_DEVICE_ERROR'
I'm trying to improve my document signing process using PKCS11, but I'm having a problem. No matter how many attempts I made, I could not resolve the relevant error.
Net.Pkcs11Interop.Common....
4
votes
3
answers
221
views
Install4J v8 PKCS#11 Code Signing with Google Cloud KMS (libkmsp11.so) - Certificate Not Found
As a long-time user of Install4J, I appreciate its robust, direct implementation of code signing since version 5.1, which leverages open standards and eliminates the need for external tools like ...
0
votes
0
answers
62
views
PDF external signing get "Signature is invalid"
I tried to sign PDF with nodejs using pkcs11js connect to HSM for signing. The result of certificate show as picture and has been transcribed as follows:
This file claims compliance with the PDF/A ...
1
vote
1
answer
87
views
What are session objects? Where are they stored? [closed]
The question is about where session objects are created and stored - on a token or in RAM of an application that uses a pkcs11 library?
It seems that pkcs11 specification does not differentiate them ...
0
votes
0
answers
82
views
OpenIdDict using PKCS#11 / HSM interface?
I am working on a project that uses OpenIdDict für user authentication, thus, generating and validating JWTs (Java web tokens, HTTP header "Bearer").
Currently, the prototype relies on a ...
-2
votes
1
answer
87
views
Signing XML using PKCS11, HSM token
public static byte[] DoSignXML_old(string inputfile, HSMProperties pro, ref ISession session)
{
try
{
// Load the XML document
XmlDocument XDoc = new XmlDocument();
...
2
votes
1
answer
544
views
PKCS11Exception CKR_USER_NOT_LOGGED_IN during save certificate to smart card
I would like to create and store my own root certificate on a smart card using the P-256 ECDSA encryption algorithm (secp256r1).
I managed to open access to the certificates created so far on the card ...
0
votes
0
answers
43
views
Getting SEC_ERROR_IO when authenticate to pkcs11 token?
I am writing a demo to generate and store key pair in tpm device on linux (ubuntu) by nss and pkcs#11.
I've added the tpm2-pkcs11 module to nssdb, like:
time@PF2CMPHV:~$ modutil -list -dbdir sql:/home/...
0
votes
0
answers
76
views
PKCS#11 digital signature application: error with token on JRE 1.8.0_441
I am writing an application for digital signature using PKCS#11. The Certum token works on JRE 1.8.0_333 (32-bit) and JRE 1.8.0_441 (32-bit). The CenCertum token works on JRE 1.8.0_333 (32-bit), but ...
0
votes
0
answers
217
views
Pkcs11Interop with Softhsm and Docker - Method C_Initialize returned CKR_GENERAL_ERROR
I have a dotnet8 console app that works fine with SoftHsmv2 on windows.
I then dockerised the console app with softhsm installed & intialised during docker build as below:
#noble tag for Ubuntu 24....
0
votes
1
answer
246
views
Digital signature to PDF file - pkcs11.dll not detected from the system
I want to sign a PDF file using a digital signature from a USB token (containing the private and public keys). When I try to achieve this using PKCS11.dll, the system detects an error and throws a '...
0
votes
2
answers
625
views
Pkcs#11 with Luna Cloud HSM: private key listed with cmu list is not found in Java KeyStore
Connecting to Luna Cloud HSM I am able to add a RSA private key to the HSM (either by cmu importkey or by cmu gen) and the command-line tool cmu list displays this key from the server.
I am connecting ...
1
vote
1
answer
549
views
How to delete public keys from a PKCS#11 security token in Java?
I would like modify a software which was written in Java. The software should be able to create public and private keys on a HSM and also be able to delete them. I would like to do these tasks by ...
0
votes
2
answers
460
views
CKR_TEMPLATE_INCONSISTENT error while creating key on the hsm
I am getting CKR_TEMPLATE_INCONSISTENT error while trying to create a key on the hsm. I am using PKCS11 C# wrapper.
public void GenerateKeyByName(ISession session, string keyName, string keyContent,...
2
votes
0
answers
145
views
Nginx fails to do handshake using pkcs11 key if running in docker container
Error:
SSL_do_handshake() failed (SSL: error:41800082:PKCS#11 module::Object handle invalid error:0A080006:SSL routines::EVP lib) while SSL handshaking, client: 127.0.0.1, server: 0.0.0.0:10001
I am ...
0
votes
1
answer
237
views
RSA signature verification failing for smartcards
I am trying to sign a byte string using the c_sign function from pkcs and I am trying to verify it using RSA.verify() function in ASP.net, but for some reason its failing.
I am using 2048 bit RSA keys ...
0
votes
1
answer
227
views
Login to AWS HSM as crypto-user, Error: Pkcs11Error: CKR_PIN_INCORRECT while perfomrin: pkcs11.C_Login(session, pkcs11js.CKU_USER, "1234"); in Nodejs
I am using AWS HSM. Followed the AWS HSM Setup guide foor FIPS Mode HSM. Installed CloudHSM Command Line Interface (CLI), Created a user called crypto-user by By logging in to HHSM using CloudHSM CLI. ...
0
votes
1
answer
192
views
Pkcs11interop CKR_FUNCTION_NOT_PARALLEL Error
I have developed a worker service in C# Core that signs files using a certificate stored in a USB token with PKCS11Interop. The service creates two Tasks, each intended to sign files with a different ...
-1
votes
1
answer
120
views
PKCS11 cannot Initialize: called `Result::unwrap()` on an `Err` value: Pkcs11(GeneralError)
I try to open new session to softhsm2.
let pkcs11 = Pkcs11::new(
env::var("PKCS11_SOFTHSM2_MODULE")
.unwrap_or_else(|_| "/usr/lib/softhsm/libsofthsm2.so"....
5
votes
1
answer
915
views
How to sign a file with tpm2-pkcs11 and OpenSSL?
I am relatively newbie to these technologies and I am a bit lost about what to do with the error message I currently face.
To put things right, I have an embedded system running Linux 5.10 on which I ...
0
votes
2
answers
399
views
Cannot load key from pkcs11 engine into nginx configuration
I am trying to configure SSL in nginx.conf, and it needs to load the key from softhsm instead of file.
Here is the file /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/...
1
vote
1
answer
942
views
Failed to enumerate slots in pkcs#11
There are several objects in the softhsm as bellow.
$ sudo pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --list-objects -l
Using slot 0 with a present token (0x74a6136e)
Logging in to "...
0
votes
1
answer
348
views
Different signatures when signing the same data using the same private key in Pkcs11Interop and RSACryptoServiceProvider
I want to use a Hardware Security Module (HSM) to sign a string. Specifically, I am using the ePass3003Auto to do so. I have stored the certificate in the HSM, which I have it's private key. Using the ...
1
vote
0
answers
82
views
pkcs11interop session pops up the wrong "Token logon" window , instead of "Digital Signature PIN logon" window (thales/Gemalto vendor eTPKCS11.dll)
I am using the pkcs11interop to create the session for a token
and force the "Digital Signature PIN logon" popup to appear for user.
but wrong popup shows "Token logon":
but this ...
0
votes
0
answers
73
views
Build softhsm2 and link library to own application using cmake
Anyone knows how to link a PKCS#11 interface specific SoftHSM - https://github.com/Zeno-sole/softhsm2/blob/master/README.md in CMakeList.txt. Basically, I want to build my application (which needs ...
2
votes
1
answer
2k
views
Why OpenSSL doesn`t work with PKCS11-URI?
My problem:
I try to use an RSA key via pkcs11 uri, stored into external sql file created by tpm2_ptool.
My goal is to create an Certificate-Sign-Request (CSR).
I get the follow error message:
Could ...
1
vote
0
answers
515
views
Support curl tpm2 access like openssl via handles?
What we try to do:
We try to use curl to create an https connection to backend by using TPM2 with internal key.
The only way sems to use an PKCS11-URI like
"pkcs11:model=SLB9670%00;manufacturer=...
-1
votes
1
answer
354
views
Error on using PKCS#11 Driver Library acospkcs11.dll in Chilkat PKCS11 for .NET 8
I am successfully using Pkcs11Interop 5.1.2 library for digital signing using PKCS#11 Driver Library acospkcs11.dll.
But when using the ChilkatDnCore 9.50.97 library (License purchased), when I call ...
0
votes
1
answer
288
views
How To Modify PKCS11 Object Value Attribute
I have a Nitrokey HSM 2 which I am using python-pkcs11 to interface with via a Python3 program. I have an object of class type pkcs11.ObjectClass.DATA on the HSM whose Attribute.VALUE I would like to ...
1
vote
1
answer
130
views
CKR_DEVICE_REMOVED | PKCS 11 | IAIK Wrapper | On Idle time
I am using iaikPkcs11Wrapper_1.6.2.jar to encrypt/decrypt using Utimaco HSM.
Operations are working fine but after some idle time, when I request for encrypt/decrypt then I am getting TokenException ...
-1
votes
1
answer
358
views
How to pass private ssl key from HSM(alogorithm pkcs11) to ssl enabled websocket server using libwebsockets library for the c++ project [closed]
I am trying to create a websocket client in my c++ project. i was trying to use libwebsockets library to implement the same. websocket server is ssl enabled. I got this working by hard coding the ssl ...
1
vote
0
answers
165
views
How to sign an OCSP request using a CloudHSM private key in Python
I am trying to sign my OCSP builder to create a valid OCSP response for client use. However I'm receiving this error when I try to sign my response builder:
'ERROR': "PKCS#11 Error: Unknown ...
0
votes
1
answer
645
views
File Signing using BouncyCastle in a HSM Environement
I have used
public static void signContent(String cfgFilePath , String alias ,String tokenPassword , String inputFile , String outputFile){
try {
CMSSignedDataGenerator ...
1
vote
2
answers
162
views
PkcsInterop throws Dll not found on Linux
I am getting familiar with PKCS11 and using PKCSInterop. For now, I only want to check the tokens I created on my OS (arch linux) with softhsm2-util.
I installed PKCS11Interop through Nuget, which I ...
0
votes
0
answers
598
views
How to sign in PAdES with Nodejs
I'm trying to create a function in nodejs for digital signature from smart card for signing pdf documents in pades format. I used the pkcs11js library to retrieve the certificate and private key. I ...
0
votes
1
answer
289
views
how to use ePass3003 token in python for digital signature?
I want to use Python to connect to the ePass3003 token to sign a string or data from JSON and sign it (everything I want to sign, I said JSON as an example)
I know that it is not possible to extract ...
0
votes
1
answer
339
views
Problem with "pkcs11.h" when running with "go build" or "go run main.go"
I'm making a CGO code that uses PKCS11 and after enabling CGO and some errors, tests and corrections I've found a new error that I never seen. It doesn't matter if I use "go build" or "...
1
vote
1
answer
546
views
Undefined problems usin the package miekg/PKCS11 in Golang
I'm trying to use this package using Golang but doesn't matter what I do I always receive the same Undefined errors in New, Mechanism and NewMechanism.
I've already checked the environment variables ...
2
votes
3
answers
3k
views
Code-Signing Windows EXE with Sectigo Hardware Token (SafeNet Authentication Client) on Ubuntu 22.04 Using PKCS11 Tools and osslsigncode
I am able to sign my Windows EXEs on Windows using SAC and singtool.exe. But this requires a Windows machine which I don't have readily available access to. I primarily work on Linux and the Sectigo ...
2
votes
1
answer
1k
views
How to sign pdf document with certificate on PKCS11 USB token protected with the PIN?
I want to write a python script that lists to the user all the certificates that are on the PKCS11 USB token. When the user selects the desired certificate, the script needs to sign the input pdf ...
0
votes
0
answers
843
views
java.security.ProviderException: Initialization failed
I am writing a java program that needs to read a USB Token Flash Private Key to do something, but I got stuck in the first phase of this program and it throws Error like this:
Exception in thread &...
1
vote
2
answers
1k
views
osslsigncode Sign with Hardware Token issue (Failed to set 'dynamic' engine)
I'm trying to sign EXE files with osslsigncode, my cert and key are on a Safenet Hardware token which the system is able to read :
:~# pkcs11-tool --module /usr/lib/pkcs11/libeToken.so --login --list-...
1
vote
0
answers
139
views
What is the pkcs11 equivalent of NCryptSecretAgreement and NCryptDeriveKey functions
I have an application running on Linux which needs to generate derived key with ECDH. I get ephemeral public key and KDF parameter and need to return derived key data.
This will be matched against ...
1
vote
1
answer
232
views
Can't get greengrass to work with TPM privkey and cert
I'm trying to get greengrass working with a SLB9670 tpm, and can't seem to get it working no matter what I try. All documentation online seems incorrect or deprecated in relation to this process. This ...
0
votes
0
answers
143
views
IAIK PKCS11 wrapper support for Virtual Slot (HA)
Session logic implemented with IAIK seems to be on top of token, but in case of Virtual Slot (like Luna HSM High Availability) where there is no token present how to obtain a session via the IAIK Java ...
4
votes
0
answers
4k
views
Where is engine_pkcs11.so?
I'm trying to run openssl in combination with a PKCS#11 hardware security module (currently trying with Yubikey 5). All documentation and tutorials I find tell me that I have to use OpenSC as "...