summaryrefslogtreecommitdiff
path: root/tests/test_certs.cpp
diff options
context:
space:
mode:
authorJanusz Kozerski <j.kozerski@samsung.com>2015-08-04 11:59:59 +0200
committerJanusz Kozerski <j.kozerski@samsung.com>2015-09-08 09:40:51 +0200
commitae4a130374e96d383e09571f2e098ef237e28418 (patch)
treebe1aec96429587bebab0b8395326c4dde558c56d /tests/test_certs.cpp
parent4373c73514186ce90d71a0486447fa66dcf0a6c1 (diff)
downloadcert-checker-ae4a130374e96d383e09571f2e098ef237e28418.tar.gz
cert-checker-ae4a130374e96d383e09571f2e098ef237e28418.tar.bz2
cert-checker-ae4a130374e96d383e09571f2e098ef237e28418.zip
Use new cert-svc-vcore API: makeChainBySignature()
This change includes adding cert_order in DB. Chain of certificates should be created while reading/parsing signature. Certificates should be put into DB in right order - first should go end entity certificate. DB ensures that certificates will be loaded into the buffer in exactly same order (end entity will be the first element on the list). Verification: Run tests, all should pass. Change-Id: I09571bab7862bdb539dd3a957330fe23d687b48f
Diffstat (limited to 'tests/test_certs.cpp')
-rw-r--r--tests/test_certs.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_certs.cpp b/tests/test_certs.cpp
index 1867e4e..d5750f7 100644
--- a/tests/test_certs.cpp
+++ b/tests/test_certs.cpp
@@ -474,4 +474,44 @@ VhfnkHwPltmrpYVe"};
BOOST_REQUIRE(app2 == origin2);
}
+BOOST_AUTO_TEST_CASE(find_app_signatures_negative) {
+
+ // App1
+ app_t app1("app_id", "pkg_id", 101, {});
+ ocsp_urls_t ocsp_urls;
+ std::string path1 = std::string(TEST_APP_SIGNATURES_DIR) + std::string("/app3");
+
+ find_app_signatures (app1, path1, ocsp_urls);
+ // signature exists, but contains error - should not be parsed
+ BOOST_REQUIRE(app1.signatures.empty());
+}
+
+BOOST_AUTO_TEST_CASE(find_app_signatures_mixed) {
+
+ app_t app("app_id", "pkg_id", 101, {});
+ ocsp_urls_t ocsp_urls;
+ std::string path = std::string(TEST_APP_SIGNATURES_DIR) + std::string("/app4");
+
+ find_app_signatures (app, path, ocsp_urls);
+ // 2 signatures exist, but one of them contains error - only one should be parsed
+ BOOST_REQUIRE(app.signatures.size() == 1);
+
+ app_t origin("app_id", "pkg_id", 101, {});
+ chain_t chain = {"MIIClDCCAf2gAwIBAgIGAT4hYbcpMA0GCSqGSIb3DQEBBQUAMIGEMQswCQYDVQQGEwJLUjEOMAwG\
+A1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENBMSAwHgYD\
+VQQLDBdUaXplbiBEZXZlbG9wZXIgVGVzdCBDQTEbMBkGA1UEAwwSVGl6ZW4gRGV2ZWxvcGVyIENB\
+MB4XDTEzMDQxOTA4MjA1MloXDTQwMDkwNDA4MjA1MVowgZUxCzAJBgNVBAYTAlBMMREwDwYDVQQI\
+DAhNYXpvdmlhbjEPMA0GA1UEBwwGV2Fyc2F3MQ4wDAYDVQQKDAVTUlBPTDERMA8GA1UECwwIS1NG\
+L1dTU1AxJTAjBgkqhkiG9w0BCQEWFmoua296ZXJza2lAc2Ftc3VuZy5jb20xGDAWBgNVBAMMD0ph\
+bnVzeiBLb3plcnNraTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAs0REWSsOn/QyVDSjSTRE\
+0W+LacX4cifRYI16nQi8WJhCAymhOg4UVXUk31Iwta8lOnQvgoce8bR+/dbCzDBmnogq8KXWlEtn\
+Ma3X6Tvz5BZfNy4Zj44G/aK0tJvnBj28h2ZZe545BNNW4zKR4SvNie9uM8v1r16PZaaS0YxOXl0C\
+AwEAATANBgkqhkiG9w0BAQUFAAOBgQCGuwLCcQAAQz2Op83gTl0Pb+f7AinL8d3XGRC8dtFPqSrZ\
+wN3gEEIQxQeYLahEVPAsD1K9aWebbWm/sjpDERKW7hmYvGYz90Z+ocLKdork5XgQWqVGt7qi+pxZ\
+x6VDuNVxDrQtsX/hLf/YBhZJuzs/LSdlErUKQM8fdxvVzbld3w=="};
+ origin.signatures.push_back(chain);
+
+ BOOST_REQUIRE(app == origin);
+}
+
BOOST_AUTO_TEST_SUITE_END()