Creating token key entry with SunPKCS11

Hi:

I have a problem creating a key entry in a smart card using PKCS11. I use a PKCS12 file as my input which is correctly loaded, I can parse the certificate chain. Then I try to load the key onto the card, but this fails in the C_CreateObject native method:

java.security.KeyStoreException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DEVICE_MEMORY

at sun.security.pkcs11.P11KeyStore.engineSetEntry(P11KeyStore.java:1104)

at java.security.KeyStore.setEntry(Unknown Source)

at com.safelayer.certmgr.Pkcs12Import.main(Pkcs12Import.java:88)

Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DEVICE_MEMORY

at sun.security.pkcs11.wrapper.PKCS11.C_CreateObject(Native Method)

at sun.security.pkcs11.P11KeyStore.storePkey(P11KeyStore.java:1873)

at sun.security.pkcs11.P11KeyStore.engineSetEntry(P11KeyStore.java:1100)

... 2 more

It appears that I have correctly registered the provider and got the key store, but some permission is missing to create the object. I tried to add

attributes(*,*,*) ={ CKA_TRUSTED =true}

to the configuration, but no luck. How do I configure the provider such that I can manage certificates on the card?

Thanks, Erik

[1335 byte] By [norgaarda] at [2007-11-26 16:43:12]
# 1
Problem solved, buggy reader :(
norgaarda at 2007-7-8 23:10:19 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 2
i came up with the same problem. Can you tell me your way to deal with it ?thanks!
zhangmz.xmua at 2007-7-8 23:10:19 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 3
i came up with the same problem. Can you tell me your way to deal with it ?thanks!zhangmz.xmu@gmail.com
zhangmz.xmua at 2007-7-8 23:10:19 > top of Java-index,Security,Other Security APIs, Tools, and Issues...