summaryrefslogtreecommitdiff
path: root/tests
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
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')
-rw-r--r--tests/CMakeLists.txt7
-rw-r--r--tests/app_event_operators.cpp12
-rw-r--r--tests/app_event_operators.h2
-rw-r--r--tests/files/app3/signature1.xml80
-rw-r--r--tests/files/app4/author-signature.xml61
-rw-r--r--tests/files/app4/signature1.xml79
-rw-r--r--tests/test_app.cpp91
-rw-r--r--tests/test_certs.cpp40
-rw-r--r--tests/test_db.cpp20
9 files changed, 322 insertions, 70 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index c8183ae..62800da 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -95,6 +95,13 @@ INSTALL(FILES
INSTALL(FILES
files/app_2/signature1.xml
DESTINATION ${TEST_APP_SIGNATURES_DIR}/app_2/)
+INSTALL(FILES
+ files/app3/signature1.xml
+ DESTINATION ${TEST_APP_SIGNATURES_DIR}/app3/)
+INSTALL(FILES
+ files/app4/author-signature.xml
+ files/app4/signature1.xml
+ DESTINATION ${TEST_APP_SIGNATURES_DIR}/app4/)
INSTALL(TARGETS ${TARGET_CERT_CHECKER_TESTS} DESTINATION ${BINDIR})
INSTALL(TARGETS ${TARGET_CERT_CHECKER_POPUP_TEST} DESTINATION ${BINDIR})
diff --git a/tests/app_event_operators.cpp b/tests/app_event_operators.cpp
index 1d26d60..6fb2c2e 100644
--- a/tests/app_event_operators.cpp
+++ b/tests/app_event_operators.cpp
@@ -27,11 +27,17 @@
namespace CCHECKER {
-void sort(app_t &app)
+void sort_buffer(std::list<app_t> &buff)
{
- for (auto &iter : app.signatures) {
- iter.sort();
+ for (auto &iter : buff) {
+ sort(iter);
}
+
+ buff.sort();
+}
+
+void sort(app_t &app)
+{
app.signatures.sort();
}
diff --git a/tests/app_event_operators.h b/tests/app_event_operators.h
index 3e96d28..2638c19 100644
--- a/tests/app_event_operators.h
+++ b/tests/app_event_operators.h
@@ -28,6 +28,8 @@
namespace CCHECKER {
+void sort_buffer(std::list<app_t> &buff);
+
void sort(app_t &app);
bool operator ==(const app_t &app1, const app_t &app2);
bool operator !=(const app_t &app1, const app_t &app2);
diff --git a/tests/files/app3/signature1.xml b/tests/files/app3/signature1.xml
new file mode 100644
index 0000000..483467e
--- /dev/null
+++ b/tests/files/app3/signature1.xml
@@ -0,0 +1,80 @@
+<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>STd01qoNmkFKYFkHtIfTNzz44Sooj4yPcbnpPMvNXrA=</DigestValue>
+</Reference>
+<Reference URI="images/tizen_32.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>eDr9ZPFlGlapLDnI1BiALwqovNdBvx3Aspc/lWOH3WI=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>eDr9ZPFlGlapLDnI1BiALwqovNdBvx3Aspc/lWOH3WI=</DigestValue>
+</Reference>
+<Reference URI="js/main.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>gJORpAB1ok2tUJx0JeQkk9ByvXOQLMG4BMddjCQxYBs=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>yckSRw904y3goDeL/oBnL0BM2kWy22cS4l8EFOrnhbM=</DigestValue>
+</Reference>
+<Reference URI="css/style.css">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>mVyzTIt7toDjqJDyK8zFNfUxuVnC7msv17Oai/+NZdI=</DigestValue>
+</Reference>
+<Reference URI="config.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>n6D6h7VGH+8sz01o3wJNEWZNaoOQ2u3Lr2u1lcxkR9Y=</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>
+fxRqA7mM4PjJLYYTgz2nnV7VNmBvHU17VY3uAEKShLlYclmvj5GKNfdmlHrSd08KxMcHiqSJc1OE
+up2BNsnJ3UHIV6LLqFlOqdybXg3CH8jPiHWKG8Ns8xbljpIemRq5p3ZrMZdaTXjmP4B92GoWEdo2
+5uF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SIb3DQEBBQUAMIGVMQswCQYDVQQGEwJLUjEO
+MAwGA1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENBMSMw
+IQYDVQQLDBpUVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEpMCcGA1UEAwwgVGl6ZW4gUHVibGlj
+IERpc3RyaWJ1dG9yIFJvb3QgQ0EwHhcNMTIxMDI5MTMwMjUwWhcNMjIxMDI3MTMwMjUwWjCBjzEL
+MAkGA1UEBhMCS1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6
+ZW4gVGVzdCBDQTEiMCAGA1UECwwZVGl6ZW4gRGlzdHJpYnV0b3IgVGVzdCBDQTEkMCIGA1UEAwwb
+VGl6ZW4gUHVibGljIERpc3RyaWJ1dG9yIENBMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDe
+OTS/3nXvkDEmsFCJIvRlQ3RKDcxdWJJp625pFqHdmoJBdV+x6jl1raGK2Y1sp2Gdvpjc/z92yzAp
+bE/UVLPh/tRNZPeGhzU4ejDDm7kzdr2f7Ia0U98K+OoY12ucwg7TYNItj9is7Cj4blGfuMDzd2ah
+2AgnCGlwNwV/pv+uVQIDAQABoxAwDjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACqJ
+KO33YdoGudwanZIxMdXuxnnD9R6u72ltKk1S4zPfMJJv482CRGCI4FK6djhlsI4i0Lt1SVIJEed+
+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>
diff --git a/tests/files/app4/author-signature.xml b/tests/files/app4/author-signature.xml
new file mode 100644
index 0000000..13458b8
--- /dev/null
+++ b/tests/files/app4/author-signature.xml
@@ -0,0 +1,61 @@
+<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="images/tizen_32.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>eDr9ZPFlGlapLDnI1BiALwqovNdBvx3Aspc/lWOH3WI=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>eDr9ZPFlGlapLDnI1BiALwqovNdBvx3Aspc/lWOH3WI=</DigestValue>
+</Reference>
+<Reference URI="js/main.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>gJORpAB1ok2tUJx0JeQkk9ByvXOQLMG4BMddjCQxYBs=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>yckSRw904y3goDeL/oBnL0BM2kWy22cS4l8EFOrnhbM=</DigestValue>
+</Reference>
+<Reference URI="css/style.css">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>mVyzTIt7toDjqJDyK8zFNfUxuVnC7msv17Oai/+NZdI=</DigestValue>
+</Reference>
+<Reference URI="config.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>KXS856VpStHxKdsgVoSkzgI0faEpYC0wTg2+ahLwCEk=</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>
+QBiwbw/ChRHbNgpCMP5ht2U/BX9sfBgKFTmxEsxywtl1QUBRi+XbK3fhjt+SqBwv32RtEq0TouwB
+7rthEpLNj9R+GJwCdjNpl79kEvZcY+KaWk2gSXsQ5THtnN9wXxfi95ke84lOpbQ6+y8pPzLbEx5Q
+yYdu4jOAIscr2NV9bbM=
+</SignatureValue>
+<KeyInfo>
+<X509Data>
+<X509Certificate>
+MIIClDCCAf2gAwIBAgIGAT4hYbcpMA0GCSqGSIb3DQEBBQUAMIGEMQswCQYDVQQGEwJLUjEOMAwG
+A1UECAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENBMSAwHgYD
+VQQLDBdUaXplbiBEZXZlbG9wZXIgVGVzdCBDQTEbMBkGA1UEAwwSVGl6ZW4gRGV2ZWxvcGVyIENB
+MB4XDTEzMDQxOTA4MjA1MloXDTQwMDkwNDA4MjA1MVowgZUxCzAJBgNVBAYTAlBMMREwDwYDVQQI
+DAhNYXpvdmlhbjEPMA0GA1UEBwwGV2Fyc2F3MQ4wDAYDVQQKDAVTUlBPTDERMA8GA1UECwwIS1NG
+L1dTU1AxJTAjBgkqhkiG9w0BCQEWFmoua296ZXJza2lAc2Ftc3VuZy5jb20xGDAWBgNVBAMMD0ph
+bnVzeiBLb3plcnNraTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAs0REWSsOn/QyVDSjSTRE
+0W+LacX4cifRYI16nQi8WJhCAymhOg4UVXUk31Iwta8lOnQvgoce8bR+/dbCzDBmnogq8KXWlEtn
+Ma3X6Tvz5BZfNy4Zj44G/aK0tJvnBj28h2ZZe545BNNW4zKR4SvNie9uM8v1r16PZaaS0YxOXl0C
+AwEAATANBgkqhkiG9w0BAQUFAAOBgQCGuwLCcQAAQz2Op83gTl0Pb+f7AinL8d3XGRC8dtFPqSrZ
+wN3gEEIQxQeYLahEVPAsD1K9aWebbWm/sjpDERKW7hmYvGYz90Z+ocLKdork5XgQWqVGt7qi+pxZ
+x6VDuNVxDrQtsX/hLf/YBhZJuzs/LSdlErUKQM8fdxvVzbld3w==
+</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/tests/files/app4/signature1.xml b/tests/files/app4/signature1.xml
new file mode 100644
index 0000000..f525fac
--- /dev/null
+++ b/tests/files/app4/signature1.xml
@@ -0,0 +1,79 @@
+<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>STd01qoNmkFKYFkHtIfTNzz44Sooj4yPcbnpPMvNXrA=</DigestValue>
+</Reference>
+<Reference URI="images/tizen_32.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>eDr9ZPFlGlapLDnI1BiALwqovNdBvx3Aspc/lWOH3WI=</DigestValue>
+</Reference>
+<Reference URI="icon.png">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>eDr9ZPFlGlapLDnI1BiALwqovNdBvx3Aspc/lWOH3WI=</DigestValue>
+</Reference>
+<Reference URI="js/main.js">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>gJORpAB1ok2tUJx0JeQkk9ByvXOQLMG4BMddjCQxYBs=</DigestValue>
+</Reference>
+<Reference URI="index.html">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>yckSRw904y3goDeL/oBnL0BM2kWy22cS4l8EFOrnhbM=</DigestValue>
+</Reference>
+<Reference URI="css/style.css">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>mVyzTIt7toDjqJDyK8zFNfUxuVnC7msv17Oai/+NZdI=</DigestValue>
+</Reference>
+<Reference URI="config.xml">
+<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></DigestMethod>
+<DigestValue>n6D6h7VGH+8sz01o3wJNEWZNaoOQ2u3Lr2u1lcxkR9Y=</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=</D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C16sTB/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/tests/test_app.cpp b/tests/test_app.cpp
index 20bf905..295d724 100644
--- a/tests/test_app.cpp
+++ b/tests/test_app.cpp
@@ -35,31 +35,19 @@ BOOST_AUTO_TEST_CASE(App_positive) {
app_t app1("app_1", "pkg_1", 5001, {{"aaaaaa"}});
app_t app2("app_1", "pkg_1", 5001, {{"aaaaaa"}});
- app_t app3("app_2", "pkg_1", 5002, {{"aaa", "bbbb"}});
- app_t app4("app_2", "pkg_1", 5002, {{"bbbb", "aaa"}});
+ app_t app3("app_2", "pkg_1", 5002, {{"aaa", "bbbb"}, {"ccccc"}});
+ app_t app4("app_2", "pkg_1", 5002, {{"ccccc"}, {"aaa", "bbbb"}});
chain_t chain411 = {"cert_4.1", "cert 4.2"};
- chain_t chain412 = {"cert 4.2", "cert_4.1"};
chain_t chain421 = {"cert_4.2.1", "cert 4.2.2", "cert 4.2.3"};
- chain_t chain422 = {"cert 4.2.2", "cert 4.2.3", "cert_4.2.1"};
- chain_t chain423 = {"cert 4.2.3", "cert_4.2.1", "cert 4.2.2"};
- chain_t chain424 = {"cert_4.2.1", "cert 4.2.3", "cert 4.2.2"};
- chain_t chain425 = {"cert 4.2.3", "cert 4.2.2", "cert_4.2.1"};
- chain_t chain426 = {"cert 4.2.2", "cert_4.2.1", "cert 4.2.3"};
chain_t chain43 = {"cert_4.3.1"};
app_t app5("app_3", "pkg_1", 5003, {chain411, chain421, chain43});
- app_t app6("app_3", "pkg_1", 5003, {chain411, chain422, chain43});
- app_t app7("app_3", "pkg_1", 5003, {chain411, chain423, chain43});
- app_t app8("app_3", "pkg_1", 5003, {chain411, chain424, chain43});
- app_t app9("app_3", "pkg_1", 5003, {chain411, chain425, chain43});
- app_t app10("app_3", "pkg_1", 5003, {chain411, chain426, chain43});
- app_t app11("app_3", "pkg_1", 5003, {chain412, chain421, chain43});
- app_t app12("app_3", "pkg_1", 5003, {chain412, chain422, chain43});
- app_t app13("app_3", "pkg_1", 5003, {chain412, chain423, chain43});
- app_t app14("app_3", "pkg_1", 5003, {chain412, chain424, chain43});
- app_t app15("app_3", "pkg_1", 5003, {chain412, chain425, chain43});
- app_t app16("app_3", "pkg_1", 5003, {chain412, chain426, chain43});
+ app_t app6("app_3", "pkg_1", 5003, {chain421, chain411, chain43});
+ app_t app7("app_3", "pkg_1", 5003, {chain411, chain43, chain421});
+ app_t app8("app_3", "pkg_1", 5003, {chain421, chain43, chain411});
+ app_t app9("app_3", "pkg_1", 5003, {chain43, chain411, chain421});
+ app_t app10("app_3", "pkg_1", 5003, {chain43, chain421, chain411});
sort(app1);
sort(app2);
@@ -71,12 +59,6 @@ BOOST_AUTO_TEST_CASE(App_positive) {
sort(app8);
sort(app9);
sort(app10);
- sort(app11);
- sort(app12);
- sort(app13);
- sort(app14);
- sort(app15);
- sort(app16);
BOOST_REQUIRE(app1 == app2);
@@ -87,13 +69,6 @@ BOOST_AUTO_TEST_CASE(App_positive) {
BOOST_REQUIRE(app7 == app8);
BOOST_REQUIRE(app8 == app9);
BOOST_REQUIRE(app9 == app10);
- BOOST_REQUIRE(app10 == app11);
- BOOST_REQUIRE(app11 == app12);
- BOOST_REQUIRE(app12 == app13);
- BOOST_REQUIRE(app13 == app14);
- BOOST_REQUIRE(app14 == app15);
- BOOST_REQUIRE(app15 == app16);
- BOOST_REQUIRE(app16 == app5);
}
BOOST_AUTO_TEST_CASE(App_negative) {
@@ -104,14 +79,19 @@ BOOST_AUTO_TEST_CASE(App_negative) {
app_t app4("app_2", "pkg_2", 5002, {{"aaaaaa"}});
chain_t chain411 = {"cert_4.1", "cert 4.2"};
- chain_t chain412 = {"cert_4.1"};
+ chain_t chain412 = {"cert 4.2", "cert_4.1"};
chain_t chain421 = {"cert_4.2.1", "cert 4.2.2", "cert 4.2.3"};
- chain_t chain422 = {"" "cert 4.2.3", "cert_4.2.1"};
- chain_t chain423 = {"cert", "cert_4.2.1", "cert 4.2.2"};
- chain_t chain424 = {"cert_4.2.1", " ", "cert 4.2.2"};
- chain_t chain425 = {"cert 4.2.3", "cert 4.2.2"};
- chain_t chain426 = {"cert 4.2", "cert_4.2", "cert 4.2"};
+ chain_t chain422 = {"cert_4.2.1", "cert 4.2.3", "cert_4.2.2"};
+ chain_t chain423 = {"cert_4.2.3", "cert 4.2.1", "cert_4.2.2"};
+ chain_t chain424 = {"cert_4.2.3", "cert 4.2.2", "cert_4.2.1"};
+ chain_t chain425 = {"cert_4.2.2", "cert 4.2.1", "cert_4.2.3"};
+ chain_t chain426 = {"cert_4.2.2", "cert 4.2.3", "cert_4.2.1"};
+
+ chain_t chain427 = {"cert", "cert_4.2.1", "cert 4.2.2"};
+ chain_t chain428 = {"cert_4.2.1", " ", "cert 4.2.2"};
+ chain_t chain429 = {"cert 4.2.3", "cert 4.2.2"};
+ chain_t chain420 = {"cert 4.2" , "cert_4.2" , "cert 4.2" };
chain_t chain43 = {"cert_4.3.1"};
@@ -128,26 +108,27 @@ BOOST_AUTO_TEST_CASE(App_negative) {
app_t app15("app_3", "pkg_1", 5003, {chain412, chain425, chain43});
app_t app16("app_3", "pkg_1", 5003, {chain412, chain426, chain43});
- app_t apps[12] = {app5, app6, app7, app8, app9, app10, app11, app12, app13, app14, app15, app16};
-
- sort(app1);
- sort(app2);
- sort(app3);
- sort(app4);
-
- for (int i=0; i<12; i++) {
+ app_t app17("app_3", "pkg_1", 5003, {chain421});
+ app_t app18("app_3", "pkg_1", 5003, {chain422});
+ app_t app19("app_3", "pkg_1", 5003, {chain423});
+ app_t app20("app_3", "pkg_1", 5003, {chain424});
+ app_t app21("app_3", "pkg_1", 5003, {chain425});
+ app_t app22("app_3", "pkg_1", 5003, {chain426});
+ app_t app23("app_3", "pkg_1", 5003, {chain427});
+ app_t app24("app_3", "pkg_1", 5003, {chain428});
+ app_t app25("app_3", "pkg_1", 5003, {chain429});
+ app_t app26("app_3", "pkg_1", 5003, {chain420});
+
+ app_t apps[26] = {app1, app2, app3, app4, app5, app6, app7, app8,
+ app9, app10, app11, app12, app13, app14, app15, app16, app17,
+ app18, app19, app20, app21, app22, app23, app24, app25, app26};
+
+ for (int i=0; i<26; i++) {
sort(apps[i]);
}
- BOOST_REQUIRE(app1 != app2);
- BOOST_REQUIRE(app1 != app3);
- BOOST_REQUIRE(app1 != app4);
- BOOST_REQUIRE(app2 != app3);
- BOOST_REQUIRE(app2 != app4);
- BOOST_REQUIRE(app3 != app4);
-
- for (int i=0; i<12; i++) {
- for (int j=0; j<12; j++) {
+ for (int i=0; i<26; i++) {
+ for (int j=0; j<26; j++) {
if (i != j)
BOOST_REQUIRE(apps[i] != apps[j]);
else
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()
diff --git a/tests/test_db.cpp b/tests/test_db.cpp
index 066e895..95267e5 100644
--- a/tests/test_db.cpp
+++ b/tests/test_db.cpp
@@ -127,16 +127,15 @@ BOOST_AUTO_TEST_CASE(DB_app_positive) {
app2.verified = app_t::verified_t::NO;
app3.verified = app_t::verified_t::YES;
- sort(app1);
- sort(app2);
- sort(app3);
- sort(app4);
+
std::list<app_t> buffer_ok = {app1, app2, app3, app4};
get_app_list(buffer);
- buffer.sort();
- buffer_ok.sort();
+ // Need to sort buffer
+ sort_buffer(buffer);
+ sort_buffer(buffer_ok);
+
BOOST_REQUIRE(buffer_ok == buffer);
}
@@ -173,17 +172,14 @@ BOOST_AUTO_TEST_CASE(DB_app_negative) {
app2.verified = app_t::verified_t::NO;
app3.verified = app_t::verified_t::YES;
- sort(app1);
- sort(app2);
- sort(app3);
- sort(app4);
+
std::list<app_t> buffer_ok = {app1, app2, app3, app4};
get_app_list(buffer);
// list has to be sorted before comparison.
- buffer.sort();
- buffer_ok.sort();
+ sort_buffer(buffer);
+ sort_buffer(buffer_ok);
BOOST_REQUIRE(buffer_ok != buffer);
}