Merge branch 'Arachnid-statusfix'

This commit is contained in:
Michele Balistreri 2018-01-19 10:54:46 +03:00
commit ccb1c04c80
2 changed files with 13 additions and 15 deletions

View File

@ -92,10 +92,10 @@ derivation session
Response Data format:
if P1 = 0x00:
- Tag 0xA3 = Application Status Template
- Tag 0x80 = PIN retry count (1 byte)
- Tag 0x81 = PUK retry count (1 byte)
- Tag 0x82 = 0 if key is not initialized, 1 otherwise
- Tag 0x83 = 1 if public key derivation is supported, 0 otherwise
- Tag 0x02 = PIN retry count (1 byte)
- Tag 0x02 = PUK retry count (1 byte)
- Tag 0x01 = 0 if key is not initialized, 1 otherwise
- Tag 0x01 = 1 if public key derivation is supported, 0 otherwise
if P1 = 0x01
- a sequence of 32-bit numbers indicating the current key path. Empty if master key is selected.

View File

@ -66,10 +66,8 @@ public class WalletApplet extends Applet {
static final byte TLV_PUB_X = (byte) 0x83;
static final byte TLV_APPLICATION_STATUS_TEMPLATE = (byte) 0xA3;
static final byte TLV_PIN_RETRY_COUNT = (byte) 0x80;
static final byte TLV_PUK_RETRY_COUNT = (byte) 0x81;
static final byte TLV_KEY_INITIALIZATION_STATUS = (byte) 0x82;
static final byte TLV_PUBLIC_KEY_DERIVATION = (byte) 0x83;
static final byte TLV_INT = (byte) 0x02;
static final byte TLV_BOOL = (byte) 0x01;
static final byte TLV_APPLICATION_INFO_TEMPLATE = (byte) 0xA4;
static final byte TLV_UID = (byte) 0x8F;
@ -325,18 +323,18 @@ public class WalletApplet extends Applet {
private short getApplicationStatus(byte[] apduBuffer, short off) {
apduBuffer[off++] = TLV_APPLICATION_STATUS_TEMPLATE;
apduBuffer[off++] = 12;
apduBuffer[off++] = TLV_PIN_RETRY_COUNT;
apduBuffer[off++] = TLV_INT;
apduBuffer[off++] = 1;
apduBuffer[off++] = pin.getTriesRemaining();
apduBuffer[off++] = TLV_PUK_RETRY_COUNT;
apduBuffer[off++] = TLV_INT;
apduBuffer[off++] = 1;
apduBuffer[off++] = puk.getTriesRemaining();
apduBuffer[off++] = TLV_KEY_INITIALIZATION_STATUS;
apduBuffer[off++] = TLV_BOOL;
apduBuffer[off++] = 1;
apduBuffer[off++] = privateKey.isInitialized() ? (byte) 0x01 : (byte) 0x00;
apduBuffer[off++] = TLV_PUBLIC_KEY_DERIVATION;
apduBuffer[off++] = privateKey.isInitialized() ? (byte) 0xFF : (byte) 0x00;
apduBuffer[off++] = TLV_BOOL;
apduBuffer[off++] = 1;
apduBuffer[off++] = SECP256k1.hasECPointMultiplication() ? (byte) 0x01 : (byte) 0x00;
apduBuffer[off++] = SECP256k1.hasECPointMultiplication() ? (byte) 0xFF : (byte) 0x00;
return (short) (off - SecureChannel.SC_OUT_OFFSET);
}