Add positive and negative test cases for SignatureData 18/314318/6
authorPhan Xuan Tan <xuan.tan@samsung.com>
Wed, 10 Jul 2024 05:55:25 +0000 (12:55 +0700)
committerDariusz Michaluk <d.michaluk@samsung.com>
Fri, 12 Jul 2024 11:33:20 +0000 (13:33 +0200)
Change-Id: Ib4a486e2487b04def14a70d9ad88784472a6bf8f

unit-tests/CMakeLists.txt
unit-tests/resource/wgt_valid/author-signature.xml [new file with mode: 0644]
unit-tests/resource/wgt_valid/config.xml [new file with mode: 0644]
unit-tests/resource/wgt_valid/css/style.css [new file with mode: 0644]
unit-tests/resource/wgt_valid/icon.png [new file with mode: 0644]
unit-tests/resource/wgt_valid/index.html [new file with mode: 0644]
unit-tests/resource/wgt_valid/js/main.js [new file with mode: 0644]
unit-tests/resource/wgt_valid/signature1.xml [new file with mode: 0644]
unit-tests/test_constant.cpp
unit-tests/test_constant.h
unit-tests/test_vcore_signature_data.cpp [new file with mode: 0644]

index 82707d1..ae038ca 100644 (file)
@@ -68,6 +68,7 @@ SET(UNIT_TESTS_SOURCES
     test_vcore_certificate_collection.cpp
     test_vcore_api_cert.cpp
     test_vcore_api_pkcs12.cpp
+    test_vcore_signature_data.cpp
     test_cert_server_db.cpp
     test_cert_server_logic.cpp
     colour_log_formatter.cpp
@@ -127,4 +128,11 @@ INSTALL(
         data/signer_cert.pem
         data/trusted_cert.pem
     DESTINATION ${CERT_SVC_TESTS}/unit_test_data
+)
+
+INSTALL(
+    DIRECTORY
+        resource/wgt_valid
+    DESTINATION
+        ${CERT_SVC_TESTS}/unit_test_data
 )
\ No newline at end of file
diff --git a/unit-tests/resource/wgt_valid/author-signature.xml b/unit-tests/resource/wgt_valid/author-signature.xml
new file mode 100644 (file)
index 0000000..cb0b73c
--- /dev/null
@@ -0,0 +1,75 @@
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="AuthorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="config.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>slamUlCPsGfRZvSlot9sIUMiPSjVSPOeJ0I7X1yxvmE=</DigestValue>
+</Reference>
+<Reference URI="css%2Fstyle.css">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>0/mhZV4kwFnSzCSp45AhFjWaQnaie61uW8VeXioOLQg=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>vPjxjOppORd6hn9Bw4sh06gqtDoJzoFbV/8e9FyIdvk=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>OYW0ozIt+YihibhXb3mmAtIpmp5rJFNpS6n0bcbqPpI=</DigestValue>
+</Reference>
+<Reference URI="js%2Fmain.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>0oc6DiyrAj1HQFcu+27/BHCQKn3zBn9dKls96iQZ564=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>lpo8tUDs054eLlBQXiDPVDVKfw30ZZdtkRs1jd7H5K8=</DigestValue>
+</Reference>
+</SignedInfo>
+<SignatureValue>
+DEDbUoxWn26xtZD+J+Qp71TzALREeTaalmbS1170MXpPiGjukYhD63KDEcHhYxU2cgAVUAcL2mD/
+ITe50rC8jy7dz2xqnUP2rIlFxIGRbciCs9fHx2CmqIq4yqvvdj7usy9o3SWsBx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ufjW0iHRE7WlpR6EvI
+W6TFyZgMpQq+kg4hWl2SBTf3s2VI8Ygz7gj8TMlClg==
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#AuthorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#AuthorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-author"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#AuthorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file
diff --git a/unit-tests/resource/wgt_valid/config.xml b/unit-tests/resource/wgt_valid/config.xml
new file mode 100644 (file)
index 0000000..5e57d7d
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://yourdomain/TestApp" version="1.0.0" viewmodes="maximized">
+    <tizen:application id="N75lVtaOnD.TestApp" package="N75lVtaOnD" required_version="2.2"/>
+    <content src="index.html"/>
+    <feature name="http://tizen.org/feature/screen.size.all"/>
+    <icon src="icon.png"/>
+    <name>TestApp</name>
+    <tizen:profile name="wearable"/>
+</widget>
diff --git a/unit-tests/resource/wgt_valid/css/style.css b/unit-tests/resource/wgt_valid/css/style.css
new file mode 100644 (file)
index 0000000..4eb877d
--- /dev/null
@@ -0,0 +1,23 @@
+* {
+    font-family: Verdana, Lucida Sans, Arial, Helvetica, sans-serif;
+}
+
+body {
+    margin: 0px auto;
+    background-color:#222;
+}
+
+.contents {
+       display: flex;
+       display: -webkit-flex;
+       box-sizing: border-box;
+       -webkit-box-sizing: border-box;
+       height:320px;
+}
+
+
+.content_text {
+       font-weight:bold;
+       font-size:5em;
+       color:#fff;
+}
\ No newline at end of file
diff --git a/unit-tests/resource/wgt_valid/icon.png b/unit-tests/resource/wgt_valid/icon.png
new file mode 100644 (file)
index 0000000..1f02568
Binary files /dev/null and b/unit-tests/resource/wgt_valid/icon.png differ
diff --git a/unit-tests/resource/wgt_valid/index.html b/unit-tests/resource/wgt_valid/index.html
new file mode 100644 (file)
index 0000000..f6c4a72
--- /dev/null
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
+    <meta name="description" content="Tizen Wearable basic template generated by Samsung Wearable Web IDE"/>
+
+    <title>Tizen Wearable Web IDE - Tizen Wearable - Tizen Wearable basic Application</title>
+
+    <link rel="stylesheet" type="text/css" href="css/style.css"/>
+    <script src="js/main.js"></script>
+</head>
+
+<body>
+  <div class=contents>
+       <div style='margin:auto;'>
+               <span class=content_text id=textbox>Basic</span>
+       </div>
+  </div>
+</body>
+</html>
diff --git a/unit-tests/resource/wgt_valid/js/main.js b/unit-tests/resource/wgt_valid/js/main.js
new file mode 100644 (file)
index 0000000..88fb9e4
--- /dev/null
@@ -0,0 +1,21 @@
+
+window.onload = function () {
+    // TODO:: Do your initialization job
+
+    // add eventListener for tizenhwkey
+    document.addEventListener('tizenhwkey', function(e) {
+        if(e.keyName == "back")
+       try {
+           tizen.application.getCurrentApplication().exit();
+       } catch (ignore) {
+       }
+    });
+
+    // Sample code
+    var textbox = document.querySelector('.contents');
+    textbox.addEventListener("click", function(){
+       box = document.querySelector('#textbox');
+       box.innerHTML = box.innerHTML == "Basic" ? "Sample" : "Basic";
+    });
+    
+};
diff --git a/unit-tests/resource/wgt_valid/signature1.xml b/unit-tests/resource/wgt_valid/signature1.xml
new file mode 100644 (file)
index 0000000..48becf3
--- /dev/null
@@ -0,0 +1,76 @@
+<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="DistributorSignature">
+<SignedInfo>
+<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
+<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></SignatureMethod>
+<Reference URI="author-signature.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>PTzNKgBBJEV/YtJgOP9lkUMVy+IQ3b9gVn5eorv4e3s=</DigestValue>
+</Reference>
+<Reference URI="config.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>slamUlCPsGfRZvSlot9sIUMiPSjVSPOeJ0I7X1yxvmE=</DigestValue>
+</Reference>
+<Reference URI="css%2Fstyle.css">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>0/mhZV4kwFnSzCSp45AhFjWaQnaie61uW8VeXioOLQg=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>vPjxjOppORd6hn9Bw4sh06gqtDoJzoFbV/8e9FyIdvk=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>OYW0ozIt+YihibhXb3mmAtIpmp5rJFNpS6n0bcbqPpI=</DigestValue>
+</Reference>
+<Reference URI="js%2Fmain.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>0oc6DiyrAj1HQFcu+27/BHCQKn3zBn9dKls96iQZ564=</DigestValue>
+</Reference>
+<Reference URI="#prop">
+<Transforms>
+<Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"></Transform>
+</Transforms>
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>u/jU3U4Zm5ihTMSjKGlGYbWzDfRkGphPPHx3gJIYEJ4=</DigestValue>
+</Reference>
+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16sTB/0
+VhfnkHwPltmrpYVe
+</X509Certificate>
+</X509Data>
+</KeyInfo>
+<Object Id="prop"><SignatureProperties xmlns:dsp="http://www.w3.org/2009/xmldsig-properties"><SignatureProperty Id="profile" Target="#DistributorSignature"><dsp:Profile URI="http://www.w3.org/ns/widgets-digsig#profile"></dsp:Profile></SignatureProperty><SignatureProperty Id="role" Target="#DistributorSignature"><dsp:Role URI="http://www.w3.org/ns/widgets-digsig#role-distributor"></dsp:Role></SignatureProperty><SignatureProperty Id="identifier" Target="#DistributorSignature"><dsp:Identifier></dsp:Identifier></SignatureProperty></SignatureProperties></Object>
+</Signature>
\ No newline at end of file
index 5798d88..ac388ed 100644 (file)
@@ -308,3 +308,9 @@ const std::map<std::string, CertStoreType> storeTypeMap =
        {"email_", EMAIL_STORE},
        {"wifi_", WIFI_STORE}
 };
+
+
+namespace PackageData {
+       const std::string WgtValidPath =
+               std::string(TESTAPP_RES_DIR) + "unit_test_data/wgt_valid";
+}
\ No newline at end of file
index d16e30b..726ec56 100644 (file)
@@ -106,4 +106,8 @@ namespace StoreType {
        extern const CertStoreType InvalidStore;
 }
 
-extern const std::map<std::string, CertStoreType> storeTypeMap;
\ No newline at end of file
+extern const std::map<std::string, CertStoreType> storeTypeMap;
+
+namespace PackageData {
+       extern const std::string WgtValidPath;
+}
\ No newline at end of file
diff --git a/unit-tests/test_vcore_signature_data.cpp b/unit-tests/test_vcore_signature_data.cpp
new file mode 100644 (file)
index 0000000..fdc9b06
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "vcore/CertStoreType.h"
+#include "vcore/Certificate.h"
+#include "vcore/SignatureData.h"
+#include "vcore/SignatureValidator.h"
+#include "test_constant.h"
+#include "test_common.h"
+#include "test_macros.h"
+#include <cstring>
+
+using namespace ValidationCore;
+using namespace std;
+
+CertStoreId::Type setAndGetVisibilityLevel(CertStoreId::Type certType)
+{
+       SignatureData signatureData;
+       CertStoreId::Set storeIdSet;
+       storeIdSet.add(certType);
+       signatureData.setStorageType(storeIdSet);
+
+       return signatureData.getVisibilityLevel();
+}
+
+BOOST_AUTO_TEST_SUITE(VCORE_SIGNARURE_DATA_TEST)
+
+POSITIVE_TEST_CASE(T_set_and_get_reference)
+{
+       SignatureData signatureData;
+       std::set<std::string> referenceSet;
+       referenceSet.insert("config.xml");
+       referenceSet.insert("icon.png");
+       signatureData.setReference(referenceSet);
+
+       std::set<std::string> result = signatureData.getReferenceSet();
+       BOOST_CHECK_EQUAL(result.size(), 2);
+}
+
+POSITIVE_TEST_CASE(T_set_and_get_storage_type)
+{
+       SignatureData signatureData;
+       CertStoreId::Set storeIdSet;
+       storeIdSet.add(CertStoreId::TIZEN_DEVELOPER);
+       signatureData.setStorageType(storeIdSet);
+
+       CertStoreId::Set result = signatureData.getStorageType();
+       BOOST_CHECK_EQUAL(result.typeToString(), "TIZEN_DEVELOPER ");
+}
+
+POSITIVE_TEST_CASE(T_set_and_get_visibility_level)
+{
+       BOOST_CHECK_EQUAL(
+               setAndGetVisibilityLevel(CertStoreId::VIS_PLATFORM),
+               CertStoreId::VIS_PLATFORM);
+
+       BOOST_CHECK_EQUAL(
+               setAndGetVisibilityLevel(CertStoreId::VIS_PARTNER),
+               CertStoreId::VIS_PARTNER);
+
+       BOOST_CHECK_EQUAL(
+               setAndGetVisibilityLevel(CertStoreId::VIS_PUBLIC),
+               CertStoreId::VIS_PUBLIC);
+
+       BOOST_CHECK_EQUAL(
+               setAndGetVisibilityLevel(CertStoreId::TIZEN_DEVELOPER),
+               0);
+}
+
+NEGATIVE_TEST_CASE(T_get_imei_in_empty_list)
+{
+       SignatureData signatureData;
+       SignatureData::IMEIList result = signatureData.getIMEIList();
+       BOOST_CHECK_EQUAL(result.size(), 0);
+}
+
+NEGATIVE_TEST_CASE(T_get_meid_in_empty_list)
+{
+       SignatureData signatureData;
+       SignatureData::IMEIList result = signatureData.getMEIDList();
+       BOOST_CHECK_EQUAL(result.size(), 0);
+}
+
+POSITIVE_TEST_CASE(T_set_and_get_ext_signature_param)
+{
+       SignatureData signatureData;
+       const std::string key = "key";
+       std::string value;
+       signatureData.setExtSignatureParam(key, "abc1");
+
+       bool result = signatureData.getExtSignatureParam(key, value);
+       BOOST_CHECK(result);
+}
+
+NEGATIVE_TEST_CASE(T_get_ext_signature_param_empty)
+{
+       SignatureData signatureData;
+       const std::string key = "key";
+       std::string value;
+
+       bool result = signatureData.getExtSignatureParam(key, value);
+       BOOST_CHECK(!result);
+}
+
+POSITIVE_TEST_CASE(T_get_certificate_from_signature_data)
+{
+       SignatureFileInfoSet signatureSet;
+       SignatureFinder signatureFinder(PackageData::WgtValidPath);
+
+       SignatureFinder::Result result = signatureFinder.find(signatureSet);
+       BOOST_CHECK_EQUAL(result, SignatureFinder::NO_ERROR);
+       BOOST_CHECK_EQUAL(signatureSet.size(), 2);
+
+       for (auto &sig: signatureSet)
+       {
+               SignatureValidator validator(sig);
+               SignatureData outData;
+               ValidationCore::VCerr result;
+
+               result = validator.check(PackageData::WgtValidPath, true, true, outData);
+               BOOST_CHECK_EQUAL(result, E_SIG_NONE);
+
+               CertificatePtr cert1 = outData.getRootCaCertificatePtr();
+               BOOST_CHECK(cert1);
+               BOOST_CHECK(cert1->isRootCert());
+
+               CertificatePtr cert2 = outData.getEndEntityCertificatePtr();
+               BOOST_CHECK(cert2);
+               BOOST_CHECK(!cert2->isRootCert());
+       }
+}
+
+NEGATIVE_TEST_CASE(T_get_certificate_empty_from_signature_data)
+{
+       SignatureData outData;
+       CertificatePtr cert1 = outData.getRootCaCertificatePtr();
+       BOOST_CHECK(!cert1);
+       CertificatePtr cert2 = outData.getEndEntityCertificatePtr();
+       BOOST_CHECK(!cert2);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file