Forum Stats

  • 3,837,914 Users
  • 2,262,307 Discussions
  • 7,900,431 Comments

Discussions

How to reset the P11Cipher

2727044
2727044 Member Posts: 1
edited Aug 6, 2014 3:57AM in Cryptography

Hi, I'm new to java security, recently working on something about hsm encryption(SunPKCS11), and I found that if I remove the SunPKCS11 provider and re-add, the cipher may not be initialized because the new key token is different from the P11Cipher token, it's just my thought, so if i'm right, how can I reset the P11Cipher token to initial cipher, however, if I'm wrong, do you guys have some ideas?

Below is the error:

Caused by: java.security.InvalidKeyException: Encoded format must be RAW

    at sun.security.pkcs11.P11SecretKeyFactory.convertKey(P11SecretKeyFactory.java:172)

    at sun.security.pkcs11.P11SecretKeyFactory.convertKey(P11SecretKeyFactory.java:111)

    at sun.security.pkcs11.P11Cipher.implInit(P11Cipher.java:380)

    at sun.security.pkcs11.P11Cipher.engineInit(P11Cipher.java:308)

    at javax.crypto.Cipher.init(Cipher.java:1346)

    at javax.crypto.Cipher.init(Cipher.java:1282)

Thanks!

This discussion has been closed.