MemoryAccessViolation while signing data with use of certificate

Hi,

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.

//Initalization
C_Initialize(NULL_PTR)
...
//Getting slot list
C_GetSlotList(CK_TRUE, NULL_PTR, &ulSlotCount)
...
C_GetSlotList(CK_TRUE, slotList, &ulSlotCount)
...
//Opening session in RW mode
C_OpenSession(slotList[0], 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;
...
//Find initialization.
C_FindObjectsInit(hSession, ckAttributes, 1)
...
//finding certificates
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
VendorSpecificSign(hObject)
//**

C_FindObjectsFinal(hSession)
C_CloseSession(hSession)
C_Finalize(NULL_PTR)


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 :
C_GetAttributeValue(...)
method and succesfully retrieve demanded data.

Does anyone have any idea, what am I doing wrong?
Any help would be appreciated

Best regards
Stachu
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories