@@ -51,18 +51,20 @@ QVariantMap createAuthenticationToken(const QString& signatureAlgorithm,
51
51
{" format" , QStringLiteral (" web-eid:1.0" )},
52
52
{" appVersion" ,
53
53
QStringLiteral (" https://web-eid.eu/web-eid-app/releases/%1" )
54
- .arg (qApp-> applicationVersion ())},
54
+ .arg (QApplication:: applicationVersion ())},
55
55
};
56
56
}
57
57
58
58
QByteArray createSignature (const QString& origin, const QString& challengeNonce,
59
59
const ElectronicID& eid, const pcsc_cpp::byte_vector& pin)
60
60
{
61
- static const auto SIGNATURE_ALGO_TO_HASH =
62
- std::map<JsonWebSignatureAlgorithm, QCryptographicHash::Algorithm> {
61
+ static const std::map<JsonWebSignatureAlgorithm, QCryptographicHash::Algorithm>
62
+ SIGNATURE_ALGO_TO_HASH {
63
63
{JsonWebSignatureAlgorithm::RS256, QCryptographicHash::Sha256},
64
64
{JsonWebSignatureAlgorithm::PS256, QCryptographicHash::Sha256},
65
+ {JsonWebSignatureAlgorithm::ES256, QCryptographicHash::Sha256},
65
66
{JsonWebSignatureAlgorithm::ES384, QCryptographicHash::Sha384},
67
+ {JsonWebSignatureAlgorithm::ES512, QCryptographicHash::Sha512},
66
68
};
67
69
68
70
if (!SIGNATURE_ALGO_TO_HASH.count (eid.authSignatureAlgorithm ())) {
@@ -80,8 +82,8 @@ QByteArray createSignature(const QString& origin, const QString& challengeNonce,
80
82
// The value that is signed is hash(origin)+hash(challenge).
81
83
const auto hashToBeSignedQBytearray =
82
84
QCryptographicHash::hash (originHash + challengeNonceHash, hashAlgo);
83
- const auto hashToBeSigned =
84
- pcsc_cpp::byte_vector {hashToBeSignedQBytearray. cbegin (), hashToBeSignedQBytearray.cend ()};
85
+ const pcsc_cpp::byte_vector hashToBeSigned {hashToBeSignedQBytearray. cbegin (),
86
+ hashToBeSignedQBytearray.cend ()};
85
87
86
88
const auto signature = eid.signWithAuthKey (pin, hashToBeSigned);
87
89
@@ -95,11 +97,12 @@ QByteArray createSignature(const QString& origin, const QString& challengeNonce,
95
97
Authenticate::Authenticate (const CommandWithArguments& cmd) : CertificateReader(cmd)
96
98
{
97
99
const auto arguments = cmd.second ;
98
- requireArgumentsAndOptionalLang ({ " challengeNonce " , " origin " }, arguments,
99
- " \" challengeNonce\" : \" <challenge nonce> \" , "
100
- " \" origin\ " : \ " <origin URL>\" " );
100
+ requireArgumentsAndOptionalLang (
101
+ { " challengeNonce" , " origin " }, arguments,
102
+ R"( "challengeNonce": "<challenge nonce>", " origin": "<origin URL>" ) " );
101
103
102
- challengeNonce = validateAndGetArgument<QString>(QStringLiteral (" challengeNonce" ), arguments);
104
+ challengeNonce = validateAndGetArgument<decltype (challengeNonce)>(
105
+ QStringLiteral (" challengeNonce" ), arguments);
103
106
// nonce must contain at least 256 bits of entropy and is usually Base64-encoded, so the
104
107
// required byte length is 44, the length of 32 Base64-encoded bytes.
105
108
if (challengeNonce.length () < 44 ) {
@@ -135,10 +138,10 @@ QVariantMap Authenticate::onConfirm(WebEidUI* window,
135
138
136
139
} catch (const VerifyPinFailed& failure) {
137
140
switch (failure.status ()) {
138
- case electronic_id:: VerifyPinFailed::Status::PIN_ENTRY_CANCEL:
139
- case electronic_id:: VerifyPinFailed::Status::PIN_ENTRY_TIMEOUT:
141
+ case VerifyPinFailed::Status::PIN_ENTRY_CANCEL:
142
+ case VerifyPinFailed::Status::PIN_ENTRY_TIMEOUT:
140
143
break ;
141
- case electronic_id:: VerifyPinFailed::Status::PIN_ENTRY_DISABLED:
144
+ case VerifyPinFailed::Status::PIN_ENTRY_DISABLED:
142
145
emit retry (RetriableError::PIN_VERIFY_DISABLED);
143
146
break ;
144
147
default :
0 commit comments