JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html
https://ftsafe.en.alibaba.com/index.html
How to store private Key into applet
Moderator: UNKNwYSHSA
How to store private Key into applet
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?
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?
Re: How to store private Key into applet
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:
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) ;
Who is online
Users browsing this forum: No registered users and 4 guests