@@ -34,7 +34,7 @@ namespace electronic_id
3434inline pcsc_cpp::byte_vector getCertificate (pcsc_cpp::SmartCard& card,
3535 const pcsc_cpp::CommandApdu& selectCertFileCmd)
3636{
37- static const size_t MAX_LE_VALUE = 0xb5 ;
37+ static const pcsc_cpp::byte_type MAX_LE_VALUE = 0xb5 ;
3838
3939 transmitApduWithExpectedResponse (card, selectCertFileCmd);
4040
@@ -54,17 +54,16 @@ inline void verifyPin(pcsc_cpp::SmartCard& card, pcsc_cpp::byte_type p2,
5454 pcsc_cpp::byte_vector&& pin, uint8_t pinMinLength, size_t paddingLength,
5555 pcsc_cpp::byte_type paddingChar)
5656{
57- const pcsc_cpp::CommandApdu VERIFY_PIN {0x00 , 0x20 , 0x00 , p2};
5857 pcsc_cpp::ResponseApdu response;
5958
6059 if (card.readerHasPinPad ()) {
61- const pcsc_cpp::CommandApdu verifyPin {VERIFY_PIN ,
60+ const pcsc_cpp::CommandApdu verifyPin {0x00 , 0x20 , 0x00 , p2 ,
6261 addPaddingToPin ({}, paddingLength, paddingChar)};
6362 response = card.transmitCTL (verifyPin, 0 , pinMinLength);
6463
6564 } else {
6665 const pcsc_cpp::CommandApdu verifyPin {
67- VERIFY_PIN , addPaddingToPin (std::move (pin), paddingLength, paddingChar)};
66+ 0x00 , 0x20 , 0x00 , p2 , addPaddingToPin (std::move (pin), paddingLength, paddingChar)};
6867
6968 response = card.transmit (verifyPin);
7069 }
@@ -119,15 +118,7 @@ inline pcsc_cpp::byte_vector internalAuthenticate(pcsc_cpp::SmartCard& card,
119118 const pcsc_cpp::byte_vector& hash,
120119 const std::string& cardType)
121120{
122- static const pcsc_cpp::CommandApdu INTERNAL_AUTHENTICATE {0x00 , 0x88 , 0x00 , 0x00 };
123-
124- pcsc_cpp::CommandApdu internalAuth {INTERNAL_AUTHENTICATE, hash};
125- // LE is needed in case of protocol T1.
126- // TODO: Implement this in libpcsc-cpp.
127- if (card.protocol () == pcsc_cpp::SmartCard::Protocol::T1) {
128- internalAuth.le = 0 ;
129- }
130-
121+ pcsc_cpp::CommandApdu internalAuth {0x00 , 0x88 , 0x00 , 0x00 , hash, 0 };
131122 const auto response = card.transmit (internalAuth);
132123
133124 if (response.sw1 == pcsc_cpp::ResponseApdu::WRONG_LENGTH) {
@@ -148,15 +139,7 @@ inline pcsc_cpp::byte_vector computeSignature(pcsc_cpp::SmartCard& card,
148139 const pcsc_cpp::byte_vector& hash,
149140 const std::string& cardType)
150141{
151- static const pcsc_cpp::CommandApdu COMPUTE_SIGNATURE {0x00 , 0x2A , 0x9E , 0x9A };
152-
153- pcsc_cpp::CommandApdu computeSignature {COMPUTE_SIGNATURE, hash};
154- // LE is needed in case of protocol T1.
155- // TODO: Implement this in libpcsc-cpp.
156- if (card.protocol () == pcsc_cpp::SmartCard::Protocol::T1) {
157- computeSignature.le = 0 ;
158- }
159-
142+ pcsc_cpp::CommandApdu computeSignature {0x00 , 0x2A , 0x9E , 0x9A , hash, 0 };
160143 const auto response = card.transmit (computeSignature);
161144
162145 if (response.sw1 == pcsc_cpp::ResponseApdu::WRONG_LENGTH) {
0 commit comments