Pregunta

I am new to java card applet development.i want to create application which send me to public key for the future authentication.for the movement i used RSA algorithm for the create public key and private key.

keys = new KeyPair(KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_2048);
        keys.genKeyPair();
        rsa_publicKey = (RSAPublicKey) keys.getPublic();

now i want to send the public key to my host application.i found some way using modulus and exponent send the public key to host application.but i don't know how to implement that one.can some one please help me to implement the send public key to host application.. Thanks SSV

¿Fue útil?

Solución

If you already have the RSAPublicKey instance it is easy. There you have to methods for getting the modulus and the exponent. Both get-methods copy the requested value into a byte array you can return in an result APDU.

Note that for a common JavaCard without extended length APDUs a 2048 bit RSA key is to large to return it in one response APDU. Depending on the available bytes in the response APDU you may even have to split modulus and exponent into 2 or more parts for returning them to the host.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top