fixing GET STATUS length

This commit is contained in:
Michele Balistreri 2018-01-18 16:53:26 +03:00
parent 08e657a2c8
commit 450938f203
2 changed files with 4 additions and 4 deletions

View File

@ -324,7 +324,7 @@ public class WalletApplet extends Applet {
*/ */
private short getApplicationStatus(byte[] apduBuffer, short off) { private short getApplicationStatus(byte[] apduBuffer, short off) {
apduBuffer[off++] = TLV_APPLICATION_STATUS_TEMPLATE; apduBuffer[off++] = TLV_APPLICATION_STATUS_TEMPLATE;
apduBuffer[off++] = 9; apduBuffer[off++] = 12;
apduBuffer[off++] = TLV_PIN_RETRY_COUNT; apduBuffer[off++] = TLV_PIN_RETRY_COUNT;
apduBuffer[off++] = 1; apduBuffer[off++] = 1;
apduBuffer[off++] = pin.getTriesRemaining(); apduBuffer[off++] = pin.getTriesRemaining();

View File

@ -296,21 +296,21 @@ public class WalletAppletTest {
response = cmdSet.getStatus(WalletApplet.GET_STATUS_P1_APPLICATION); response = cmdSet.getStatus(WalletApplet.GET_STATUS_P1_APPLICATION);
assertEquals(0x9000, response.getSW()); assertEquals(0x9000, response.getSW());
byte[] data = response.getData(); byte[] data = response.getData();
assertTrue(Hex.toHexString(data).matches("a30980010381010582010[0-1]83010[0-1]")); assertTrue(Hex.toHexString(data).matches("a30c80010381010582010[0-1]83010[0-1]"));
response = cmdSet.verifyPIN("123456"); response = cmdSet.verifyPIN("123456");
assertEquals(0x63C2, response.getSW()); assertEquals(0x63C2, response.getSW());
response = cmdSet.getStatus(WalletApplet.GET_STATUS_P1_APPLICATION); response = cmdSet.getStatus(WalletApplet.GET_STATUS_P1_APPLICATION);
assertEquals(0x9000, response.getSW()); assertEquals(0x9000, response.getSW());
data = response.getData(); data = response.getData();
assertTrue(Hex.toHexString(data).matches("a30980010281010582010[0-1]83010[0-1]")); assertTrue(Hex.toHexString(data).matches("a30c80010281010582010[0-1]83010[0-1]"));
response = cmdSet.verifyPIN("000000"); response = cmdSet.verifyPIN("000000");
assertEquals(0x9000, response.getSW()); assertEquals(0x9000, response.getSW());
response = cmdSet.getStatus(WalletApplet.GET_STATUS_P1_APPLICATION); response = cmdSet.getStatus(WalletApplet.GET_STATUS_P1_APPLICATION);
assertEquals(0x9000, response.getSW()); assertEquals(0x9000, response.getSW());
data = response.getData(); data = response.getData();
assertTrue(Hex.toHexString(data).matches("a30980010381010582010[0-1]83010[0-1]")); assertTrue(Hex.toHexString(data).matches("a30c80010381010582010[0-1]83010[0-1]"));
// Check that key path is empty // Check that key path is empty
response = cmdSet.getStatus(WalletApplet.GET_STATUS_P1_KEY_PATH); response = cmdSet.getStatus(WalletApplet.GET_STATUS_P1_KEY_PATH);