Hi everyone,
First, please excuse me for my bad english, i'm french.
So, i'm trying to upload an applet to my eGate CyberFlex 32K JavaCard, but some code lines causes 6A80 error.
Here is my applet source (it's just a first test ;-) ) :
package applet;
import javacard.framework.*;
public class TheApplet extends Applet {
private final static byte CARD_CLA = (byte)0x80;
private final static byte INS_TEST = (byte)0x02;
private final static byte PIN_TRY_LIMIT = (byte)0x03;
private final static byte MAX_PIN_SIZE = (byte)0x04;
final static short SW_PIN_VERIFICATION_REQUIRED = 0x6301;
protected byte[] name = {'T', 'e', 's', 't'};
private OwnerPIN pin;
protected TheApplet() throws PINException {
this.register();
pin = new OwnerPIN(PIN_TRY_LIMIT, MAX_PIN_SIZE);
byte[] pins = {(byte)0, (byte)0, (byte)0, (byte)0};
pin.update(pins, (short)0, MAX_PIN_SIZE);
byte i = pin.getTriesRemaining();
//pin.check(pins, (short)0, MAX_PIN_SIZE); // CAUSES 6A80 error when loading
}
public static void install (byte[] bArray, short bOffset, byte bLength)
throws ISOException {
new TheApplet();
}
public boolean select() {
/*if (pin.getTriesRemaining() == 0) { // CAUSES 6A80 error too..
return false;
}*/
return true;
}
public void process(APDU apdu) throws ISOException, PINException {
byte[] buffer = apdu.getBuffer();
if (selectingApplet() == true) {
return;
}
if (buffer[ISO7816.OFFSET_CLA] != CARD_CLA) {
ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
}
if (buffer[ISO7816.OFFSET_INS] != INS_TEST) {
ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
}
//pin.isValidated(); // Causes error.
apdu.setOutgoing();
apdu.setOutgoingLength((short)name.length);
apdu.sendBytesLong(name, (short)0, (short)name.length);
}
}
In fact, all access to pin causes error when loading, when commented lines are uncommented, the applet loads successfully.
Do you know what the problem is ?
I'm using JavaCard 2.1.2, and GPshell 1.4.2.
This is the gpshell script :
echo mode_201 > $OUT/config.txt
echo establish_context >> $OUT/config.txt
echo card_connect >> $OUT/config.txt
echo select -AID $CARDSECURITYDOMAIN2 >> $OUT/config.txt
echo open_sc -security 1 -keyind 0 -keyver 0 -mac_key $CARDKEY -enc_key $CARDKEY >> $OUT/config.txt
echo install_for_load -pkgAID $PACKAGEAID -nvCodeLimit 500 >> $OUT/config.txt
echo load -file $OUT/$PROJECT/$PKGAPPLET/javacard/$PKGAPPLET.cap.transf >> $OUT/config.txt
echo install_for_install -instParam 00 -priv 02 -AID $APPLETAID -pkgAID $PACKAGEAID -instAID $APPLETAID -nvDataLimit 500 >> $OUT/config.txt
echo card_disconnect >> $OUT/config.txt
echo release_context >> $OUT/config.txt
with :
CARDKEY=404142434445464748494A4B4C4D4E4F
APPLETAID=A00000006203010C0601
PACKAGEAID=A00000006203010C06
The error i got is :
load_applet() returns 0x80206A80 (6A80: Wrong data / Incorrect values in command data.)
Thank you for your help.
Edited by: Anakim14 on Apr 20, 2009 3:12 AM