Skip to Main Content

Java Security

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PKCS#11 - eToken Device problem

843811Dec 2 2009 — edited Dec 14 2009
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(); 
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2010
Added on Dec 2 2009
3 comments
612 views