My code doesn't work with RSA key
Posted: 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:
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);
}