pkcs11interop

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

老子叫甜甜 提交于 2019-12-06 09:12:26
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: Net.Pkcs11Interop.Common.Pkcs11Exception: 'Method C_CreateObject returned CKR_ATTRIBUTE_VALUE_INVALID' Inner exeption is null Can you please help me to figure out what i'm doing wrong? Here is my code: using (Pkcs11 pkcs11 = new Pkcs11(Settings.RutokenEcpDllDefaultPath, AppType.MultiThreaded)) { Slot slot = GetSlot(pkcs11); // This public key comes from

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

試著忘記壹切 提交于 2019-12-06 07:25:45
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 be used to encrypt\decrypt data in client machine 1. Is there any thing that needs to be changed in my implementation or is there something to be changed in net-HSM configuration to enable this. I am using PKCS11Iterop library for all the key management operations. I am using token based OCS protection. I suppose your client machine 1 has a new

How to use Pkcs11Interop with an NitroKey HSM to derive an shared secret with an EC

自作多情 提交于 2019-12-06 04:59:59
I bought a NitroKey HSM and manged to create an EC on it. Now I want to derive a shared secret. I found Pkcs11Interop , which seems to be the right tool for the job, but the handling is unclear. A code snipplet or link to a working project would be very appreciated. You can take a look at Pkcs11Admin application for a real world sample using Pkcs11Interop library. As far as I remember NitroKey HSM should be used with OpenSC middleware so your unmanaged library implementing PKCS#11 API will be opensc-pkcs11.dll . I believe these resources might be helpful for you: Getting started with

Multi-threaded Signature Generation C#

隐身守侯 提交于 2019-12-04 04:48:11
问题 This question was migrated from Cryptography Stack Exchange because it can be answered on Stack Overflow. Migrated 2 years ago . I am using PKCS11 Compliant Crypto Device which secures my Private Key. The Crypto Device is capable of generating 500 RSA-2048 Bit Signings per second. I have written an application in C#.NET interfaced with PKCS11Interop Wrapper. Here is my code: #region Initialization Pkcs11 pkcs11 = new Pkcs11(pkcsLibraryPath, true); Slot slot = pkcs11.GetSlotList(true)

PKCS#11 unwrap private key to HSM

大憨熊 提交于 2019-12-01 11:16:50
问题 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 want to unwrap it on the HSM. My code looks like this: // Create temporary DES3 key for wrapping/unwrapping var tempKeyAttributes = new List<ObjectAttribute>(); tempKeyAttributes.Add(new ObjectAttribute(CKA.CKA_CLASS, CKO.CKO_SECRET_KEY));