HSM Error | Private key must be instance of RSAPrivate(Crt)Key or have PKCS#8

后端 未结 2 1553
野的像风
野的像风 2021-02-04 22:19

Error received while decrypting data when private key is retrieved from HSM.

I have added sunpkcs11 provider in java.security. Hence, NOT adding provide

2条回答
  •  梦如初夏
    2021-02-04 22:40

    I have used following code and issue has been resolved

        SunPKCS11 provider = new SunPKCS11("/home/user/pkcs11.cfg");
        Security.addProvider(provider);
        KeyStore keystore = KeyStore.getInstance("PKCS11");
        keystore.load(null, passphrase.toCharArray());
    

提交回复
热议问题