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
0 answers

Error to validate ECDSA signature in pkcs7

I have successfully generate pkcs7 signature ECDSAwithSHA256 using C# , but then i failed to verify signature using java Here is sample class public class TestVerify { public static void main(String[] args) { String Signature =…
dejulz Zul
  • 53
  • 8
2
votes
1 answer

AWS CloudHSM PKCS#11 with PKCS11Interop giving error for Wrap operation CKR_ARGUMENTS_BAD

I am using latest AWS cloud HSM and there PKCS vendor libraries with PKCS11Interop c# library. Trying to simulate there sample code for CKM.CKM_RSA_AES_KEY_WRAP from AWS PKCS Samples Gives below error while wrapping AES 256 Secret key. …
Pravin
  • 810
  • 1
  • 10
  • 17
2
votes
1 answer

Unwrapping of symmetric key throws Pkcs11Exception / CKR_GENERAL_ERROR

I'm trying to convert the Wrap / Unwrap example from a RSA key pair to a single AES key: // Open RW session using (ISession session = slot.OpenSession(SessionType.ReadWrite)) { string userPin = "1234"; // Login as normal user …
Rufus Buschart
  • 362
  • 1
  • 13
2
votes
1 answer

System.IO.FileLoadException: Could not load file or assembly 'Pkcs11Interop, Version=3.3.0.0

I want to develop Application which can read Token and perform PDF Signing. FYI i successfully signed pdf document, but after im update the Pkcs11Interop version from 3.3.0.0 to 4.1.1.0 Then the signed turn into failed. I've tried to enable…
dejulz Zul
  • 53
  • 8
2
votes
1 answer

PKCS11 unwrap private RSA key to eToken HSM

I am trying to transfer an RSA private key to my HSM (SafeNet eToken) via PKCS#11 interop, and and then unwrap it on the HSM. This is my code (updated): session.Login(CKU.CKU_USER, pin); var x509Certificate = new…
Vladimir K
  • 53
  • 6
2
votes
1 answer

PKCS#11 - How to protect smartcard owner, from malicious smartcard provider when writing new certificates on an already provisioned smartcard

I am currently learning PKCS#11 and there is a certain scenario that I don't know how to deal with. This is the scenario: A client who would like to acquire certificates from a provider enters his data, A client comes to a provider facility, where…
qls
  • 21
  • 2
2
votes
1 answer

PKCS#11 unwrap private key to HSM

I've learned that I cannot simply transfer a private key to my HSM via PKCS#11, I need to wrap it first and then unwrap it on the HSM. So I temporarily create a DES3 key on our HSM, then I'd like to wrap (encrypt) my RSA private key with it, then I…
D.R.
  • 20,268
  • 21
  • 102
  • 205
2
votes
2 answers

I'm trying to create GOSTR3410 public key. CKR_ATTRIBUTE_TYPE_INVALID exeption

Good day! I'm trying to create public key ObjectHandle based on hex string that comes from client via post request. I'm doing it according to the documentation, but it returns me CKR_ATTRIBUTE_TYPE_INVALID exeption. Full exeption message:…
2
votes
2 answers

How to Set/Create a Key Value for AES Secret Key on Network Luna HSM?

When attempting to create a secret key; I'm told that it's not possible to create your own key values and they must be generated/unwrapped onto the HSM. In case this isn't true I've attached both attempts/methods in case I'm missing something. Any…
G .
  • 69
  • 10
2
votes
1 answer

PKCS#11 working on localhost, but it is not working on a live web server (client machine)

I am working with Net.Pkcs11Interop.HighLevelAPI.Pkcs11 to get my epass2003 smart card token details. My code is working fine on localhost; after running I am getting all token information, but whenever I publish my code on my demo server and run…
Prabhakar
  • 55
  • 9
2
votes
1 answer

How to get password failure count of crypto token (Smartcard) using PKCS11Interop

I have .Net application to interact with the crypto token (Smartcard) using PKCS11Interop library where users can login to the token and generate keypair and sign. If users enter the wrong password multiple time token will be locked, how can I get…
Prashanth
  • 507
  • 5
  • 25
2
votes
0 answers

How to manage a network down and avoid error with PKCS11Interop

Using PKCS11Interop on Safenet HSMs, I got this error "Method C_OpenSession returned 2147484548" the error, in my documentation, is CKR_SMS_ERROR: "General error from secure messaging system - probably caused by HSM failure or network failure". This…
Piero Alberto
  • 3,823
  • 6
  • 56
  • 108
2
votes
1 answer

How to add custom OID and values in CSR using bouncy castle

I am trying to add custom OID in CSR like this string subject = "CN=Name,O=Org,C=IN,ST=KA,OU=OrgUn,PostalCode=560103"; X509Name sub = new X509Name(subject); var oidList = sub.GetOidList(); var valueList = sub.GetValueList(); DerObjectIdentifier…
Prashanth
  • 507
  • 5
  • 25
2
votes
1 answer

Pkcs11Exception: Method C_Initialize returned 2147483907

I have a simply method to access my HSM with Pkcs11Interop. This is the function: static public byte[] findTargetKeySValue(String label, String type, string command) { try { string pkcs11LibraryPath = @"C:\Program…
Piero Alberto
  • 3,823
  • 6
  • 56
  • 108
2
votes
1 answer

Pkcs11Interop read key value from HSM

I'm trying to use Pkcs11Interop to extract the value of the key from the HSM. I know, the key has to stay in the HSM, but I need it, so... I already do it with NCryptoki and I'd like to do it also with Pkcs11Interop I tried this code: // Prepare…
Piero Alberto
  • 3,823
  • 6
  • 56
  • 108