Replace context-specific tags on GET_STATUS with type tags, and fix length

This commit is contained in:
Nick Johnson 2018-01-17 13:27:33 +00:00
parent 08e657a2c8
commit 6855e46975
1 changed files with 7 additions and 9 deletions

View File

@ -66,10 +66,8 @@ public class WalletApplet extends Applet {
static final byte TLV_PUB_X = (byte) 0x83; static final byte TLV_PUB_X = (byte) 0x83;
static final byte TLV_APPLICATION_STATUS_TEMPLATE = (byte) 0xA3; static final byte TLV_APPLICATION_STATUS_TEMPLATE = (byte) 0xA3;
static final byte TLV_PIN_RETRY_COUNT = (byte) 0x80; static final byte TLV_INT = (byte) 0x02;
static final byte TLV_PUK_RETRY_COUNT = (byte) 0x81; static final byte TLV_BOOL = (byte) 0x01;
static final byte TLV_KEY_INITIALIZATION_STATUS = (byte) 0x82;
static final byte TLV_PUBLIC_KEY_DERIVATION = (byte) 0x83;
static final byte TLV_APPLICATION_INFO_TEMPLATE = (byte) 0xA4; static final byte TLV_APPLICATION_INFO_TEMPLATE = (byte) 0xA4;
static final byte TLV_UID = (byte) 0x8F; static final byte TLV_UID = (byte) 0x8F;
@ -324,17 +322,17 @@ 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_INT;
apduBuffer[off++] = 1; apduBuffer[off++] = 1;
apduBuffer[off++] = pin.getTriesRemaining(); apduBuffer[off++] = pin.getTriesRemaining();
apduBuffer[off++] = TLV_PUK_RETRY_COUNT; apduBuffer[off++] = TLV_INT;
apduBuffer[off++] = 1; apduBuffer[off++] = 1;
apduBuffer[off++] = puk.getTriesRemaining(); apduBuffer[off++] = puk.getTriesRemaining();
apduBuffer[off++] = TLV_KEY_INITIALIZATION_STATUS; apduBuffer[off++] = TLV_BOOL;
apduBuffer[off++] = 1; apduBuffer[off++] = 1;
apduBuffer[off++] = privateKey.isInitialized() ? (byte) 0x01 : (byte) 0x00; apduBuffer[off++] = privateKey.isInitialized() ? (byte) 0x01 : (byte) 0x00;
apduBuffer[off++] = TLV_PUBLIC_KEY_DERIVATION; apduBuffer[off++] = TLV_BOOL;
apduBuffer[off++] = 1; apduBuffer[off++] = 1;
apduBuffer[off++] = SECP256k1.hasECPointMultiplication() ? (byte) 0x01 : (byte) 0x00; apduBuffer[off++] = SECP256k1.hasECPointMultiplication() ? (byte) 0x01 : (byte) 0x00;