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.

My code doesn't work with RSA key

Algorithm School

Moderator: UNKNwYSHSA

User avatar
conliaOdk
Posts: 20
Joined: Fri Aug 14, 2015 4:56 am
Points :9
Contact:

My code doesn't work with RSA key

Post by conliaOdk » Tue Mar 22, 2016 3:46 am

I am working on a java card project. But now I have difficulty to continue.
I can't do RSA key with a length different than 512 bit. As my codes show, I try to throw a CryptoException. but it doesn't show any error message. Could anybody tell me where I made the mistake in my code? Thanks very much

Here is my code:

Code: Select all

try{
keym = new KeyManager((short)1024);
}catch(Exception e){}

public RSAKey(short size) throws Exception{

     bufferA = new byte[size];
     bufferB = new byte[size];

paireDeClef = new KeyPair(KeyPair.ALG_RSA,KeyBuilder.LENGTH_RSA_1024);

paireDeClef.genKeyPair();
publicKey = (RSAPublicKey)paireDeClef.getPublic();
privateKey = (RSAPrivateKey)paireDeClef.getPrivate();

cip = Cipher.getInstance(Cipher.ALG_RSA_PKCS1,false);
}

Bodewes
Posts: 4
Joined: Wed Jun 10, 2015 4:44 am
Points :12
Contact:

Re: My code doesn't work with RSA key

Post by Bodewes » Tue Mar 22, 2016 4:54 am

Try to use KeyPair.ALG_RSA_CRT instead of KeyPair.ALG_RSA.

The private key may be an RSA CRT Private key.

User avatar
btwtiger
Posts: 28
Joined: Wed Jun 10, 2015 7:22 am
Points :134
Contact:

Re: My code doesn't work with RSA key

Post by btwtiger » Tue Mar 22, 2016 4:59 am

Hey bro.

It seems that you are only catching the exception and not printing the exception out.
Onward...

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 18 guests

JavaCard OS : Disclaimer