Lately, I try to sign data with use of certificate from smartcard. I use cryptoki library to communicate with card reader (PKCS#11 interface). Below You see the methods which I call in order to sign data.
//Getting slot list
C_GetSlotList(CK_TRUE, NULL_PTR, &ulSlotCount)
C_GetSlotList(CK_TRUE, slotList, &ulSlotCount)
//Opening session in RW mode
C_OpenSession(slotList, CKF_SERIAL_SESSION | CKF_RW_SESSION, NULL_PTR, NULL_PTR, hSession)
//Creating ckAttributes list
//Adding new ckAttribute to list
//ckAttribute.type = CKA_CLASS;
//ckAttribute.pValue = &CKO_CERTIFICATE;
C_FindObjectsInit(hSession, ckAttributes, 1)
C_FindObject(hSession, &hObject, 1, &ulObjectCount)
//Trying to sign data in order to get qualified signature with use of vendor specific library and its own Sign method
Everything seems to work fine until I try to call Sign() method from vendor specific library - then I get Access Violation Exception
The handler to certificate looks ok - I'm able to call :
method and succesfully retrieve demanded data.
Does anyone have any idea, what am I doing wrong?
Any help would be appreciated