Questions tagged [sunpkcs11]

SunPKCS11 is a Java crypto provider for interfacing with PKCS#11 tokens. It is part of the standard Java code base.

The documentation for the provider (as of Java 10) can be found here: PKCS#11 Reference Guide.

26 questions
26
votes
2 answers

SunPKCS11 provider in Java 9

Up to Java 8 the SunPKCS11 provider was loaded like this: Provider provider = new sun.security.pkcs11.SunPKCS11 (new ByteArrayInputStream (configFile.getBytes ())); Security.addProvider (provider); configFile is a String with the configuration…
Pepe Gutiérrez
  • 305
  • 1
  • 3
  • 6
8
votes
1 answer

java.security.NoSuchAlgorithmException: PKCS11 KeyStore not available, Trying to Enable FIPS mode using SUNPKCS11 in java 11

I'm trying to enable FIPS mode using SUNPKCS11 with NSS in Java 11. I got this exception java.security.NoSuchAlgorithmException: PKCS11 KeyStore not available. When I tried to enable FIPS in Java 8 it works fine but doing the same in Java 11 throws…
N V
  • 81
  • 1
  • 6
5
votes
2 answers

No such algorithm: PKCS11 for provider SunPKCS11-CartaoCidadao

There are my current providers: 0 - Provider name: SUN 1 - Provider namer: SunRsaSign 2 - Provider name: SunEC ... 9 - Provider name: SunPKCS11-CartaoCidadao The ninth provider is the one that I'm trying to use, which uses the pkcs11…
Marco Ventura
  • 51
  • 1
  • 4
2
votes
1 answer

Sun PKCS11 library C_Encrypt and C_Decrypt changes

Up until now I was using C_Encrypt and C_Decrypt methods of Sun PKCS11 Wrapper smoothly. It was; C_Encrypt(v1,v2,v3,v4,v5,v6,v7) # requiring 7 parameters But after upgrading from Ubuntu 16.04 to 18.04, my Java updated to 1.8.0_275 build. Now it…
shyos
  • 1,390
  • 1
  • 16
  • 29
2
votes
0 answers

Getting error java.security.KeyStoreException: PKCS11 not found while using softhsm as hsm

I am using command line tool "keytool" to create a key pair in softhsm. I have added security.provider in java.security. # List of providers and their preference orders (see…
2
votes
1 answer

CKR_USER_NOT_LOGGED_IN when generating key pair using sunPKCS11 provider

When trying to generate rsa key pair with sun PKCS11 provider, method generateKeyPair() throws ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_USER_NOT_LOGGED_IN My code looks like this: Provider prov = ... // initialize…
Drifter
  • 85
  • 1
  • 7
2
votes
0 answers

Docker Setup with PKCS11

Background We are developing a Spring application which does crypto operations. Requirement of project is that this application implementation should be independent of HSM specific libraries (because client may have any HSM) and hence we used…
snesh
  • 71
  • 7
2
votes
1 answer

PKCS#11 Signature with iText & eTPKCS11.dll & SunPKCS11 Provider

I have problems when trying to make signature using SunPKCS11 Provider linked to eTPKCS11.dll. Even with iText signDetached, also when trying simple Signature, I always get "Exception in thread "main" java.security.ProviderException:…
1
vote
1 answer

Document altered/corrupted while attaching IAIK PKCS11 signing Hash

I have a base64 encoded message digest (signing bytes of a pdf), which I want to sign and return PKCS7. Previously, I was using SUNPKCS11 and was able to attach the same to the pdf. I have started using IAIK PKCS11 Wrapper. Below is the process, I…
tulak.hord
  • 63
  • 1
  • 9
1
vote
1 answer

Initialization of SunPKCS11 provider dynamically with OpenJDK 8 failed

I tried to initialized dynamically SunPKCS11 provider using OpenJDK 8 1.8.0_322 (on Linux) but get the following exception: java.lang.ExceptionInInitializerError at AES256.init(AES256.java:26) at AES256.encrypt(AES256.java:76) at…
Sinica87
  • 21
  • 3
1
vote
0 answers

java.security.ProviderException: Could not create trust object

I have Java application running on two different servers. On the 1st server while the application is trying to insert a X.509 certificate to NSS keystore it is getting the following error: Failed to store public key certificate in keystore. Cause:…
Petaluma007
  • 41
  • 1
  • 4
1
vote
1 answer

PKCS11 does not recognize new slot created in softhsm in runtime

I have a piece of code to import key and certificate into hsm using java. The problem is that when I run the java back-end to execute that api, it is ok when using the slots which were created before. However the problem here, when I create new slot…
1
vote
0 answers

java.security.KeyStoreException: PKCS11 not found Caused by: java.security.NoSuchAlgorithmException: no such algorithm: PKCS11 for provider SunPKCS11

I have recently migrated from Java8 to Java11. The below piece of code is giving an issue: One of my methods to load the provider looks like below: Provider prototype = Security.getProvider("SunPKCS11"); final String providerConfig =…
1
vote
1 answer

How to initialize the PKCS11 provider without using SunPKCS11?

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…
bathudaide
  • 737
  • 1
  • 4
  • 12
1
vote
1 answer

SunPKCS11 usage against HSM without CKO_CERTIFICATE

My problem concern the usage of an hsm with Java (openjdk 11.0.12). Hsm should be use for signature purpose, by SHA512 RSA algorithm. I could be wrong in a lot of the following sentences, I'm totally newbie with HSM & co, so I apologize in…
1
2