Dear All,
I have an urgent problem I have Aladdin eToken Pro USB device and I need to generate private key on it, I was able to load the KeyStore using the pkcs#11 dll file and I was able to generate private and public key from the KeyPairGenerator , but I don't have any Idea on how to store the private key on the Aladdin eToken device ... here is the code which I have used please help me
String configName = "C:\\eTokenConfig.cfg";
Provider p = new sun.security.pkcs11.SunPKCS11(configName);
Security.addProvider(p);
// Read the keystore form the smart card
char[] pin = { '1', '2', '3', 'q', 'w', 'e'};
KeyStore keyStore = KeyStore.getInstance("PKCS11",p);
keyStore.load(null, pin);
System.out.println(keyStore.size());
//generate keys
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA",p);
KeyPair pair = kpg.generateKeyPair();
PrivateKey privateKey = pair.getPrivate();
PublicKey publicKey = pair.getPublic();