I am working on JavaCard and I developed an applet with JCDE on Eclipse:
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.Util;
import javacardx.framework.math.BigNumber;
import javacard.security.CryptoException;
import javacard.security.MessageDigest;
public class SignatureGPS extends Applet {
public static final byte CLA = (byte) 0xB0;
public static final byte INS = (byte) 0x00;
private BigNumber s;
private BigNumber x;
private MessageDigest h;
private SignatureGPS() {
s = new BigNumber((short) 100);
x = new BigNumber((short) 100);
try {
h = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false);
} catch (CryptoException e) {
if (e.getReason() == CryptoException.NO_SUCH_ALGORITHM){
}
}
}
public static void install(byte bArray[], short bOffset, byte bLength) throws ISOException {
new SignatureGPS().register();
}
public void process(APDU apdu) throws ISOException {
byte[] buffer = apdu.getBuffer();
if (this.selectingApplet()) return;
if (buffer[ISO7816.OFFSET_CLA] != CLA)
ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
...
}
}
But When I launch JCWDE and APDUTOOL, I have the following errors :
Java Card 2.2.2 APDU Tool, Version 1.3
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
Opening connection to localhost on port 9025.
Connected.
powerup;
// Select the installer applet
0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;
// create SignatureGPS applet
0x80 0xB8 0x00 0x00 0xd 0xb 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x01 0x00 0x7F;Received ATR = 0x3b 0xf0 0x11 0x00 0xff 0x00
CLA: 00, INS: a4, P1: 04, P2: 00, Lc: 09, a0, 00, 00, 00, 62, 03, 01, 08, 01, Le: 00, SW1: 90, SW2: 00
// select SignatureGPS applet
0x00 0xA4 0x04 0x00 0xb 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x00 0x01 0x7F;CLA: 80, INS: b8, P1: 00, P2: 00, Lc: 0d, 0b, 01, 02, 03, 04, 05, 06, 07, 08, 09, 00, 01, 00, Le: 00, SW1: 64, SW2: 44
And in Eclipse, JCWDE says
Exception from the invoked install() method:public static void metispackage.SignatureGPS.install(byte[],short,byte) throws javacard.framework.ISOException
Does anybody know what is going wrong with my install method ? I searched on google but I found nothing to solve my problem :( SW1 = 64 SW2 = 44 indicates that the applet creation failed but I have no idea why...