Add an instruction for querying stored data
This commit is contained in:
parent
a673b7ecd0
commit
39948e42f2
1 changed files with 12 additions and 3 deletions
|
@ -60,14 +60,23 @@ public class MyApplet extends Applet {
|
||||||
|
|
||||||
switch (instruction) {
|
switch (instruction) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
case 0x04:
|
||||||
|
byte[] response;
|
||||||
length = apdu.setOutgoing();
|
length = apdu.setOutgoing();
|
||||||
|
|
||||||
if (length > AuthorName.length) {
|
if (instruction == 0x00) {
|
||||||
length = (short)AuthorName.length;
|
response = AuthorName;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
response = storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length > response.length) {
|
||||||
|
length = (short)response.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
apdu.setOutgoingLength(length);
|
apdu.setOutgoingLength(length);
|
||||||
apdu.sendBytesLong(AuthorName, (short)0, length);
|
apdu.sendBytesLong(response, (short)0, length);
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
length = apdu.setIncomingAndReceive();
|
length = apdu.setIncomingAndReceive();
|
||||||
|
|
Loading…
Reference in a new issue