Skip to content

Commit

Permalink
Add SELECT template
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Jan 14, 2025
1 parent c58fd30 commit ee3534f
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 98 deletions.
5 changes: 5 additions & 0 deletions lib/libpcsc-cpp/include/pcsc-cpp/pcsc-cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ struct CommandApdu

constexpr operator const byte_vector&() const { return d; }

static PCSC_CPP_CONSTEXPR_VECTOR CommandApdu select(byte_type p1, byte_vector file)
{
return {0x00, 0xA4, p1, 0x0C, std::move(file)};
}

byte_vector d;
};

Expand Down
32 changes: 10 additions & 22 deletions src/electronic-ids/pcsc/EIDIDEMIA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ const byte_type AUTH_PIN_REFERENCE = 0x01;
byte_vector EIDIDEMIA::getCertificateImpl(const CertificateType type) const
{
transmitApduWithExpectedResponse(*card, selectApplicationID().MAIN_AID);
transmitApduWithExpectedResponse(*card,
type.isAuthentication() ? selectApplicationID().AUTH_AID
: selectApplicationID().SIGN_AID);
return electronic_id::getCertificate(*card,
type.isAuthentication() ? selectCertificate().AUTH_CERT
: selectCertificate().SIGN_CERT);
Expand Down Expand Up @@ -107,25 +104,16 @@ const SelectApplicationIDCmds& EIDIDEMIA::selectApplicationID() const
{
static const SelectApplicationIDCmds selectAppIDCmds {
// Main AID.
{0x00,
0xA4,
0x04,
0x00,
{0xA0, 0x00, 0x00, 0x00, 0x77, 0x01, 0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01,
0x00}},
CommandApdu::select(0x04,
{0xA0, 0x00, 0x00, 0x00, 0x77, 0x01, 0x08, 0x00, 0x07, 0x00, 0x00, 0xFE,
0x00, 0x00, 0x01, 0x00}),
// AWP AID.
{0x00,
0xA4,
0x04,
0x0C,
{0xe8, 0x28, 0xbd, 0x08, 0x0f, 0xf2, 0x50, 0x4f, 0x54, 0x20, 0x41, 0x57, 0x50}},
CommandApdu::select(
0x04, {0xe8, 0x28, 0xbd, 0x08, 0x0f, 0xf2, 0x50, 0x4f, 0x54, 0x20, 0x41, 0x57, 0x50}),
// QSCD AID.
{0x00,
0xA4,
0x04,
0x0C,
{0x51, 0x53, 0x43, 0x44, 0x20, 0x41, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F,
0x6E}},
CommandApdu::select(0x04,
{0x51, 0x53, 0x43, 0x44, 0x20, 0x41, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61,
0x74, 0x69, 0x6F, 0x6E}),
};
return selectAppIDCmds;
}
Expand All @@ -134,9 +122,9 @@ const SelectCertificateCmds& EIDIDEMIA::selectCertificate() const
{
static const SelectCertificateCmds selectCert1Cmds {
// Authentication certificate.
{0x00, 0xA4, 0x02, 0x0C, {0x34, 0x01}},
CommandApdu::select(0x09, {0xAD, 0xF1, 0x34, 0x01}),
// Signing certificate.
{0x00, 0xA4, 0x02, 0x0C, {0x34, 0x1F}},
CommandApdu::select(0x09, {0xAD, 0xF2, 0x34, 0x1F}),
};
return selectCert1Cmds;
}
Expand Down
19 changes: 5 additions & 14 deletions src/electronic-ids/pcsc/FinEID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,11 @@ using namespace pcsc_cpp;
namespace
{

const CommandApdu SELECT_MAIN_AID {
0x00,
0xA4,
0x04,
0x00,
{0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d, 0x31, 0x35}};

const CommandApdu SELECT_MASTER_FILE {0x00, 0xa4, 0x00, 0x0C, {0x3f, 0x00}};

const CommandApdu SELECT_AUTH_CERT_FILE {0x00, 0xA4, 0x08, 0x0C, {0x43, 0x31}};
const CommandApdu SELECT_SIGN_CERT_FILE_V3 {0x00, 0xA4, 0x08, 0x0C, {0x50, 0x16, 0x43, 0x35}};
const CommandApdu SELECT_SIGN_CERT_FILE_V4 {0x00, 0xA4, 0x08, 0x0C, {0x50, 0x16, 0x43, 0x32}};
const auto SELECT_MAIN_AID = CommandApdu::select(
0x04, {0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d, 0x31, 0x35});
const auto SELECT_AUTH_CERT_FILE = CommandApdu::select(0x08, {0x43, 0x31});
const auto SELECT_SIGN_CERT_FILE_V3 = CommandApdu::select(0x08, {0x50, 0x16, 0x43, 0x35});
const auto SELECT_SIGN_CERT_FILE_V4 = CommandApdu::select(0x08, {0x50, 0x16, 0x43, 0x32});

constexpr byte_type PIN_PADDING_CHAR = 0x00;
constexpr byte_type AUTH_PIN_REFERENCE = 0x11;
Expand Down Expand Up @@ -133,8 +126,6 @@ byte_vector FinEIDv3::sign(const HashAlgorithm hashAlgo, const byte_vector& hash
THROW(ArgumentFatalError, "No OID for algorithm " + std::string(hashAlgo));
}

transmitApduWithExpectedResponse(*card, SELECT_MASTER_FILE);

verifyPin(*card, pinReference, std::move(pin), pinMinMaxLength.first, pinMinMaxLength.second,
PIN_PADDING_CHAR);
// Select security environment for COMPUTE SIGNATURE.
Expand Down
4 changes: 2 additions & 2 deletions src/electronic-ids/pcsc/LatEIDIDEMIAv1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ const SelectCertificateCmds& LatEIDIDEMIAV1::selectCertificate() const
{
static const SelectCertificateCmds selectCertCmds {
// Authentication certificate.
{0x00, 0xA4, 0x01, 0x0C, {0xA0, 0x02}},
CommandApdu::select(0x09, {0xAD, 0xF1, 0xA0, 0x02}),
// Signing certificate.
{0x00, 0xA4, 0x01, 0x0C, {0xA0, 0x01}},
CommandApdu::select(0x09, {0xAD, 0xF1, 0xA0, 0x01}),
};
return selectCertCmds;
}
Expand Down
19 changes: 6 additions & 13 deletions tests/mock/select-certificate-script-EST-IDEMIA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@

const PcscMock::ApduScript ESTEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE = {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},
// Select AWP AID.
{{0x00, 0xA4, 0x04, 0x0C, 0x0D, 0xe8, 0x28, 0xbd, 0x08, 0x0f, 0xf2, 0x50, 0x4f, 0x54, 0x20,
0x41, 0x57, 0x50},
{0x90, 0x00}},
// Select authentication certificate file.
{{0x00, 0xA4, 0x02, 0x0C, 0x02, 0x34, 0x01}, {0x90, 0x00}},
{{0x00, 0xA4, 0x09, 0x0C, 0x04, 0xAD, 0xF1, 0x34, 0x01}, {0x90, 0x00}},

// Read data length.
{{0x00, 0xb0, 0x00, 0x00, 0x04}, {0x30, 0x82, 0x04, 0x03, 0x90, 0x00}},
Expand Down Expand Up @@ -130,7 +127,7 @@ const PcscMock::ApduScript ESTEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

// 2. PIN Retry count
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},

Expand All @@ -143,7 +140,7 @@ const PcscMock::ApduScript ESTEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

// 3. Authenticate.
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},

Expand Down Expand Up @@ -180,15 +177,11 @@ const PcscMock::ApduScript ESTEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

const PcscMock::ApduScript ESTEID_IDEMIA_V1_SELECT_SIGN_CERTIFICATE_AND_SIGNING = {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},
// Select QSCD AID.
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0x51, 0x53, 0x43, 0x44, 0x20, 0x41,
0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E},
{0x90, 0x00}},
// Select signing certificate file.
{{0x00, 0xA4, 0x02, 0x0C, 0x02, 0x34, 0x1F}, {0x90, 0x00}},
{{0x00, 0xA4, 0x09, 0x0C, 0x04, 0xAD, 0xF2, 0x34, 0x1F}, {0x90, 0x00}},

// Read data length.
{{0x00, 0xb0, 0x00, 0x00, 0x04}, {0x30, 0x82, 0x03, 0xec, 0x90, 0x00}},
Expand Down
10 changes: 2 additions & 8 deletions tests/mock/select-certificate-script-FIN-V3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

const PcscMock::ApduScript FINEID_V3_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE = {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x0C, 0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d,
{{0x00, 0xA4, 0x04, 0x0C, 0x0C, 0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d,
0x31, 0x35},
{0x90, 0x00}},
// Select authentication certificate file.
Expand Down Expand Up @@ -186,9 +186,6 @@ const PcscMock::ApduScript FINEID_V3_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE =
0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},

// 3. Authenticate.
// Select master file
{{0x00, 0xa4, 0x00, 0x0C, 0x02, 0x3f, 0x00}, {0x90, 0x00}},

// Verify PIN.
{{0x00, 0x20, 0x00, 0x11, 0x0c, 0x31, 0x32, 0x33, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00},
Expand Down Expand Up @@ -226,7 +223,7 @@ const PcscMock::ApduScript FINEID_V3_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE =

const PcscMock::ApduScript FINEID_V3_SELECT_SIGN_CERTIFICATE_AND_SIGNING = {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x0C, 0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d,
{{0x00, 0xA4, 0x04, 0x0C, 0x0C, 0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d,
0x31, 0x35},
{0x90, 0x00}},
// Select signing certificate file.
Expand Down Expand Up @@ -371,9 +368,6 @@ const PcscMock::ApduScript FINEID_V3_SELECT_SIGN_CERTIFICATE_AND_SIGNING = {
0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},

// 3. Signing.
// Select master file
{{0x00, 0xa4, 0x00, 0x0C, 0x02, 0x3f, 0x00}, {0x90, 0x00}},

// Verify PIN.
{{0x00, 0x20, 0x00, 0x82, 0x0c, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00},
Expand Down
10 changes: 2 additions & 8 deletions tests/mock/select-certificate-script-FIN-V4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

const PcscMock::ApduScript FINEID_V4_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x0C, 0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d,
{{0x00, 0xA4, 0x04, 0x0C, 0x0C, 0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d,
0x31, 0x35},
{0x90, 0x00}},
// Select authentication certificate file.
Expand Down Expand Up @@ -138,9 +138,6 @@ const PcscMock::ApduScript FINEID_V4_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE {
0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},

// 3. Authenticate.
// Select master file
{{0x00, 0xa4, 0x00, 0x0C, 0x02, 0x3f, 0x00}, {0x90, 0x00}},

// Verify PIN.
{{0x00, 0x20, 0x00, 0x11, 0x0c, 0x31, 0x32, 0x33, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00},
Expand Down Expand Up @@ -168,7 +165,7 @@ const PcscMock::ApduScript FINEID_V4_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE {

const PcscMock::ApduScript FINEID_V4_SELECT_SIGN_CERTIFICATE_AND_SIGNING {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x0C, 0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d,
{{0x00, 0xA4, 0x04, 0x0C, 0x0C, 0xa0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4b, 0x43, 0x53, 0x2d,
0x31, 0x35},
{0x90, 0x00}},
// Select signing certificate file.
Expand Down Expand Up @@ -284,9 +281,6 @@ const PcscMock::ApduScript FINEID_V4_SELECT_SIGN_CERTIFICATE_AND_SIGNING {
0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},

// 3. Signing.
// Select master file
{{0x00, 0xa4, 0x00, 0x0C, 0x02, 0x3f, 0x00}, {0x90, 0x00}},

// Verify PIN.
{{0x00, 0x20, 0x00, 0x82, 0x0c, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00},
Expand Down
20 changes: 6 additions & 14 deletions tests/mock/select-certificate-script-LAT-V1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,11 @@

const PcscMock::ApduScript LATEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE = {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},
// Select AWP AID.
{{0x00, 0xA4, 0x04, 0x0C, 0x0D, 0xe8, 0x28, 0xbd, 0x08, 0x0f, 0xf2, 0x50, 0x4f, 0x54, 0x20,
0x41, 0x57, 0x50},
{0x90, 0x00}},
// Select authentication certificate file.
{{0x00, 0xA4, 0x01, 0x0C, 0x02, 0xA0, 0x02}, {0x90, 0x00}},
{{0x00, 0xA4, 0x09, 0x0C, 0x04, 0xAD, 0xF1, 0xA0, 0x02}, {0x90, 0x00}},

// Read data length.
{{0x00, 0xb0, 0x00, 0x00, 0x04}, {0x30, 0x82, 0x07, 0x4d, 0x90, 0x00}},
Expand Down Expand Up @@ -201,7 +197,7 @@ const PcscMock::ApduScript LATEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

// 2. PIN Retry count
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},

Expand All @@ -214,7 +210,7 @@ const PcscMock::ApduScript LATEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

// 3. Authenticate.
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},
// Select AWP AID.
Expand Down Expand Up @@ -259,15 +255,11 @@ const PcscMock::ApduScript LATEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

const PcscMock::ApduScript LATEID_IDEMIA_V1_SELECT_SIGN_CERTIFICATE_AND_SIGNING = {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},
// Select AWP AID.
{{0x00, 0xA4, 0x04, 0x0C, 0x0D, 0xe8, 0x28, 0xbd, 0x08, 0x0f, 0xf2, 0x50, 0x4f, 0x54, 0x20,
0x41, 0x57, 0x50},
{0x90, 0x00}},
// Select signing certificate file.
{{0x00, 0xA4, 0x01, 0x0C, 0x02, 0xA0, 0x01}, {0x90, 0x00}},
{{0x00, 0xA4, 0x09, 0x0C, 0x04, 0xAD, 0xF1, 0xA0, 0x01}, {0x90, 0x00}},

// Read data length.
{{0x00, 0xb0, 0x00, 0x00, 0x04}, {0x30, 0x82, 0x08, 0xf0, 0x90, 0x00}},
Expand Down
25 changes: 8 additions & 17 deletions tests/mock/select-certificate-script-LAT-V2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@

const PcscMock::ApduScript LATEID_IDEMIA_V2_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},
// Select AWP AID.
{{0x00, 0xA4, 0x04, 0x0C, 0x0D, 0xe8, 0x28, 0xbd, 0x08, 0x0f, 0xf2, 0x50, 0x4f, 0x54, 0x20,
0x41, 0x57, 0x50},
{0x90, 0x00}},

// Select authentication certificate file.
{{0x00, 0xA4, 0x02, 0x0C, 0x02, 0x34, 0x01}, {0x90, 0x00}},
{{0x00, 0xA4, 0x09, 0x0C, 0x04, 0xAD, 0xF1, 0x34, 0x01}, {0x90, 0x00}},

// Read data length.
{{0x00, 0xb0, 0x00, 0x00, 0x04}, {0x30, 0x82, 0x06, 0xc1, 0x90, 0x00}},
Expand Down Expand Up @@ -190,7 +185,7 @@ const PcscMock::ApduScript LATEID_IDEMIA_V2_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

// 2. PIN Retry count
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},

Expand All @@ -203,7 +198,7 @@ const PcscMock::ApduScript LATEID_IDEMIA_V2_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

// 3. Authenticate.
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},

Expand All @@ -222,7 +217,7 @@ const PcscMock::ApduScript LATEID_IDEMIA_V2_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI
{{0x00, 0xB0, 0x00, 0x00, 0x05}, {0x30, 0x02, 0x02, 0x00, 0x81, 0x90, 0x00}},

// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},

Expand Down Expand Up @@ -265,15 +260,11 @@ const PcscMock::ApduScript LATEID_IDEMIA_V2_SELECT_AUTH_CERTIFICATE_AND_AUTHENTI

const PcscMock::ApduScript LATEID_IDEMIA_V2_SELECT_SIGN_CERTIFICATE_AND_SIGNING {
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},
// Select QSCD AID.
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0x51, 0x53, 0x43, 0x44, 0x20, 0x41,
0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E},
{0x90, 0x00}},
// Select signing certificate file.
{{0x00, 0xA4, 0x02, 0x0C, 0x02, 0x34, 0x1F}, {0x90, 0x00}},
{{0x00, 0xA4, 0x09, 0x0C, 0x04, 0xAD, 0xF2, 0x34, 0x1F}, {0x90, 0x00}},

// Read data length.
{{0x00, 0xb0, 0x00, 0x00, 0x04}, {0x30, 0x82, 0x08, 0x48, 0x90, 0x00}},
Expand Down Expand Up @@ -472,7 +463,7 @@ const PcscMock::ApduScript LATEID_IDEMIA_V2_SELECT_SIGN_CERTIFICATE_AND_SIGNING

// 3. Signing.
// Select main AID.
{{0x00, 0xA4, 0x04, 0x00, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
{{0x00, 0xA4, 0x04, 0x0C, 0x10, 0xA0, 0x00, 0x00, 0x00, 0x77, 0x01,
0x08, 0x00, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0x00},
{0x90, 0x00}},

Expand Down

0 comments on commit ee3534f

Please sign in to comment.