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.

15 questions
22
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
  • 265
  • 2
  • 6
6
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
  • 61
  • 5
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,347
  • 1
  • 16
  • 29
2
votes
1 answer

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…
1
vote
1 answer

Is the Sunpkcs11 provider compatible with the AWS CloudHSM?

I am trying to work with an HSM (hardware security module) to store keys and to do cryptographic operations. I want to operate the HSM inside a java application. For this I need to use a compatible java JCE provider as a mapping layer between the…
1
vote
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…
Prabal
  • 77
  • 7
1
vote
0 answers

How to fix "Reconnect SunPKCS11 After connection timeout with Token has been removed"

I've problem about reconnect to SUNPKCS11 after connect was timeout and I want to reconnect to SUNPKCS11 again. I use this Code for connect to SUNPKCS11 in first time. public void getConnection(String name, String slot, String lib, String type,…
1
vote
1 answer

Why lists pksc11-tool seven Objects but Java Keystore has Only one

When I do in the cmd line: pkcs11-tool --login -O I get seven Objects that are on my smartcard, 3 Public Key Objects, 3 Certificate Objects and one Private Key Object. But when I try to do the same with a small Java Code, I only find one…
conryyy
  • 95
  • 8
1
vote
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
  • 75
  • 1
  • 4
1
vote
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
  • 61
  • 6
1
vote
1 answer

do sunpkcs11 supports CK_sensitive attribute for derived key using ECDH

I am trying to generate a shared secret through ECDH using SUNpkcs11 with certain attributes: CKA_TOKEN= false CKA_SENSITIVE=true CKA_EXTRACTABLE=true" CKA_ENCRYPT=true" While my base key has CKA_DERIVE, SENSITIVE etc set to true but while doing so…
Zach
  • 45
  • 5
0
votes
1 answer

CKR_GENERAL_ERROR when configuring SunPKCS11 with softhsm

I'm getting CKR_GENERAL_ERROR when configuring SunPKCS11 with softhsm. Platform: Winodows 10 64bits OpenJDK 11.0.2 https://github.com/disig/SoftHSM2-for-Windows/releases/download/v2.5.0/SoftHSM2-2.5.0.msi Environment…
leaqui
  • 473
  • 5
  • 18
0
votes
0 answers

How to get al alias from hsm by SUNPKCS provider?

I want to get my all key aliases from hsm, but i get this error message : Exception in thread "main" java.io.IOException: load failed at sun.security.pkcs11.P11KeyStore.engineLoad(P11KeyStore.java:778) at…
0
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:…
0
votes
1 answer

How to use PKCS#11 CKM_AES_KEY_WRAP mechanism in Java?

I'm working with some PKCS#11 tokens that insist on using CKM_AES_KEY_WRAP for unwrapping AES-encrypted keys. On these tokens, CKM_AES_CBC and friends don't support unwrap. At the other end of this system, I therefore need to wrap a key using a…
Duncan Jones
  • 59,308
  • 24
  • 169
  • 227