Can't decrypt RSA encrypted text using pkcs11-tool

923 views Asked by At

I am trying to decrypt RSA encrypted text using OpenSC's pkcs11-tool. I am using a Siemens CardOS5.0 card. I run the following line in terminal:

pkcs11-tool --module cardos11.dll --pin 12345 --login --decrypt --id 99

and it gives me the following error:

error: PKCS11 function C_Decrypt failed: rv = CKR_DEVICE_ERROR (0x30)

It gives me this error regardless of which key I use.

I then wrote a python script that uses the PyKCS11 module and decrypts as well.

result1 = ckbytelist()
v = session.lib.C_DecryptInit(session.session, m, k1)
v = session.lib.C_Decrypt(session.session, result, result1) 
print(result1)

where result is encrypted text.It returns null as well.

Is the problem in my approach or in the device?

0

There are 0 answers