[Unit tests] Add unit tests for signature 32/37932/3
authorJakub Izydorczyk <j.izydorczyk@samsung.com>
Mon, 16 Feb 2015 08:33:20 +0000 (09:33 +0100)
committerPawel Sikorski <p.sikorski@samsung.com>
Thu, 9 Apr 2015 08:22:25 +0000 (01:22 -0700)
3/3 tests PASS

Change-Id: I45e1e41b8e94ac171e75ad4e047cbd0d5379bb3b

14 files changed:
src/unit_tests/CMakeLists.txt
src/unit_tests/signature_unittest.cc [new file with mode: 0644]
src/unit_tests/test_samples/bad_signatures/author-signature.xml [new file with mode: 0644]
src/unit_tests/test_samples/bad_signatures/config.xml [new file with mode: 0644]
src/unit_tests/test_samples/bad_signatures/icon.png [new file with mode: 0644]
src/unit_tests/test_samples/bad_signatures/index.html [new file with mode: 0644]
src/unit_tests/test_samples/bad_signatures/signature1.xml [new file with mode: 0644]
src/unit_tests/test_samples/bad_signatures/version.txt [new file with mode: 0644]
src/unit_tests/test_samples/good_signatures/author-signature.xml [new file with mode: 0644]
src/unit_tests/test_samples/good_signatures/config.xml [new file with mode: 0644]
src/unit_tests/test_samples/good_signatures/icon.png [new file with mode: 0644]
src/unit_tests/test_samples/good_signatures/index.html [new file with mode: 0644]
src/unit_tests/test_samples/good_signatures/signature1.xml [new file with mode: 0644]
src/unit_tests/test_samples/good_signatures/version.txt [new file with mode: 0644]

index 7aabc28..e7983b7 100644 (file)
@@ -5,6 +5,7 @@ SET(TESTS
   manifest_unittest
   manifest_handler_unittest
   manifest_util_unittest
+  signature_unittest
   string_util_unittest
   parser_unittest
   xml_parser_unittest
@@ -29,6 +30,8 @@ ADD_EXECUTABLE(xml_parser_unittest
                xml_parser_unittest.cc ../xml_parser/xml_parser.cc)
 ADD_EXECUTABLE(service_handler_unittest
                service_handler_unittest.cc)
+ADD_EXECUTABLE(signature_unittest
+               signature_unittest.cc)
 
 INSTALL(DIRECTORY test_samples/ DESTINATION ${SHAREDIR}/app-installers-ut/test_samples)
 
@@ -54,6 +57,7 @@ target_link_libraries(string_util_unittest PUBLIC ${TARGET_LIBNAME_PARSER} ${GTE
 target_link_libraries(parser_unittest PUBLIC ${TARGET_LIBNAME_PARSER} ${GTEST_MAIN_LIBRARIES})
 target_link_libraries(xml_parser_unittest PUBLIC ${TARGET_LIBNAME_PARSER} ${GTEST_MAIN_LIBRARIES})
 target_link_libraries(service_handler_unittest PUBLIC ${TARGET_LIBNAME_PARSER} ${TARGET_LIBNAME_MANIFEST_HANDLERS} ${GTEST_MAIN_LIBRARIES})
+target_link_libraries(signature_unittest PUBLIC ${TARGET_LIBNAME_SIGNATURE} ${GTEST_MAIN_LIBRARIES})
 
 FOREACH(test ${TESTS})
 INSTALL(TARGETS ${test} DESTINATION ${BINDIR}/app-installers-ut)
diff --git a/src/unit_tests/signature_unittest.cc b/src/unit_tests/signature_unittest.cc
new file mode 100644 (file)
index 0000000..9b094e1
--- /dev/null
@@ -0,0 +1,61 @@
+// Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache 2.0 license that can be
+// found in the LICENSE file.
+
+#include <boost/filesystem/path.hpp>
+#include <gtest/gtest.h>
+
+#include <memory>
+
+#include "signature/signature_data.h"
+#include "signature/signature_parser.h"
+#include "signature/signature_validator.h"
+#include "signature/signature_xmlsec_adaptor.h"
+
+namespace bf = boost::filesystem;
+
+namespace common_installer {
+namespace signature {
+
+class SignatureValidatorTest : public testing::Test {
+ protected:
+  std::unique_ptr<bf::path> signature_file;
+};
+
+
+// Tests signature verifier with proper signatures
+TEST_F(SignatureValidatorTest, HandlesInitializedSignatureDir) {
+  signature_file.reset(new bf::path(
+      "/usr/share/app-installers-ut/test_samples/good_signatures"));
+  ASSERT_NE(nullptr, signature_file);
+  EXPECT_EQ(SignatureValidator::Check(*signature_file),
+            SignatureValidator::Status::VALID);
+}
+
+// Tests signature verifier with signature directory containing bad signatures
+TEST_F(SignatureValidatorTest, HandlesBadSignatureDir) {
+  signature_file.reset(new bf::path(
+      "/usr/share/app-installers-ut/test_samples/bad_signatures"));
+  ASSERT_NE(nullptr, signature_file);
+  EXPECT_EQ(SignatureValidator::Check(*signature_file),
+            SignatureValidator::Status::INVALID);
+}
+
+class SignatureXMLSecAdaptorTest : public testing::Test {
+ protected:
+  std::unique_ptr<bf::path> signature_file;
+  std::unique_ptr<SignatureData> data;
+};
+
+// Tests SignatureXMLSecAdaptor file verification with proper data
+TEST_F(SignatureXMLSecAdaptorTest, HandlesValidateFileInitializedSignature) {
+  signature_file.reset(new bf::path(
+      "/usr/share/app-installers-ut/test_samples/"
+      "good_signatures/signature1.xml"));
+  data = SignatureParser::CreateSignatureData(*signature_file, 1);
+  ASSERT_TRUE(data.get());
+  EXPECT_TRUE(SignatureXmlSecAdaptor::ValidateFile(*data));
+}
+
+}  // namespace signature
+}  // namespace common_installer
diff --git a/src/unit_tests/test_samples/bad_signatures/author-signature.xml b/src/unit_tests/test_samples/bad_signatures/author-signature.xml
new file mode 100644 (file)
index 0000000..d5b9249
--- /dev/null
@@ -0,0 +1,71 @@
+<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>iEX0LuZs81Q6Du/SkXgbMd+Qa6puMxgyRUCLqhrfpJ8=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>rJOIi81O4OG/Gar/hwrjvD623MpScv6TMdurRZgzDf0=</DigestValue>
+</Reference>
+<Reference URI="version.txt">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>MjYb9c/C/J56bHY6rlIjfDqkpjFtsUBjLLkco/rcfFY=</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>
+c7Jd7btw6Bi9MxzKVv6JY9xcegxv42DhOzZhyrjz3EMN/60dhcGJClfKBY39FwH6exMajoThyFIW
+djtnp7pqIiQJCJkGRs0vAQThcm8JniVSbUwHMcMw7WjAW5VPsLQZKmEe16YW00YkoT6KfZLC1ySw
+48WNrHrCrTcj6LZRrld=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIIC2zCCAcOgAwIBAgIGAUudC0tkMA0GCSqGSIb3DQEBBQUAMFYxGjAYBgNVBAoMEVRpemVuIEFz
+c29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4gRGV2
+ZWxvcGVycyBDQTAeFw0xMjExMDEwMDAwMDBaFw0xOTAxMDEwMDAwMDBaMFcxCzAJBgNVBAYTAlBM
+MQ8wDQYDVQQHDAZXYXJzYXcxEDAOBgNVBAoMB1NhbXN1bmcxFDASBgNVBAsMC1dlYlBsYXRmb3Jt
+MQ8wDQYDVQQDDAZhdXRob3IwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM0kQ8aPoKnJaBjk
+3ET7XdOS5C3ueSemfA8tYNihWQ3VX95CKX38ARLpaAGRSfOdo2L1vTIBtaO/UWEEl/XKQzqwem22
+A9UuL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kp7MqzvQg3pXOxtajj
+vyHxiatJl+xXrHgcXC1wgyG3buty7u/Fi2mvKXJ0PRJcCjjK81dqe/Vr20sRUCrbk02zbm5ggFt/
+jIEhV8wbFRQpliobc7J4dSTKhFfrqGM8rdd54LYhD7gSI1CFSe16pUXfcVR7FhJztRaiGLnCrwBE
+dyTZ248+D4L/qR/D0axb3jcCAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC
+AQEAnOXXQ/1O/QTDHyrmQDtFziqPY3xWlJBqJtEqXiT7Y+Ljpe66e+Ee/OjQMlZe8gu21/8cKklH
+95RxjopMWCVedXDUbWdvS2+CdyvVW/quT2E0tjqIzXDekUTYwwhlPWlGxvfj3VsxqSFq3p8Brl04
+1Gx5RKAGyKVsMfTLhbbwSWwApuBUxYfcNpKwLWGPXkysu+HctY03OKv4/xKBnVWiN8ex/Sgesi0M
++OBAOMdZMPK32uJBTeKFx1xZgTLIhk45V0hPOomPjZloiv0LSS11eyd451ufjW0iHRE7WlpR6EvI
+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>
diff --git a/src/unit_tests/test_samples/bad_signatures/config.xml b/src/unit_tests/test_samples/bad_signatures/config.xml
new file mode 100644 (file)
index 0000000..7b0bd2d
--- /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/AppInstallersTest" version="1.0.0" viewmodes="maximized">
+    <tizen:application id="ZK6wgb4nwt.AppInstallersTest" package="ZK6wgb4nwt" required_version="2.3"/>
+    <content src="index.html"/>
+    <feature name="http://tizen.org/feature/screen.size.all"/>
+    <icon src="icon.png"/>
+    <name>AppInstallersTest</name>
+    <tizen:profile name="mobile"/>
+</widget>
diff --git a/src/unit_tests/test_samples/bad_signatures/icon.png b/src/unit_tests/test_samples/bad_signatures/icon.png
new file mode 100644 (file)
index 0000000..9765b1b
Binary files /dev/null and b/src/unit_tests/test_samples/bad_signatures/icon.png differ
diff --git a/src/unit_tests/test_samples/bad_signatures/index.html b/src/unit_tests/test_samples/bad_signatures/index.html
new file mode 100644 (file)
index 0000000..d4f1aef
--- /dev/null
@@ -0,0 +1,46 @@
+<!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 basic template generated by Tizen Web IDE"/>
+
+    <title>Tizen Web IDE - Tizen - Tizen basic Application</title>
+</head>
+
+<body>
+  <header>
+    <hgroup>
+      <h1>Tizen app</h1>
+      <h2>An empty template of tizen</h2>
+    </hgroup>
+  </header>
+
+  <nav>
+    <ul>
+       <li><a href="#">Home</a></li>
+       <li><a href="#">About Us</a></li>
+       <li><a href="#">Contact Us</a></li>
+    </ul>
+  </nav>
+
+  <article>
+    <p>This is an empty template of Tizen Web Application. Tizen will support multiple device categories:</p>
+    <ul>
+      <li>smartphones, tablets and smart TVs
+      <li>netbooks, in-vehicle infotainment devices
+    </ul>
+    <section>
+      <p>This is a basic section of a document.</p>
+      <p>The following button displays a time using JavaScript.</p>
+      <div id="divbutton1">
+        <button>Clock</button>
+      </div>
+    </section>
+  </article>
+
+  <footer>
+    <p>&copy; 2012 Company Name. All rights reserved.</p>
+  </footer>    
+</body>
+</html>
diff --git a/src/unit_tests/test_samples/bad_signatures/signature1.xml b/src/unit_tests/test_samples/bad_signatures/signature1.xml
new file mode 100644 (file)
index 0000000..12a7d2a
--- /dev/null
@@ -0,0 +1,72 @@
+<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>opfWp60FUsKzpdQBgTp3x31PB1GzC9mS6M7B6n2m63c=</DigestValue>
+</Reference>
+<Reference URI="config.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>iEX0LuZs81Q6Du/SkXgbMd+Qa6puMxgyRUCLqhrfpJ8=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>rJOIi81O4OG/Gar/hwrjvD623MpScv6TMdurRZgzDf0=</DigestValue>
+</Reference>
+<Reference URI="version.txt">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>MjYb9c/C/J56bHY6rlIjfDqkpjFtsUBjLLkco/rcfFY=</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/jU3U4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BWuyHw8OWv3RXtTum1+PGHjBJ2eYY4ZKIpz73U/1NC16sTB/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>
diff --git a/src/unit_tests/test_samples/bad_signatures/version.txt b/src/unit_tests/test_samples/bad_signatures/version.txt
new file mode 100644 (file)
index 0000000..029d105
--- /dev/null
@@ -0,0 +1 @@
+3.0.130
diff --git a/src/unit_tests/test_samples/good_signatures/author-signature.xml b/src/unit_tests/test_samples/good_signatures/author-signature.xml
new file mode 100644 (file)
index 0000000..83ef530
--- /dev/null
@@ -0,0 +1,71 @@
+<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>iEX0LuZs81Q6Du/SkXgbMd+Qa6puMxgyRUCLqhrfpJ8=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>rJOIi81O4OG/Gar/hwrjvD623MpScv6TMdurRZgzDf0=</DigestValue>
+</Reference>
+<Reference URI="version.txt">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>MjYb9c/C/J56bHY6rlIjfDqkpjFtsUBjLLkco/rcfFY=</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>
+c7Jd7btw6Bi9MxzKVv6JY9xcegxv42DhOzZhyrjz3EMN/60dhcGJClfKBY39FwH6exMajoThyFIW
+djtnp7pqIiQJCJkGRs0vAQThcm8JniVSbUwHMcMw7WjAW5VPsLQZKmEe16YW00YkoT6KfZLC1ySw
+48WNrHrCrTcj6LZRrlc=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIIC2zCCAcOgAwIBAgIGAUudC0tkMA0GCSqGSIb3DQEBBQUAMFYxGjAYBgNVBAoMEVRpemVuIEFz
+c29jaWF0aW9uMRowGAYDVQQLDBFUaXplbiBBc3NvY2lhdGlvbjEcMBoGA1UEAwwTVGl6ZW4gRGV2
+ZWxvcGVycyBDQTAeFw0xMjExMDEwMDAwMDBaFw0xOTAxMDEwMDAwMDBaMFcxCzAJBgNVBAYTAlBM
+MQ8wDQYDVQQHDAZXYXJzYXcxEDAOBgNVBAoMB1NhbXN1bmcxFDASBgNVBAsMC1dlYlBsYXRmb3Jt
+MQ8wDQYDVQQDDAZhdXRob3IwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAM0kQ8aPoKnJaBjk
+3ET7XdO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q+OYMMwSasCu
+g8dwODx1eDeSYVuOLWRxpAmbTXOsSFi6VoWeyaPEm18JBHvZBsU5YQtgZ6Kp7MqzvQg3pXOxtajj
+vyHxiatJl+xXrHgcXC1wgyG3buty7u/Fi2mvKXJ0PRJcCjjK81dqe/Vr20sRUCrbk02zbm5ggFt/
+jIEhV8wbFRQpliobc7J4dSTKhFfrqGM8rdd54LYhD7gSI1CFSe16pUXfcVR7FhJztRaiGLnCrwBE
+dyTZ248+D4L/qR/D0axb3jcCAwEAAaMQMA4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC
+AQEAnOXXQ/1O/QTDHyrmQDtFziqPY3xWlJBqJtEqXiT7Y+Ljpe66e+Ee/OjQMlZe8gu21/8cKklH
+95RxjopMWCVedXDUbWdvS2+CdyvVW/quT2E0tjqIzXDekUTYwwhlPWlGxvfj3VsxqSFq3p8Brl04
+1Gx5RKAGyKVsMfTLhbbwSWwApuBUxYfcNpKwLWGPXkysu+HctY03OKv4/xKBnVWiN8ex/Sgesi0M
++OBAOMdZMPK32uJBTeKFx1xZgTLIhk45V0hPOomPjZloiv0LSS11eyd451ufjW0iHRE7WlpR6EvI
+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/src/unit_tests/test_samples/good_signatures/config.xml b/src/unit_tests/test_samples/good_signatures/config.xml
new file mode 100644 (file)
index 0000000..7b0bd2d
--- /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/AppInstallersTest" version="1.0.0" viewmodes="maximized">
+    <tizen:application id="ZK6wgb4nwt.AppInstallersTest" package="ZK6wgb4nwt" required_version="2.3"/>
+    <content src="index.html"/>
+    <feature name="http://tizen.org/feature/screen.size.all"/>
+    <icon src="icon.png"/>
+    <name>AppInstallersTest</name>
+    <tizen:profile name="mobile"/>
+</widget>
diff --git a/src/unit_tests/test_samples/good_signatures/icon.png b/src/unit_tests/test_samples/good_signatures/icon.png
new file mode 100644 (file)
index 0000000..9765b1b
Binary files /dev/null and b/src/unit_tests/test_samples/good_signatures/icon.png differ
diff --git a/src/unit_tests/test_samples/good_signatures/index.html b/src/unit_tests/test_samples/good_signatures/index.html
new file mode 100644 (file)
index 0000000..d4f1aef
--- /dev/null
@@ -0,0 +1,46 @@
+<!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 basic template generated by Tizen Web IDE"/>
+
+    <title>Tizen Web IDE - Tizen - Tizen basic Application</title>
+</head>
+
+<body>
+  <header>
+    <hgroup>
+      <h1>Tizen app</h1>
+      <h2>An empty template of tizen</h2>
+    </hgroup>
+  </header>
+
+  <nav>
+    <ul>
+       <li><a href="#">Home</a></li>
+       <li><a href="#">About Us</a></li>
+       <li><a href="#">Contact Us</a></li>
+    </ul>
+  </nav>
+
+  <article>
+    <p>This is an empty template of Tizen Web Application. Tizen will support multiple device categories:</p>
+    <ul>
+      <li>smartphones, tablets and smart TVs
+      <li>netbooks, in-vehicle infotainment devices
+    </ul>
+    <section>
+      <p>This is a basic section of a document.</p>
+      <p>The following button displays a time using JavaScript.</p>
+      <div id="divbutton1">
+        <button>Clock</button>
+      </div>
+    </section>
+  </article>
+
+  <footer>
+    <p>&copy; 2012 Company Name. All rights reserved.</p>
+  </footer>    
+</body>
+</html>
diff --git a/src/unit_tests/test_samples/good_signatures/signature1.xml b/src/unit_tests/test_samples/good_signatures/signature1.xml
new file mode 100644 (file)
index 0000000..5ab592b
--- /dev/null
@@ -0,0 +1,72 @@
+<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>opfWp60FUsKzpdQBgTp3x31PB1GzC9mS6M7B6n2m63c=</DigestValue>
+</Reference>
+<Reference URI="config.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>iEX0LuZs81Q6Du/SkXgbMd+Qa6puMxgyRUCLqhrfpJ8=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>1d0oEZHqPn+QzNzGIHwj9ODby6x9ggFs9uOsav6jPNs=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>rJOIi81O4OG/Gar/hwrjvD623MpScv6TMdurRZgzDf0=</DigestValue>
+</Reference>
+<Reference URI="version.txt">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>MjYb9c/C/J56bHY6rlIjfDqkpjFtsUBjLLkco/rcfFY=</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>
+</SignedInfo>
+<SignatureValue>
+O6yHkXzPKe+8nGxjh06ivDImxKSKygVOgvZzmKKHVWn879K2K8vY08/f7FXKG+zRXEouXbZd7aip
+IGyOCpulXUzESCQMIiffzMVgTV0Ho+kXx44xbME/XKy7DJYpZOvZFXX1S9ZXvU2BmmgHtWWLS/gc
+sFiYVHpRxLnify3npXE=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIICmzCCAgQCCQDXI7WLdVZwiTANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMCS1IxDjAMBgNV
+BAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6ZW4gVGVzdCBDQTEiMCAGA1UE
+CwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwbVGl6ZW4gUHVibGljIERpc3Ry
+aWJ1dG9yIENBMB4XDTEyMTAyOTEzMDMwNFoXDTIyMTAyNzEzMDMwNFowgZMxCzAJBgNVBAYTAktS
+MQ4wDAYDVQQIDAVTdXdvbjEOMAwGA1UEBwwFU3V3b24xFjAUBgNVBAoMDVRpemVuIFRlc3QgQ0Ex
+IjAgBgNVBAsMGVRpemVuIERpc3RyaWJ1dG9yIFRlc3QgQ0ExKDAmBgNVBAMMH1RpemVuIFB1Ymxp
+YyBEaXN0cmlidXRvciBTaWduZXIwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALtMvlc5hENK
+90ZdA+y66+Sy0enD1gpZDBh5T9RP0oRsptJv5jjNTseQbQi0SZOdOXb6J7iQdlBCtR343RpIEz8H
+mrBy7mSY7mgwoU4EPpp4CTSUeAuKcmvrNOngTp5Hv7Ngf02TTHOLK3hZLpGayaDviyNZB5P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R6u72ltKk1S4zPfMJJv482CRGCI4FK6djhlsI4i0Lt1SVIJEed+
+yc3qckGm19dW+4xdlkekon7pViEBWuyHw8OWv3RXtTum1+PGHjBJ2eYY4ZKIpz73U/1NC16sTB/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
diff --git a/src/unit_tests/test_samples/good_signatures/version.txt b/src/unit_tests/test_samples/good_signatures/version.txt
new file mode 100644 (file)
index 0000000..029d105
--- /dev/null
@@ -0,0 +1 @@
+3.0.130