diff --git a/hwb1/scripts/MyApplet.script b/hwb1/scripts/MyApplet.script new file mode 100644 index 0000000..b94f472 --- /dev/null +++ b/hwb1/scripts/MyApplet.script @@ -0,0 +1,2 @@ +// Query Author Name +0x80 0x00 0x00 0x00 0x00 0x7F; diff --git a/hwb1/src/hwb1/MyApplet.java b/hwb1/src/hwb1/MyApplet.java index 4231487..efd3489 100644 --- a/hwb1/src/hwb1/MyApplet.java +++ b/hwb1/src/hwb1/MyApplet.java @@ -53,6 +53,22 @@ public class MyApplet extends Applet { */ @Override public void process(APDU apdu) { - //Insert your code here + short responseLength; + byte[] buffer = apdu.getBuffer(); + + byte instruction = buffer[ISO7816.OFFSET_INS]; + + switch (instruction) { + case 0x00: + responseLength = apdu.setOutgoing(); + + if (responseLength > MyAppletStrings.AuthorName.length) { + responseLength = (short)MyAppletStrings.AuthorName.length; + } + + apdu.setOutgoingLength(responseLength); + apdu.sendBytesLong(MyAppletStrings.AuthorName, (short)0, responseLength); + break; + } } }