Skip to content

Commit

Permalink
Have a more useful "empty" applet
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpaljak committed Sep 28, 2024
1 parent 6446dc5 commit 2943f21
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/testapplets/empty/Empty.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@

import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.security.CryptoException;

public class Empty extends Applet {

private Empty(byte[] parameters, short offset, byte length) {
register(parameters, (short) (offset + 1), parameters[offset]);
}
private Empty(byte[] parameters, short offset, byte length) {
register(parameters, (short) (offset + 1), parameters[offset]);
}

public static void install(byte[] parameters, short offset, byte length) {
new Empty(parameters, offset, length);
}
public static void install(byte[] parameters, short offset, byte length) {
new Empty(parameters, offset, length);
}

public void process(APDU arg0) throws ISOException {
CryptoException.throwIt((short) 0x6666);
}
public void process(APDU apdu) throws ISOException {
if (selectingApplet())
return;
byte[] buffer = apdu.getBuffer();
if (buffer[ISO7816.OFFSET_LC] != (short) 6)
CryptoException.throwIt((short) 0x6666);
apdu.setIncomingAndReceive();
apdu.setOutgoingAndSend((short) 0, (short) 11);
}
}

0 comments on commit 2943f21

Please sign in to comment.