How can I use the security package in JCOP41V2.2?
Hi all, I'm a newbie in javacard programming. I'm trying to develop a project with RSA_signature. But I found, the exception NO_SUCH_ALGORITHM will be thrown out when I new an instance of KeyPair.
My java file Temp_1.java following:
/**
*
*/
package temp;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.APDU;
import javacard.security.*;
/**
* @author lujj
*
*/
public class Temp_1 extends Applet {
KeyPair myKeyPair = null;
public static void install(byte[] bArray, short bOffset, byte bLength) {
// GP-compliant JavaCard applet registration
new Temp_1().register(bArray, (short) (bOffset + 1), bArray[bOffset]);
}
public void process(APDU apdu) throws ISOException{
// Good practice: Return 9000 on SELECT
if (selectingApplet()) {
return;
}
byte[] buf = apdu.getBuffer();
if(buf[ISO7816.OFFSET_CLA] == (byte)0xEE)
{
try
{
myKeyPair = new KeyPair(KeyPair.ALG_RSA, KeyBuilder.LENGTH_RSA_1024);
}
catch(CryptoException e)
{
ISOException.throwIt((short)(0x6F00+e.getReason()));
}
return;
}
switch (buf[ISO7816.OFFSET_INS]) {
case (byte) 0x00:
break;
default:
// good practice: If you don't know the INStruction, say so:
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
}
}
************************
This package can be upload and the applet can be installed successfully.
But if I send the apdu "EE 00 00 00 00" after selected the applet, "6F 03" will be returned.
*************************
Is there anyone can help me? Thanks a lot.

