From c883b6c78b812c376a55693006520b6690ccb533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=20S=C3=B5mermaa?= Date: Thu, 9 Dec 2021 12:42:15 +0200 Subject: [PATCH] feat(commands): use camelCase instead of kebab-case in command argument names and responses WE2-585 Signed-off-by: Mart Somermaa --- README.md | 32 +++++++++---------- .../command-handlers/authenticate.cpp | 10 +++--- .../command-handlers/getcertificate.cpp | 2 +- src/controller/command-handlers/sign.cpp | 20 ++++++------ .../command-handlers/signauthutils.cpp | 7 ++-- tests/input-output-mode/test.py | 8 ++--- tests/tests/getcommandhandler-mock.cpp | 2 +- tests/tests/main.cpp | 4 +-- 8 files changed, 43 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 4d71f84d..7d16e10f 100644 --- a/README.md +++ b/README.md @@ -52,23 +52,23 @@ either contains the requested Base64-encoded certificate and supported signature algorithms, or an error object with a symbolic error code. Successful output example: - {"certificate":"MIID7DCCA02gAwIBAgIQOZYpcFbeurZbzz9ngqCZsTAKBggqhkjOPQQDBDBgMQswCQYDVQQGEwJFRTEbMBkGA1UECgwSU0sgSUQgU29sdXRpb25zIEFTMRcwFQYDVQRhDA5OVFJFRS0xMDc0NzAxMzEbMBkGA1UEAwwSVEVTVCBvZiBFU1RFSUQyMDE4MB4XDTE4MTAyMzE1MzM1OVoXDTIzMTAyMjIxNTk1OVowfzELMAkGA1UEBhMCRUUxKjAoBgNVBAMMIUrDlUVPUkcsSkFBSy1LUklTVEpBTiwzODAwMTA4NTcxODEQMA4GA1UEBAwHSsOVRU9SRzEWMBQGA1UEKgwNSkFBSy1LUklTVEpBTjEaMBgGA1UEBRMRUE5PRUUtMzgwMDEwODU3MTgwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASKvaAJSGYBrLcvq0KjgM1sOAS9vbtqeSS2OkqyY4i5AazaetYmCtXKOqUUeljOJUGBUzljDFlAEPHs5Fn+vFT7+cGkOVCA93PBYKVsA9avcWyMwgQQJoW6kA4ZN9yD/mijggGrMIIBpzAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIGQDBIBgNVHSAEQTA/MDIGCysGAQQBg5EhAQIBMCMwIQYIKwYBBQUHAgEWFWh0dHBzOi8vd3d3LnNrLmVlL0NQUzAJBgcEAIvsQAECMB0GA1UdDgQWBBRYwsjA5GJ7HWPvD8ByThPTZ6j3PDCBigYIKwYBBQUHAQMEfjB8MAgGBgQAjkYBATAIBgYEAI5GAQQwEwYGBACORgEGMAkGBwQAjkYBBgEwUQYGBACORgEFMEcwRRY/aHR0cHM6Ly9zay5lZS9lbi9yZXBvc2l0b3J5L2NvbmRpdGlvbnMtZm9yLXVzZS1vZi1jZXJ0aWZpY2F0ZXMvEwJFTjAfBgNVHSMEGDAWgBTAhJkpxE6fOwI09pnhClYACCk+ezBzBggrBgEFBQcBAQRnMGUwLAYIKwYBBQUHMAGGIGh0dHA6Ly9haWEuZGVtby5zay5lZS9lc3RlaWQyMDE4MDUGCCsGAQUFBzAChilodHRwOi8vYy5zay5lZS9UZXN0X29mX0VTVEVJRDIwMTguZGVyLmNydDAKBggqhkjOPQQDBAOBjAAwgYgCQgDBTN1LM08SeH18xKQplqAmV8AQhVvrOxRELCmYp54Qr0XTi2i7kMw0k8gVOV84RlPQP6/ayjs4+ytRbIdkBZK1vQJCARF17/gWYUu7bmy/AXT6fWgyuDV5j2UC2cWDFhPUYyS99rdLGSfP10rP9mPK87Y+4HkfJB/qDyENnJYPa5mUsuFK","supported-signature-algos":[{"crypto-algo":"ECC","hash-algo":"SHA-224","padding-algo":"NONE"},{"crypto-algo":"ECC","hash-algo":"SHA-256","padding-algo":"NONE"},{"crypto-algo":"ECC","hash-algo":"SHA-384","padding-algo":"NONE"},{"crypto-algo":"ECC","hash-algo":"SHA-512","padding-algo":"NONE"},{"crypto-algo":"ECC","hash-algo":"SHA3-224","padding-algo":"NONE"},{"crypto-algo":"ECC","hash-algo":"SHA3-256","padding-algo":"NONE"},{"crypto-algo":"ECC","hash-algo":"SHA3-384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BQcBAQRnMGUwLAYIKwYBBQUHMAGGIGh0dHA6Ly9haWEuZGVtby5zay5lZS9lc3RlaWQyMDE4MDUGCCsGAQUFBzAChilodHRwOi8vYy5zay5lZS9UZXN0X29mX0VTVEVJRDIwMTguZGVyLmNydDAKBggqhkjOPQQDBAOBjAAwgYgCQgDBTN1LM08SeH18xKQplqAmV8AQhVvrOxRELCmYp54Qr0XTi2i7kMw0k8gVOV84RlPQP6/ayjs4+ytRbIdkBZK1vQJCARF17/gWYUu7bmy/AXT6fWgyuDV5j2UC2cWDFhPUYyS99rdLGSfP10rP9mPK87Y+4HkfJB/qDyENnJYPa5mUsuFK","supportedSignatureAlgorithms":[{"cryptoAlgorithm":"ECC","hashFunction":"SHA-224","paddingScheme":"NONE"},{"cryptoAlgorithm":"ECC","hashFunction":"SHA-256","paddingScheme":"NONE"},{"cryptoAlgorithm":"ECC","hashFunction":"SHA-384","paddingScheme":"NONE"},{"cryptoAlgorithm":"ECC","hashFunction":"SHA-512","paddingScheme":"NONE"},{"cryptoAlgorithm":"ECC","hashFunction":"SHA3-224","paddingScheme":"NONE"},{"cryptoAlgorithm":"ECC","hashFunction":"SHA3-256","paddingScheme":"NONE"},{"cryptoAlgorithm":"ECC","hashFunction":"SHA3-384","paddingScheme":"NONE"},{"cryptoAlgorithm":"ECC","hashFunction":"SHA3-512","paddingScheme":"NONE"}]} Error example: {"error": {"code": "ERR_WEBEID_NATIVE_FATAL", "message": "Invalid origin"}} -The `supported-signature-algos` field contains an array of objects that +The `supportedSignatureAlgorithms` field contains an array of objects that specify the signature algorithms that the card supports. Each object has three members: -- `crypto-algo`, the cryptographic algorithm, `ECC` for elliptic curve +- `cryptoAlgorithm`, the cryptographic algorithm, `ECC` for elliptic curve cryptography or `RSA` for the Rivest-Shamir-Adleman algorithm; -- `hash-algo`, the cryptographic hash algorithm, any of the SHA-2 or SHA-3 - standard algorithms, see _Allowed hash algorithms_ below in section _Sign_; +- `hashFunction`, the cryptographic hash function, any of the SHA-2 or SHA-3 + standard algorithms, see _Allowed hash functions_ below in section _Sign_; -- `padding-algo`, the padding scheme used, for example `PKCS1.5` for PKCS#1 +- `paddingScheme`, the padding scheme used, for example `PKCS1.5` for PKCS#1 v1.5 padding. ### Authenticate @@ -79,7 +79,7 @@ and signs it with the authentication key. Authentication command requires the challenge nonce and origin URL as JSON-encoded command-line arguments: - web-eid -c authenticate '{"challenge-nonce": "12345678901234567890123456789012345678901234", "origin": "https://ria.ee"}' + web-eid -c authenticate '{"challengeNonce": "12345678901234567890123456789012345678901234", "origin": "https://ria.ee"}' The result will be written to standard output as a JSON-encoded message that either contains the authentication token or an error code. Successful output @@ -100,31 +100,31 @@ architecture document](https://github.com/web-eid/web-eid-system-architecture-do Signing command signs the provided document hash with the signing key. -Signing command requires the Base64-encoded document hash, hash algorithm, +Signing command requires the Base64-encoded document hash, hash function, origin URL and previously retrieved Base64-encoded user signing certificate as JSON-encoded command-line arguments: - web-eid -c sign '{"doc-hash": "MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4", "hash-algo": "SHA-384", "origin": "https://ria.ee", "user-eid-cert": "MIID7DCCA02gAwIBAgIQGWaqJX+JmHFbyFd4ba1pajAKBggqhkjOPQQDBDBgMQswCQYDVQQGEwJFRTEbMBkGA1UECgwSU0sgSUQgU29sdXRpb25zIEFTMRcwFQYDVQRhDA5OVFJFRS0xMDc0NzAxMzEbMBkGA1UEAwwSVEVTVCBvZiBFU1RFSUQyMDE4MB4XDTE4MTAxODA5NTA0N1oXDTIzMTAxNzIxNTk1OVowfzELMAkGA1UEBhMCRUUxKjAoBgNVBAMMIUrDlUVPUkcsSkFBSy1LUklTVEpBTiwzODAwMTA4NTcxODEQMA4GA1UEBAwHSsOVRU9SRzEWMBQGA1UEKgwNSkFBSy1LUklTVEpBTjEaMBgGA1UEBRMRUE5PRUUtMzgwMDEwODU3MTgwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAT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29mX0VTVEVJRDIwMTguZGVyLmNydDAKBggqhkjOPQQDBAOBjAAwgYgCQgFgoBAifjq0O56O8ivxAWI6zyBwQ8Vpag1qanuh7Qcxspac4mZshc+maWG2ZcxLSNSOJ1a8kxOKe+3PCbittcfwPgJCANc9dTngWTc/8PLLXM62W3FeRnhQqFtw+5askIKEBw5e6maOrxP2mcz9yvnfg0jS52gQ0r905Af0bwp6vVxObxVU"}' -Allowed hash algorithm values are SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224, -SHA3-256, SHA3-384, SHA3-512, and the hash algorithm has to be supported by the -card (see the `hash-algo` member of `supported-signature-algos` array elements +Allowed hash function values are SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224, +SHA3-256, SHA3-384, SHA3-512, and the hash function has to be supported by the +card (see the `hashFunction` member of `supportedSignatureAlgorithms` array elements in the `get-signing-certificate` command output). The document hash length has to match -the hash algorithm output length and the hash algorithm has to be supported by +the hash function output length and the hash function has to be supported by the electronic ID signing implementation. -The user signing certificate for the `user-eid-cert` field can be retrieved +The user signing certificate for the `certificate` field can be retrieved with the `get-signing-certificate` command as described above: web-eid -c get-signing-certificate '{...other arguments as above...}' The result will be written to standard output as a JSON-encoded message that either contains the Base64-encoded signature and the signature algorithm used -(see the description of the `supported-signature-algos` field above in section +(see the description of the `supportedSignatureAlgorithms` field above in section _Get certificate_), or an error code. Successful output example: { - "signature-algo": {"hash-algo": "SHA-384", "padding-algo": "NONE", "crypto-algo": "ECC"}, + "signatureAlgorithm": {"hashFunction": "SHA-384", "paddingScheme": "NONE", "cryptoAlgorithm": "ECC"}, "signature": "oIw20YRlryXgAhGbHEKBCzQetVAE/S2VjqEQ1h+Kc9Scujcl37oOCmAgoHmEkG4Fpmp/z2waGw8ciJ1yXNpgzIaLhtyytFnFmcwR3zp6OKZTqHuEvTEAxZkxC6gLCxJh" } diff --git a/src/controller/command-handlers/authenticate.cpp b/src/controller/command-handlers/authenticate.cpp index eedd85d8..8f353f31 100644 --- a/src/controller/command-handlers/authenticate.cpp +++ b/src/controller/command-handlers/authenticate.cpp @@ -95,20 +95,20 @@ QByteArray createSignature(const QString& origin, const QString& challengeNonce, Authenticate::Authenticate(const CommandWithArguments& cmd) : CertificateReader(cmd) { const auto arguments = cmd.second; - requireArgumentsAndOptionalLang({"challenge-nonce", "origin"}, arguments, - "\"challenge-nonce\": \"\", " + requireArgumentsAndOptionalLang({"challengeNonce", "origin"}, arguments, + "\"challengeNonce\": \"\", " "\"origin\": \"\""); - challengeNonce = validateAndGetArgument(QStringLiteral("challenge-nonce"), arguments); + challengeNonce = validateAndGetArgument(QStringLiteral("challengeNonce"), arguments); // nonce must contain at least 256 bits of entropy and is usually Base64-encoded, so the // required byte length is 44, the length of 32 Base64-encoded bytes. if (challengeNonce.length() < 44) { THROW(CommandHandlerInputDataError, - "Challenge nonce argument 'challenge-nonce' must be at least 44 characters long"); + "Challenge nonce argument 'challengeNonce' must be at least 44 characters long"); } if (challengeNonce.length() > 128) { THROW(CommandHandlerInputDataError, - "Challenge nonce argument 'challenge-nonce' cannot be longer than 128 characters"); + "Challenge nonce argument 'challengeNonce' cannot be longer than 128 characters"); } validateAndStoreOrigin(arguments); } diff --git a/src/controller/command-handlers/getcertificate.cpp b/src/controller/command-handlers/getcertificate.cpp index eda5ca69..c69f9d2d 100644 --- a/src/controller/command-handlers/getcertificate.cpp +++ b/src/controller/command-handlers/getcertificate.cpp @@ -54,5 +54,5 @@ QVariantMap GetCertificate::onConfirm(WebEidUI* /* window */, // Base64url-encoded) DER [ITU.X690.2008] PKIX certificate value. auto certPem = cardCertAndPin.certificateBytesInDer.toBase64(); auto algos = supportedSigningAlgos(cardCertAndPin.cardInfo->eid()); - return {{"certificate", QString(certPem)}, {"supported-signature-algos", algos}}; + return {{"certificate", QString(certPem)}, {"supportedSignatureAlgorithms", algos}}; } diff --git a/src/controller/command-handlers/sign.cpp b/src/controller/command-handlers/sign.cpp index ed1db6d4..2ab818d2 100644 --- a/src/controller/command-handlers/sign.cpp +++ b/src/controller/command-handlers/sign.cpp @@ -51,18 +51,18 @@ Sign::Sign(const CommandWithArguments& cmd) : CertificateReader(cmd) const auto arguments = cmd.second; requireArgumentsAndOptionalLang( - {"doc-hash", "hash-algo", "user-eid-cert", "origin"}, arguments, - "\"doc-hash\": \"\", " - "\"hash-algo\": \"\", " + "\"hashFunction\": \"\", \"user-eid-cert\": \"\", \"certificate\": \"\", " "\"origin\": \"\""); validateAndStoreDocHashAndHashAlgo(arguments); userEidCertificateFromArgs = - parseAndValidateCertificate(QStringLiteral("user-eid-cert"), arguments); + parseAndValidateCertificate(QStringLiteral("certificate"), arguments); validateAndStoreOrigin(arguments); } @@ -108,7 +108,7 @@ QVariantMap Sign::onConfirm(WebEidUI* window, const CardCertificateAndPinInfo& c std::fill(pin.begin(), pin.end(), '\0'); return {{QStringLiteral("signature"), signature.first}, - {QStringLiteral("signature-algo"), signature.second}}; + {QStringLiteral("signatureAlgorithm"), signature.second}}; } catch (const VerifyPinFailed& failure) { switch (failure.status()) { @@ -135,12 +135,12 @@ void Sign::connectSignals(const WebEidUI* window) void Sign::validateAndStoreDocHashAndHashAlgo(const QVariantMap& args) { - docHash = QByteArray::fromBase64( - validateAndGetArgument(QStringLiteral("doc-hash"), args)); + docHash = + QByteArray::fromBase64(validateAndGetArgument(QStringLiteral("hash"), args)); - QString hashAlgoInput = validateAndGetArgument(QStringLiteral("hash-algo"), args); + QString hashAlgoInput = validateAndGetArgument(QStringLiteral("hashFunction"), args); if (hashAlgoInput.size() > 8) { - THROW(CommandHandlerInputDataError, "hash-algo value is invalid"); + THROW(CommandHandlerInputDataError, "hashFunction value is invalid"); } hashAlgo = HashAlgorithm(hashAlgoInput.toStdString()); diff --git a/src/controller/command-handlers/signauthutils.cpp b/src/controller/command-handlers/signauthutils.cpp index 71864356..753628df 100644 --- a/src/controller/command-handlers/signauthutils.cpp +++ b/src/controller/command-handlers/signauthutils.cpp @@ -135,10 +135,11 @@ QVariantMap signatureAlgoToVariantMap(const SignatureAlgorithm signatureAlgo) } if (signatureAlgo & SignatureAlgorithm::ES) - return {{"crypto-algo", "ECC"}, {"hash-algo", hashAlgo}, {"padding-algo", "NONE"}}; + return {{"cryptoAlgorithm", "ECC"}, {"hashFunction", hashAlgo}, {"paddingScheme", "NONE"}}; if (signatureAlgo & SignatureAlgorithm::RS) - return {{"crypto-algo", "RSA"}, {"hash-algo", hashAlgo}, {"padding-algo", "PKCS1.5"}}; + return { + {"cryptoAlgorithm", "RSA"}, {"hashFunction", hashAlgo}, {"paddingScheme", "PKCS1.5"}}; if (signatureAlgo & SignatureAlgorithm::PS) - return {{"crypto-algo", "RSA"}, {"hash-algo", hashAlgo}, {"padding-algo", "PSS"}}; + return {{"cryptoAlgorithm", "RSA"}, {"hashFunction", hashAlgo}, {"paddingScheme", "PSS"}}; THROW(ProgrammingError, "Unknown signature algorithm " + std::string(signatureAlgo)); } diff --git a/tests/input-output-mode/test.py b/tests/input-output-mode/test.py index ce4b2798..330559aa 100644 --- a/tests/input-output-mode/test.py +++ b/tests/input-output-mode/test.py @@ -50,7 +50,7 @@ def test_2_authenticate(self): message = { 'command': 'authenticate', 'arguments': { - 'challenge-nonce': '12345678123456781234567812345678912356789123', + 'challengeNonce': '12345678123456781234567812345678912356789123', 'origin': 'https://ria.ee' } } @@ -63,10 +63,10 @@ def test_3_sign(self): message = { 'command': 'sign', 'arguments': { - 'doc-hash': b64encode(b'x' * 48).decode('ascii'), - 'hash-algo': 'SHA-384', + 'hash': b64encode(b'x' * 48).decode('ascii'), + 'hashFunction': 'SHA-384', 'origin': 'https://ria.ee', - 'user-eid-cert': self.__class__.signingCertificate, + 'certificate': self.__class__.signingCertificate, } } response = self.exchange_message_with_app(message) diff --git a/tests/tests/getcommandhandler-mock.cpp b/tests/tests/getcommandhandler-mock.cpp index c6dd29aa..9e61c558 100644 --- a/tests/tests/getcommandhandler-mock.cpp +++ b/tests/tests/getcommandhandler-mock.cpp @@ -33,7 +33,7 @@ using namespace std::string_literals; const QVariantMap AUTHENTICATE_COMMAND_ARGUMENT = { - {"challenge-nonce", "12345678912345678912345678912345678912345678"}, + {"challengeNonce", "12345678912345678912345678912345678912345678"}, {"origin", "https://ria.ee"}, }; diff --git a/tests/tests/main.cpp b/tests/tests/main.cpp index 0c1c8d51..cc074252 100644 --- a/tests/tests/main.cpp +++ b/tests/tests/main.cpp @@ -168,13 +168,13 @@ void WebEidTests::getCertificate_outputsSupportedAlgos() QSignalSpy certificateReadySpy(g_cached_GetCertificate.get(), &GetCertificate::singleCertificateReady); QVariantMap ES224_ALGO { - {"crypto-algo", "ECC"}, {"hash-algo", "SHA-224"}, {"padding-algo", "NONE"}}; + {"cryptoAlgorithm", "ECC"}, {"hashFunction", "SHA-224"}, {"paddingScheme", "NONE"}}; // act runEventLoopVerifySignalsEmitted(certificateReadySpy); // assert - QCOMPARE(controller->result()["supported-signature-algos"].toList()[0].toMap(), ES224_ALGO); + QCOMPARE(controller->result()["supportedSignatureAlgorithms"].toList()[0].toMap(), ES224_ALGO); } void WebEidTests::authenticate_validArgumentsResultInValidToken()