Error received while decrypting data when private key is retrieved from HSM.
I have added sunpkcs11 provider in java.security. Hence, NOT adding provide
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());