How to initialize the PKCS11 provider without using SunPKCS11?

1.5k views Asked by At

I have a problem and I tried searching a solution but couldn't find it. Someone please help me, thanks you so much.

String pkcs11Config = "name=CA-Token\nlibrary=C:/java/CA-Token_v2.dll\nslot=1";
InputStream is = new ByteArrayInputStream(pkcs11Config.getBytes())
SunPKCS11 providerPKCS11 = new sun.security.pkcs11.SunPKCS11(is); // (1)
Security.addProvider(providerPKCS11);

For this code, can we initialize the PKCS11 provider without using SunPKCS11?

1

There are 1 answers

0
MrLinux On

It's been a while since this question was posted, but if you'd like to use a PKCS11 provider other than SunPKCS11, you can use:

You just need to instantiate them and register with "Security.addProvider(yourProvider)"