Questions tagged [pkcs11interop]

Pkcs11Interop is managed .NET wrapper for unmanaged PKCS#11 libraries that provide access to the cryptographic hardware

Pkcs11Interop is managed library written in C# that brings PKCS#11 API to the .NET environment.

It loads unmanaged PKCS#11 library provided by the cryptographic device vendor and makes its functions accessible to .NET application.

The library is open source and hosted on GitHub.

104 questions
2
votes
1 answer

Keys created from one HSM client are not available for use in another client

I am building a solution to store keys and encrypt\decrypt data using an HSM. I am using a network HSM manufactured by Thales. The thing I have noticed is that a key generated in client machine 1 is inaccessible in client machine 2. The key can only…
Aashish Upadhyay
  • 840
  • 1
  • 7
  • 22
2
votes
1 answer

Pkcs11Interop CKR_ENCRYPTED_DATA_INVALID exception cause high CPU usage

We are using Pkcs11Interop library for cryptography and we customize&implement Pkcs11Interop code samples for our project where Pkcs11Interop documents in Github. In production, not everyday but we have to restart server after CPU usage reach…
Murat Gündeş
  • 852
  • 2
  • 17
  • 31
2
votes
1 answer

In the pkcs11interop project code, I see CKM_ECDSA_SHA256, but in the nuget package I added to my solution its not there

I need to use ECDSA with sha256 with a hsm and I am using c# with the http://www.pkcs11interop.net/ wrapper. The Github code has CKM_ECDSA_SHA256, but not the 3.3.0 release even though the release is the latest as of Jan 24 and the enum was added…
minime
  • 79
  • 8
2
votes
1 answer

Threadsafe usage of PKCS11Interop library in C#

I am using PKCS11Interop to perform Key Management operations inside an HSM. The HSM I am using is Thales PCI Express. Below is the class that wraps all operations being performed in HSM: public sealed class KeyStoreOperations { private…
Aashish Upadhyay
  • 840
  • 1
  • 7
  • 22
2
votes
2 answers

How to reuse existing private key to generate a digital signature using smartcard and PKCS#11

I want to create a digital signature using pkcs11 standard. Lets suppose that I already has a public and private key pair that is stored on my smart card. This keys was generated by using next code: byte[] ckaId = session.GenerateRandom(20); //…
Tequila
  • 726
  • 7
  • 23
2
votes
2 answers

Create 3DES key with pkcs11Interop and output key value, or proivde key value for creation

I was wondering whether it is possible using pkcs11interop to create a 3DES key and specify the key value for creation, or otherwise create a key and output the generated key value. Basically I need the secret key to be exported to another device.…
Andre
  • 31
  • 5
2
votes
1 answer

Identification of private key in Pkcs11Interop.PDF library

I am trying to setup up an example application with the Pkcs11Interop.PDF extension. I am unfortunately getting a System.ArgumentNullException setting the ckaId. What would work here? I tried different numbers here which all gave me a…
ejones
  • 105
  • 1
  • 3
  • 10
1
vote
1 answer

How to use SHA512 hashing algorithm with elliptic curve to sign, in PKCS11Interop?

In am using PKCS11Interop in C#, i got CKR_MECHANISM_INVALID error while trying to use method Sign. The key object i am using is of mechanism type CKM_EC_KEY_PAIR_GEN . but at signing time, i use mechanism CKM_ECDSA_SHA512 . I tried to define key…
1
vote
1 answer

HSM RSA OAEP Encryption with Asymmetric hashes fails

I am using the PKCS11Interop library to Encrypt and Decrypt data with the parameters below. CK_RSA_PKCS_OAEP_PARAMS p = new CK_RSA_PKCS_OAEP_PARAMS(); p.HashAlg = (uint)CKM.CKM_SHA256; p.Mgf = (uint)CKG.CKG_MGF1_SHA1; p.Source =…
jr pineda
  • 186
  • 7
1
vote
1 answer

How to AuthenticateAsServer when Certificate is in HSM and privateKey is not embeded in Certificate and PrivateKey is not extractable from HSM

I want to ask a qusetion according to my code, My code is as bellow: in AuthenticateAsServer I get "The server mode SSL must use a certificate with the associated private key" error cause privatekey is not in my certificate and also privatekey is…
TBT
  • 55
  • 1
  • 1
  • 4
1
vote
1 answer

How to decrypt softhsm wrappedKey

I'm using pkcs11interop library with SoftHsm2 I have generated aes key: var mechanism = session.Factories.MechanismFactory.Create(CKM.CKM_AES_KEY_GEN); var generatedKey = session.GenerateKey(mechanism, AesKeyAtribute(hsmSession, label)); private…
Damian
  • 11
  • 1
1
vote
1 answer

pkcs11Interop problem with WaitForSlotEvent when reader is removed

I set up pkcs11Interop Library as follows Pkcs11Library = PkcsFactories.Pkcs11LibraryFactory.LoadPkcs11Library(PkcsFactories, pkcs11LibraryPath, AppType.MultiThreaded) I then immediately use a WPF DispatcherTimer which contains the…
darbid
  • 2,545
  • 23
  • 55
1
vote
0 answers

How to produce a valid Pkcs11UriBuilder based on the current smartcard

I do have a smartcard from thales/gemalto which I can access via their SafeNet software. I'm using Pkcs11Interop for accessing the smartcard via c#. I am able to read the basic information and also can login using the pin via c#. I now need to…
Manuel
  • 1,985
  • 3
  • 31
  • 51
1
vote
1 answer

Where can i find the PKCS11 unmanaged library for the cherry SmartTerminal ST-1144

I want to use the cherry SmartTerminal ST-1144 in order to finally sign pdf documents with certificates from a smartcard. I do use the .net PKCS11Interop. In the following code i need to provide the unmanaged PKCS11 library for the Cherry…
Manuel
  • 1,985
  • 3
  • 31
  • 51
1
vote
1 answer

RSA OAEP Encryption with SHA-256 fails while with SHA-1 is OK

I'm using Pkcs11Interop Library and trying to test encryption and decryption with RSA_PKCS_OAEP mechanism. CK_RSA_PKCS_OAEP_PARAMS p = new CK_RSA_PKCS_OAEP_PARAMS(); p.HashAlg = (uint)CKM.CKM_SHA_1; p.Mgf = (uint)CKG.CKG_MGF1_SHA1; p.Source =…
Ekrem Solmaz
  • 637
  • 1
  • 10
  • 22