after key pair generation.....how to do the following
Hi frnds,
I am using Gemplus RAD III.
Hi am generating key pair on the smart card using following code
case INS_GENERATE_RSA_KEY:
if(keyPair==null)
{keyPair = new KeyPair(KeyPair.ALG_RSA_CRT, (short)1024);
keyPair.genKeyPair();
privateRSAKey = (RSAPrivateCrtKey)keyPair.getPrivate();
publicRSAKey = (RSAPublicKey) keyPair.getPublic();
return; }
after generating i want to get the keys from smart if u give the soultion to following i am very much thankful to u.
1. how to get the keys form smartcard
2. how to generate certificate(self signed) using above generated keys.
3. how to import the certficate to smartcard from hard disk using java card program.
4. how to export the certificate from smartcard to hard disk( tell me the steps to write the prg.)
5. tell me the difference between KeyBuilder and KeyPair classes
I want to do all the above using GemplusRADIII. Using this can we write
client application to interact with applet stored on smartcard if yes please tell me.
thanks .....
[1110 byte] By [
b_prasada] at [2007-10-3 3:55:47]

> 1. how to get the keys form smartcard
Define several own APDU-commands that take the generated RSAPrivateCrtKey, get one of the key values (getDP1(), getP(), getQ()...) and retuen it in the response APDU.
> 2. how to generate certificate(self signed) using
> above generated keys.
You can do this offcard by using the exported key-parts from step 1. and converting it to a format your cert-signer understands.
> 3. how to import the certficate to smartcard from
> hard disk using java card program.
I am not sure if you really want this. You can not use imported X.509 certificates on the java cards.
I get the feeling you are looking for a PKCS#15 card. Most java cards are PKCS#15 cards but the PKCS#15 functionality is totally independent of the java card.
> 5. tell me the difference between KeyBuilder and
> KeyPair classes
The KeyBuilder allocates memory (creates new instances of the private/public key class) for a public and private key - but both are empty. The KeyGenerator does the same but at the end generates an RSA key and fills them into the allocated memory.
Jan