@@ -55,6 +55,8 @@ TEST(electronic_id_test, selectCertificateEstIDEMIA)
5555 const HashAlgorithm hashAlgo = authAlgo.hashAlgorithm ();
5656
5757 pcsc_cpp::byte_vector authPin {' 1' , ' 2' , ' 3' , ' 4' };
58+ authPin.reserve (12 );
59+
5860 const auto hash = calculateDigest (hashAlgo, dataToSign);
5961 const auto authSignature = cardInfo->eid ().signWithAuthKey (std::move (authPin), hash);
6062 if (!verify (hashAlgo, certificateAuth, dataToSign, authSignature, false )) {
@@ -70,6 +72,8 @@ TEST(electronic_id_test, selectCertificateEstIDEMIA)
7072 EXPECT_EQ (signingRetriesLeft.second , 3 );
7173
7274 pcsc_cpp::byte_vector signPin {' 1' , ' 2' , ' 3' , ' 4' , ' 5' };
75+ signPin.reserve (12 );
76+
7377 EXPECT_EQ (cardInfo->eid ().isSupportedSigningHashAlgorithm (hashAlgo), true );
7478 const auto signSignature =
7579 cardInfo->eid ().signWithSigningKey (std::move (signPin), hash, hashAlgo);
@@ -102,6 +106,8 @@ TEST(electronic_id_test, selectCertificateFinV3)
102106 const HashAlgorithm hashAlgo = authAlgo.hashAlgorithm ();
103107
104108 pcsc_cpp::byte_vector authPin {' 1' , ' 2' , ' 3' , ' 4' };
109+ authPin.reserve (12 );
110+
105111 const auto hash = calculateDigest (hashAlgo, dataToSign);
106112 const auto authSignature = cardInfo->eid ().signWithAuthKey (std::move (authPin), hash);
107113 if (!verify (hashAlgo, certificateAuth, dataToSign, authSignature, true )) {
@@ -117,6 +123,8 @@ TEST(electronic_id_test, selectCertificateFinV3)
117123 EXPECT_EQ (signingRetriesLeft.second , 5 );
118124
119125 pcsc_cpp::byte_vector signPin {' 1' , ' 2' , ' 3' , ' 4' , ' 5' , ' 6' };
126+ signPin.reserve (12 );
127+
120128 EXPECT_EQ (cardInfo->eid ().isSupportedSigningHashAlgorithm (hashAlgo), true );
121129 const auto signSignature =
122130 cardInfo->eid ().signWithSigningKey (std::move (signPin), hash, hashAlgo);
@@ -149,6 +157,8 @@ TEST(electronic_id_test, selectCertificateFinV4)
149157 const HashAlgorithm hashAlgo = authAlgo.hashAlgorithm ();
150158
151159 pcsc_cpp::byte_vector authPin {' 1' , ' 2' , ' 3' , ' 4' };
160+ authPin.reserve (12 );
161+
152162 const auto hash = calculateDigest (hashAlgo, dataToSign);
153163 const auto authSignature = cardInfo->eid ().signWithAuthKey (std::move (authPin), hash);
154164 if (!verify (hashAlgo, certificateAuth, dataToSign, authSignature, true )) {
@@ -164,6 +174,8 @@ TEST(electronic_id_test, selectCertificateFinV4)
164174 EXPECT_EQ (signingRetriesLeft.second , 5 );
165175
166176 pcsc_cpp::byte_vector signPin {' 1' , ' 2' , ' 3' , ' 4' , ' 5' , ' 6' };
177+ signPin.reserve (12 );
178+
167179 EXPECT_EQ (cardInfo->eid ().isSupportedSigningHashAlgorithm (hashAlgo), true );
168180 const auto signSignature =
169181 cardInfo->eid ().signWithSigningKey (std::move (signPin), hash, hashAlgo);
@@ -196,6 +208,8 @@ TEST(electronic_id_test, selectCertificateLat_V1)
196208 const HashAlgorithm hashAlgo = authAlgo.hashAlgorithm ();
197209
198210 pcsc_cpp::byte_vector authPin {' 1' , ' 2' , ' 3' , ' 4' };
211+ authPin.reserve (64 );
212+
199213 const auto hash = calculateDigest (hashAlgo, dataToSign);
200214 const auto authSignature = cardInfo->eid ().signWithAuthKey (std::move (authPin), hash);
201215 if (!verify (hashAlgo, certificateAuth, dataToSign, authSignature, false )) {
@@ -211,6 +225,8 @@ TEST(electronic_id_test, selectCertificateLat_V1)
211225 EXPECT_EQ (signingRetriesLeft.second , 3 );
212226
213227 pcsc_cpp::byte_vector signPin {' 1' , ' 2' , ' 3' , ' 4' , ' 5' , ' 6' };
228+ signPin.reserve (64 );
229+
214230 EXPECT_EQ (cardInfo->eid ().isSupportedSigningHashAlgorithm (hashAlgo), true );
215231 const auto signSignature =
216232 cardInfo->eid ().signWithSigningKey (std::move (signPin), hash, hashAlgo);
@@ -243,6 +259,8 @@ TEST(electronic_id_test, selectCertificateLatV2)
243259 const HashAlgorithm hashAlgo = authAlgo.hashAlgorithm ();
244260
245261 pcsc_cpp::byte_vector authPin {' 1' , ' 2' , ' 3' , ' 4' };
262+ authPin.reserve (64 );
263+
246264 const auto hash = calculateDigest (hashAlgo, dataToSign);
247265 const auto authSignature = cardInfo->eid ().signWithAuthKey (std::move (authPin), hash);
248266 if (!verify (hashAlgo, certificateAuth, dataToSign, authSignature, false )) {
@@ -258,6 +276,8 @@ TEST(electronic_id_test, selectCertificateLatV2)
258276 EXPECT_EQ (signingRetriesLeft.second , 3 );
259277
260278 pcsc_cpp::byte_vector signPin {' 1' , ' 2' , ' 3' , ' 4' , ' 5' , ' 6' };
279+ signPin.reserve (64 );
280+
261281 EXPECT_EQ (cardInfo->eid ().isSupportedSigningHashAlgorithm (hashAlgo), true );
262282 const auto signSignature =
263283 cardInfo->eid ().signWithSigningKey (std::move (signPin), hash, hashAlgo);
0 commit comments