Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

How to store private Key into applet

Algorithm School

Moderator: UNKNwYSHSA

GraceGIRL
Posts: 15
Joined: Fri May 15, 2015 3:25 am
Points :30
Contact:

How to store private Key into applet

Post by GraceGIRL » Wed Feb 24, 2016 5:36 am

Hi all! It's me again. Recently, I am working on a project where RSA key pair will be generated at server and Private key needs to be stored in applet which can be used for further crypto operation.

But I don't know how to store required private key data to the applet. Would anybody give me some pointers about sending the Private Key into applet?

popmun09
Posts: 36
Joined: Tue Feb 16, 2016 9:49 pm
Points :230
Contact:

Re: How to store private Key into applet

Post by popmun09 » Fri Feb 26, 2016 5:34 am

RSA is designed in such a way that private key will never leave the place where it is created.

You can do as follows:
1. Prepare an APDU carrying the private key (two components, you can configure this with P1 and P2 parameters).
2. On the arrival of these APDU, try to create an RSAPrivateKey object and set the two components of it. The code would be like this:

Code: Select all

short offset = 0 ;  
short keySizeInBytes = 64; 
short keySizeInBits = 512; 
RSAPrivateKey privKey = (RSAPrivateKey) KeyBuilder.buildKey (KeyBuilder.TYPE_RSA_PRIVATE, keySizeInBits, false); 
privKey.setExponent(privExponent, offset, keySizeInBytes) ; 
privKey.setModulus (privModulus, offset, keySizeInBytes) ;

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 13 guests

JavaCard OS : Disclaimer