Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/libpcsc-cpp/include/pcsc-cpp/pcsc-cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ struct CommandApdu
byte_vector data, byte_type le) :
CommandApdu {cls, ins, p1, p2, std::move(data)}
{
#if defined(__GNUC__) && __GNUC__ == 15 // Apply workaround for GCC 15
d.reserve(d.size() + 1);
#endif
d.push_back(le);
}

Expand Down
19 changes: 10 additions & 9 deletions src/electronic-ids/pcsc/FinEID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,21 @@ byte_vector FinEIDv3::sign(const HashAlgorithm hashAlgo, const byte_vector& hash
}

switch (hashAlgo) {
case HashAlgorithm::SHA224:
case HashAlgorithm::SHA3_224:
using enum HashAlgorithm::HashAlgorithmEnum;
case SHA224:
case SHA3_224:
signatureAlgo |= 0x30;
break;
case HashAlgorithm::SHA256:
case HashAlgorithm::SHA3_256:
case SHA256:
case SHA3_256:
signatureAlgo |= 0x40;
break;
case HashAlgorithm::SHA384:
case HashAlgorithm::SHA3_384:
case SHA384:
case SHA3_384:
signatureAlgo |= 0x50;
break;
case HashAlgorithm::SHA512:
case HashAlgorithm::SHA3_512:
case SHA512:
case SHA3_512:
signatureAlgo |= 0x60;
break;
default:
Expand Down Expand Up @@ -161,7 +162,7 @@ byte_vector FinEIDv3::sign(const HashAlgorithm hashAlgo, const byte_vector& hash
ElectronicID::PinRetriesRemainingAndMax FinEIDv3::pinRetriesLeft(byte_type pinReference) const
{
const pcsc_cpp::CommandApdu GET_DATA {
0x00, 0xCB, 0x00, 0xFF, {0xA0, 0x03, 0x83, 0x01, pinReference}};
0x00, 0xCB, 0x00, 0xFF, {0xA0, 0x03, 0x83, 0x01, pinReference}, 0x00};
const auto response = card->transmit(GET_DATA);
if (!response.isOK()) {
THROW(SmartCardError, "Command GET DATA failed with error " + response);
Expand Down
4 changes: 2 additions & 2 deletions tests/mock/select-certificate-script-FIN-V3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const PcscMock::ApduScript FINEID_V3_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE =

// 2. PIN Retry count
// Get retry count
{{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x11},
{{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x11, 0x00},
{0xa0, 0x23, 0x83, 0x01, 0x11, 0x8c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x9c, 0x04,
0xf0, 0x00, 0x00, 0x00, 0xdf, 0x21, 0x04, 0x05, 0xff, 0xa5, 0x03, 0xdf, 0x27,
0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},
Expand Down Expand Up @@ -362,7 +362,7 @@ const PcscMock::ApduScript FINEID_V3_SELECT_SIGN_CERTIFICATE_AND_SIGNING = {

// 2. PIN Retry count
// Get retry count
{{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x82},
{{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x82, 0x00},
{0xa0, 0x23, 0x83, 0x01, 0x82, 0x8c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x9c, 0x04,
0xf0, 0x00, 0x00, 0x00, 0xdf, 0x21, 0x04, 0x05, 0xff, 0xa5, 0x03, 0xdf, 0x27,
0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},
Expand Down
4 changes: 2 additions & 2 deletions tests/mock/select-certificate-script-FIN-V4.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const PcscMock::ApduScript FINEID_V4_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE {

// 2. PIN Retry count
// Get retry count
{{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x11},
{{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x11, 0x00},
{0xa0, 0x23, 0x83, 0x01, 0x11, 0x8c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x9c, 0x04,
0xf0, 0x00, 0x00, 0x00, 0xdf, 0x21, 0x04, 0x05, 0xff, 0xa5, 0x03, 0xdf, 0x27,
0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},
Expand Down Expand Up @@ -275,7 +275,7 @@ const PcscMock::ApduScript FINEID_V4_SELECT_SIGN_CERTIFICATE_AND_SIGNING {

// 2. PIN Retry count
// Get retry count
{{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x82},
{{0x00, 0xcb, 0x00, 0xff, 0x05, 0xa0, 0x03, 0x83, 0x01, 0x82, 0x00},
{0xa0, 0x23, 0x83, 0x01, 0x82, 0x8c, 0x04, 0xf0, 0x00, 0x00, 0x00, 0x9c, 0x04,
0xf0, 0x00, 0x00, 0x00, 0xdf, 0x21, 0x04, 0x05, 0xff, 0xa5, 0x03, 0xdf, 0x27,
0x02, 0xff, 0xff, 0xdf, 0x28, 0x01, 0x0c, 0xdf, 0x2f, 0x01, 0x01, 0x90, 0x00}},
Expand Down
Loading