Add an instruction for querying the author name
This commit is contained in:
parent
5b467ff47f
commit
8f7e657a9c
2 changed files with 19 additions and 1 deletions
2
hwb1/scripts/MyApplet.script
Normal file
2
hwb1/scripts/MyApplet.script
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Query Author Name
|
||||
0x80 0x00 0x00 0x00 0x00 0x7F;
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue