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
0
votes
1 answer

Generating XAdES from USB Token in c#

I’m trying to sign XML files via a USB Token in the XAdES format. Documentation on System.Security.Cryptography.Xml is scarce. I can only find how to sign an XML with basic/default options…
Dalmo
  • 1
  • 2
0
votes
1 answer

PKCS#11 interop convert in .net core error in RHEL

I am using PKCS#11 interop version 1.3. Converted this version in .netcore 3.1. While with .netcore application it is working fine in windows environment but giving error in RHEL Method C_FindObjectsInit returned CKR_TEMPLATE_INCONSISTENT I know…
jiten
  • 5,128
  • 4
  • 44
  • 73
0
votes
2 answers

how to find paired ECDSA private key PKCS11 having public key

I have an application that works with smartcards that have RSA certificates on them For some reason manufacturer does not fill CKA_LABEL on them, so i fidn private key object for RSA like this: RsaKeyParameters rsaPubKeyParams =…
0
votes
1 answer

Pkcs11Interop empty slot list

I recently created a Console app which held the context of Pkcs11Interop library, along with HSM dll. It worked fine, however I needed to rewrite the code to Windows Service (I hosted it as gRPC service since it's .NET Core). After hosting WS, it…
Kokos34
  • 67
  • 1
  • 11
0
votes
1 answer

pkcs11interop generate key pair(EC or ECDSA), get error

This is my code : X9ECParameters x9Ec = NistNamedCurves.GetByName("P-256"); X962Parameters x962 = new X962Parameters(x9Ec); byte[] paramsBytes = x962.Parameters.GetDerEncoded(); List publicKeyAttributes = new…
Randy
  • 3
  • 3
0
votes
1 answer

Pkcs11Interop (C#) - Calculate HMAC Signature on Utimaco HSM Simulator

I have to generate HMAC(SHA256) signature with an AES-256 key on the Utimaco HSM simulator. I use the PKCS#11 library "Pkcs11Interop" (C#) for this. My source code function: public static byte[] GetSignatureHmacSha256(IObjectHandle secretKeyHandle,…
Eugen20
  • 1
  • 1
0
votes
1 answer

How to create Digital Signature with CAdES format using Pkcs11Interop in C# without data or document to sign

I am new in cryptographic programming. I want to create only digital signature in C# with CAdES format using Pkcs11Interop library without having data or document or message to sign, I want the signature string only to use it on any json or xml file…
0
votes
2 answers

AWS cloudhsm with PKCS#11 not able to export RSA public key

I am generating a RSA key pair with AWS cloud HSM with PKCS11Interop c# library on top of AWS vendor PKCS library. Wanted to export a public key from HSM with PKCS 11 getAttributeValue methods. The response states that attributes cannot be read, I…
Pravin
  • 810
  • 1
  • 10
  • 17
0
votes
0 answers

Get Invalid signature from PDF on signing hash using private key from token

I am trying to sign a Hash of PDF Document that i receive from server. But it is showing "At Least one signature is invalid" in Adobe Reader. Can anybody suggest what is wrong in following code. Right now im just try implemented a code in one…
dejulz Zul
  • 53
  • 8
0
votes
0 answers

Concatenate data and base does not work as expected

I have a key in HSM I want to derive another key from it and use it to SHA1 HMAC some data my problem is that CKM_CONCATENATE_DATA_AND_BASE mechanism does not work as expected. I think it work as below: if my key (BASE) is "11 22 33 44 55 66 77 88"…
0
votes
1 answer

Why sign method returns only four bytes?

I am trying to implement pkcs 11 standard using pkcs11interop I have some des2 keys (16 byte) and i want use sign method my problem is that sign method returns only four bytes. but I want 8 byte sign. what should i do? PS 1: the four byte result is…
0
votes
1 answer

Softhsm2 with pkcs11interop error. Value was either too large or too small for a UInt32

I have following code for softhsm2 test via pkcs11interop library using Net.Pkcs11Interop.Common; using Net.Pkcs11Interop.HighLevelAPI; using Net.Pkcs11Interop.HighLevelAPI80; using System; using System.Collections.Generic; namespace ExportTest { …
Kamran Shahid
  • 3,954
  • 5
  • 48
  • 93
0
votes
3 answers

Import a private key using PKCS#11

We're trying to import an RSA key pair using C# and PKCS#11 into our HSM. Importing the private key using: var privateKeyAttributes = new List(); privateKeyAttributes.Add(new ObjectAttribute(CKA.CKA_ID, ckaId)); …
D.R.
  • 20,268
  • 21
  • 102
  • 205
0
votes
1 answer

PKCS Library for Safenet 5100

static string pkcs11LibraryPath = @"C:\Windows\System32\eTPKCS11.dll"; using (Pkcs11 pkcs11 = new Pkcs11(pkcs11LibraryPath, AppType.SingleThreaded)) { // Get list of available slots with token present List slots =…
huse.ckr
  • 530
  • 12
  • 39
0
votes
2 answers

CreateObject PKCS#11 fail

I tried to comment on this link https://stackoverflow.com/a/39798597/448266, but could not due to the reputation #. I have tried the sample and run well, but when I changed to arbitrary value it returns exception Message:…
Bondhan Novandy
  • 362
  • 1
  • 4
  • 16