-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
supporting EJBCA #63
Comments
Current blocking problems:
|
Need to find a way to fix the key renaming, maybe the PKCS11 java lib ? |
It seems like the EC key problems are fixed by changes in main. |
The problem seems to come from the Java library.
As the key is generated on the device, it uses the device to sign the certificate. Also in the storing part the key is already on the device so it renames it. example code : package com.example;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.PublicKey;
import java.security.Security;
import java.security.Signature;
import java.security.cert.Certificate;
import java.util.Base64;
import java.util.Map;
public class App {
public static void main(String[] args) throws Exception {
// Load the PKCS#11 provider
String pkcs11Config = "/opt/pkcs-test/pkcs11.cfg";
Provider provider = Security.getProvider("SunPKCS11");
provider = provider.configure(pkcs11Config);
Security.addProvider(provider);
// Initialize a session
char[] pin = "123456".toCharArray();
KeyStore keyStore = KeyStore.getInstance("PKCS11", provider);
keyStore.load(null, pin);
// generate a rsa key pair
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA", provider);
keyPairGenerator.initialize(2048);
KeyPair keyPair = keyPairGenerator.generateKeyPair();
Certificate certificate = generateCertificate(keyPair,provider);
keyStore.setKeyEntry("your_key_alias", keyPair.getPrivate(), pin, certificate);
}
} pkcs11.cfg :
|
New error when clicking 'test' on EC keys : |
Generating a P-384 EC key now works, there is still problem for the other EC key sizes |
The ECDSA problems are now solved |
#85 would be a partial fix |
Potentially PKCS#11 NG would be a solution. |
No description provided.
The text was updated successfully, but these errors were encountered: