Dear all,
I tried to use opensc-pkcs11.so with Java's SunPKCS11
provider to
decrypt (RSA) data with rsa private key on token. It's ok to
decrypt
data, however, if I unplug the token and plug the same token
again
(cryptoflex token), it fail to decrypt.
Another problem is that the pin is cached even I set the
cache_pins =
false in /etc/opensc.conf.
Here is java exception and opensc debug log.
Java Exception:
javax.crypto.BadPaddingException: doFinal() failed
at
sun.security.pkcs11.P11RSACipher.implDoFinal(P11RSACipher.ja
va:328)
at
sun.security.pkcs11.P11RSACipher.engineDoFinal(P11RSACipher.
java:353)
at javax.crypto.Cipher.doFinal(DashoA12275)
......
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception:
CKR_GENERAL_ERROR
at
sun.security.pkcs11.wrapper.PKCS11.C_Decrypt(Native Method)
at
sun.security.pkcs11.P11RSACipher.implDoFinal(P11RSACipher.ja
va:306)
Opensc-debug.log:
pkcs11-object.c:280:C_FindObjectsInit: 1 matching objects
pkcs11-object.c:124:C_GetAttributeValue: Object 1:
CKA_KEY_TYPE = <size inquiry>
pkcs11-object.c:124:C_GetAttributeValue: Object 1:
CKA_KEY_TYPE = CKK_RSA
pkcs11-object.c:124:C_GetAttributeValue: Object 1:
CKA_MODULUS = <size inquiry>
pkcs11-object.c:124:C_GetAttributeValue: Object 1:
CKA_MODULUS =
D16FAD9703DBB10687349F17C73D10BCF37A097F2DAB73B8B405462C85A2
7749
pkcs11-object.c:124:C_GetAttributeValue: Object 1: CKA_TOKEN
= <size inquiry>
pkcs11-object.c:124:C_GetAttributeValue: Object 1:
CKA_SENSITIVE =
<size inquiry>
pkcs11-object.c:124:C_GetAttributeValue: Object 1:
CKA_EXTRACTABLE =
<size inquiry>
pkcs11-object.c:124:C_GetAttributeValue: Object 1: CKA_TOKEN
= TRUE
pkcs11-object.c:124:C_GetAttributeValue: Object 1:
CKA_SENSITIVE = TRUE
pkcs11-object.c:124:C_GetAttributeValue: Object 1:
CKA_EXTRACTABLE = FALSE
pkcs11-object.c:723:C_DecryptInit: Decrypt initialization
returns 0
framework-pkcs15.c:1975:pkcs15_prkey_decrypt: Initiating
unwrap/decryption.
pkcs15-sec.c:72:sc_pkcs15_decipher: called
card.c:541:sc_select_file: called; type=2,
path=3f00501530450012
card-flex.c:588:flex_select_file: called, cached
path=3f00501530450012
card.c:563:sc_select_file: returning with: 0
sec.c:63:sc_set_security_env: called
sec.c:67:sc_set_security_env: returning with: 0
sec.c:35:sc_decipher: called
apdu.c:504:sc_transmit_apdu: called
framework-pkcs15.c:2025:pkcs15_prkey_decrypt: Key
unwrap/decryption
complete. Result -1114.
misc.c:80:sc_to_cryptoki_error: opensc error: Reader
detached (hotplug
device?) (-1114)
pkcs11-object.c:749:C_Decrypt: Decryption result was 5
--
Butler
_______________________________________________
opensc-user mailing list
opensc-user lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-
user
|