Cannot find private match with certificate cka id / cka label

38 visningar
Hoppa till det första olästa meddelandet

kifle...@gmail.com

oläst,
23 feb. 2020 22:53:492020-02-23
till Pkcs11Interop
Hi guys, 

Im working on signing using private key in usb token which have multilple certificate inside it. So i need to get private key which match with the valid certificate...


List<ObjectAttribute> privateKeyAttributes = new List<ObjectAttribute>();
privateKeyAttributes.Add(new ObjectAttribute(CKA.CKA_CLASS, CKO.CKO_PRIVATE_KEY));
privateKeyAttributes.Add(new ObjectAttribute(CKA.CKA_KEY_TYPE, CKK.CKK_RSA));

List<ObjectHandle> foundPrivateKeys = session.FindAllObjects(privateKeyAttributes);
Console.WriteLine("Total private Key found : " + foundPrivateKeys.Count); // total = 2


Then to match current valid certificate... id add cka id for attribute


List<ObjectAttribute> privateKeyAttributes = new List<ObjectAttribute>();
privateKeyAttributes.Add(new ObjectAttribute(CKA.CKA_CLASS, CKO.CKO_PRIVATE_KEY));
privateKeyAttributes.Add(new ObjectAttribute(CKA.CKA_KEY_TYPE, CKK.CKK_RSA));
privateKeyAttributes.Add(new ObjectAttribute(CKA.CKA_ID, "11e333453512212")); // add this CKA_ID or CKA_LABEL

List<ObjectHandle> foundPrivateKeys = session.FindAllObjects(privateKeyAttributes);
Console.WriteLine("Total private Key found : " + foundPrivateKeys.Count); // total = 0


but when i count the private key , its get 0 ...already use cka or cka label.. but still dont get the private key match..

Please help if someone has experience this before .. Thank you


Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden