Code: Select all
package bArraytest;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISOException;
import javacard.framework.Util;
public class bArrayreturn extends Applet {
// define two static variables
public static byte[] theArray;
public static short arrayLength;
private bArrayreturn() {
}
public static void install(byte bArray[], short bOffset, byte bLength)
throws ISOException {
new bArrayreturn().register();
bArrayreturn.arrayLength=(short)bArray.length;
Util.arrayCopyNonAtomic(bArray, (short)0,bArrayreturn.theArray , (short) 0, bArrayreturn.arrayLength);
}
public void process(APDU apdu) throws ISOException {
byte[] buffer=apdu.getBuffer();
Util.arrayCopyNonAtomic(bArrayreturn.theArray, (short)0,buffer , (short) 0, bArrayreturn.arrayLength);
apdu.setOutgoingAndSend((short)0, (short)255);
}
I defined two static variables named theArray and arrayLength in my applet. I tried to return variables to card reader in the process method. But in the response of SELECT command, the card returns 6F00.
Am I doing something wrong in my applet? How can I modify my code to make my applet work well? tnx