convert private tags in context-specific or application-specific tags

This commit is contained in:
Michele Balistreri 2018-01-05 16:11:00 +03:00
parent 9f20584df3
commit d1b90a872a
3 changed files with 13 additions and 13 deletions

View File

@ -52,7 +52,7 @@ SW 0x6985 is returned. All tagged data structures are encoded in the [BER-TLV fo
Response Data format:
- Tag 0xA4 = Application Info Template
- Tag 0xC0 = Instance UID (16 bytes)
- Tag 0x4F = Instance UID (16 bytes)
- Tag 0x80 = ECC public Key
The SELECT command is documented in the ISO 7816-4 specifications and is used to select the application on the card,
@ -92,10 +92,10 @@ derivation session
Response Data format:
if P1 = 0x00:
- Tag 0xA3 = Application Status Template
- Tag 0xC0 = PIN retry count (1 byte)
- Tag 0xC1 = PUK retry count (1 byte)
- Tag 0xC2 = 0 if key is not initialized, 1 otherwise
- Tag 0xC3 = 1 if public key derivation is supported, 0 otherwise
- 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
if P1 = 0x01
- a sequence of 32-bit numbers indicating the current key path. Empty if master key is selected.

View File

@ -66,13 +66,13 @@ 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) 0xC0;
static final byte TLV_PUK_RETRY_COUNT = (byte) 0xC1;
static final byte TLV_KEY_INITIALIZATION_STATUS = (byte) 0xC2;
static final byte TLV_PUBLIC_KEY_DERIVATION = (byte) 0xC3;
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_APPLICATION_INFO_TEMPLATE = (byte) 0xA4;
static final byte TLV_UID = (byte) 0xC0;
static final byte TLV_UID = (byte) 0x4F;
private static final byte[] ASSISTED_DERIVATION_HASH = {(byte) 0xAA, (byte) 0x2D, (byte) 0xA9, (byte) 0x9D, (byte) 0x91, (byte) 0x8C, (byte) 0x7D, (byte) 0x95, (byte) 0xB8, (byte) 0x96, (byte) 0x89, (byte) 0x87, (byte) 0x3E, (byte) 0xAA, (byte) 0x37, (byte) 0x67, (byte) 0x25, (byte) 0x0C, (byte) 0xFF, (byte) 0x50, (byte) 0x13, (byte) 0x9A, (byte) 0x2F, (byte) 0x87, (byte) 0xBB, (byte) 0x4F, (byte) 0xCA, (byte) 0xB4, (byte) 0xAE, (byte) 0xC3, (byte) 0xE8, (byte) 0x90};
private static final byte[] WHISPER_KEY_PATH = {0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01};

View File

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