Add an instruction for querying the author name

This commit is contained in:
Manuel Thalmann 2023-10-12 19:23:38 +02:00
parent 5b467ff47f
commit 8f7e657a9c
2 changed files with 19 additions and 1 deletions

View file

@ -0,0 +1,2 @@
// Query Author Name
0x80 0x00 0x00 0x00 0x00 0x7F;

View file

@ -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;
}
}
}