I have an application to sign a PDF file and I need to extract from token certificate and private key to do this.
I need a code in C# with Pkcs11Interop
LowLevel API. I've tried with this code:
bool success = true;
CK_ATTRIBUTE[] template = new CK_ATTRIBUTE[2];
template[0] = CkaUtils.CreateAttribute(CKA.CKA_CLASS, CKO.CKO_CERTIFICATE);
template[1] = CkaUtils.CreateAttribute(CKA.CKA_TOKEN, true);
List<IObjectHandle> foundObjects = new List<IObjectHandle>();
CKR test = pkcs11.C_FindObjectsInit(SessionOpened, template, Convert.ToUInt32(template.Length));