aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorKai Michaelis <[email protected]>2016-09-21 13:36:58 +0200
committerseu <[email protected]>2016-10-02 18:10:43 +0200
commit6c8998cb853605f17cebb76dd61496b05941d04f (patch)
tree18df06d9c4895846cb32960f17b62f392c930abf /src/tests
parentcc5bca63e7e7b4ae1650e9f468e3c1a00623579f (diff)
certstore tests
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/data/certstor/cert1.crt17
-rw-r--r--src/tests/data/certstor/cert2.crt17
-rw-r--r--src/tests/data/certstor/cert3.crt17
-rw-r--r--src/tests/data/certstor/cert4.crt17
-rw-r--r--src/tests/data/certstor/cert5a.crt17
-rw-r--r--src/tests/data/certstor/cert5b.crt17
-rw-r--r--src/tests/data/certstor/key01.pem28
-rw-r--r--src/tests/data/certstor/key03.pem28
-rw-r--r--src/tests/data/certstor/key04.pem28
-rw-r--r--src/tests/data/certstor/key05.pem28
-rw-r--r--src/tests/data/certstor/key06.pem28
-rw-r--r--src/tests/test_certstor.cpp236
12 files changed, 478 insertions, 0 deletions
diff --git a/src/tests/data/certstor/cert1.crt b/src/tests/data/certstor/cert1.crt
new file mode 100644
index 000000000..f94996195
--- /dev/null
+++ b/src/tests/data/certstor/cert1.crt
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvjCCAaagAwIBAgIBATANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVjZXJ0
+MTAgFw0xNjA4MjUxMzQ2MDBaGA8yMDk2MDgyNTEzNDYwMFowEDEOMAwGA1UEAxMF
+Y2VydDEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDc8LorF3s8LuOi
+M6odFrxwz3g5ou53DH7VHmxRUbxfweB+/IqTDtdX+vkodWJs7asqiR4M3jxyjJRV
+HcvIoUiNRF8oIXrshKyWNRtzlgVQnxKcwYu4SGgzx4anUYNMdL5av172CFdzh0lg
+84oXgfx+EdRw9F2CZpWpH26mklx0OqqOQJQOyZzbFe1fJG5hwD6CL+Gcva/KqS6p
+2p0CCJaeRdwhuYxJIGjxkqYj6npChnz3QaWXkytcHR2+4RsSYs6Yh/FEtGeoBCQu
+kzrUgzbiQ/lrmJyW1nxb7lyTHA4J+D1aZ0pjX57N2nqaOY8288O5w/wLR3KMyctJ
+XBiJq0NDAgMBAAGjITAfMB0GA1UdDgQWBBQPl0HKiP7UeJp44xZwTbZHC4BvhzAN
+BgkqhkiG9w0BAQUFAAOCAQEACMl5HRIbx33M15hjQ7tcaXerja6qOMOe8JN3o36a
+6w8V8dqQMqGWuyUBtX4kNLvrleWwC/6soltTT1Y9D0uw2lM37pXTsI3UL4b4bGX+
+WPNVT2Gowdd9eqpn795u9EErGXi2bn7IoIiKAvzHI+eDChFR5OHxulj6b4FTGa9s
+G/V0RNuTx2wvB4v5XQjWhK6Cy1V8giI2X0HiGvbu9I5lo01lj523m6G1lIXU5zmX
++8dNxEfrVqk7RT3Y65QnrrUjhxZlNL6vh3z+JDlQqGi0y/RsDnXVXbH1C4wBawr9
+P7248MakA6ehPikut/4+tZic+1myb0arDKVhEeht4C0KTQ==
+-----END CERTIFICATE-----
diff --git a/src/tests/data/certstor/cert2.crt b/src/tests/data/certstor/cert2.crt
new file mode 100644
index 000000000..d80c024fc
--- /dev/null
+++ b/src/tests/data/certstor/cert2.crt
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvjCCAaagAwIBAgIBATANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVjZXJ0
+MjAgFw0xNjA4MjUxMzQ3MDBaGA8yMDk2MDgyNTEzNDcwMFowEDEOMAwGA1UEAxMF
+Y2VydDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDc8LorF3s8LuOi
+M6odFrxwz3g5ou53DH7VHmxRUbxfweB+/IqTDtdX+vkodWJs7asqiR4M3jxyjJRV
+HcvIoUiNRF8oIXrshKyWNRtzlgVQnxKcwYu4SGgzx4anUYNMdL5av172CFdzh0lg
+84oXgfx+EdRw9F2CZpWpH26mklx0OqqOQJQOyZzbFe1fJG5hwD6CL+Gcva/KqS6p
+2p0CCJaeRdwhuYxJIGjxkqYj6npChnz3QaWXkytcHR2+4RsSYs6Yh/FEtGeoBCQu
+kzrUgzbiQ/lrmJyW1nxb7lyTHA4J+D1aZ0pjX57N2nqaOY8288O5w/wLR3KMyctJ
+XBiJq0NDAgMBAAGjITAfMB0GA1UdDgQWBBQPl0HKiP7UeJp44xZwTbZHC4BvhzAN
+BgkqhkiG9w0BAQUFAAOCAQEA0Hdd2iHHBuCfJntTMe3M1H6wGKLqjozD/11yIS7k
+Fvu42gke5PE9zI2O3wgDeFeyer7OkA1KI1KK08w33kZBICqKdwXAFH9RYLwM8hUB
+z1zM1nQwVfQlTl8yi2LptD7o5oPZ1dgBetn2eOCKCguC0rAS567JdivD/mxzXorH
+DJTXN8EtZH0yJH6AjFarMobVNGyy6eSwNKCK9nKPrkElTktW5UajkXe9NErMaU7f
+4KmJArN4PsJjj6Qx2Z6/pj2gS3A7IMbbG2jDK2tAlgrQkCEoVLY3+toov5II542k
+ZNej7/z5X9Fcft+/o/+ILufK9H2uAQWHmL4zzHXefjTH6g==
+-----END CERTIFICATE-----
diff --git a/src/tests/data/certstor/cert3.crt b/src/tests/data/certstor/cert3.crt
new file mode 100644
index 000000000..f77834c82
--- /dev/null
+++ b/src/tests/data/certstor/cert3.crt
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvjCCAaagAwIBAgIBATANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVjZXJ0
+MzAgFw0xNjA4MjUxMzQ3MDBaGA8yMDk2MDgyNTEzNDcwMFowEDEOMAwGA1UEAxMF
+Y2VydDMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDBvhpDLopDxvrn
+Uo/zN4dEz39wfIepWno0soJBfvV2EuDTp4S89r0Q0dUeThKYlOlyTk3IR5QmcnoG
+7XD9+J+CXvcJI3X2h6uKL+f+2XL9tmSoVmw1u7QXK23cKkhpYIszkh/OK2gY9vfx
+0Tudt0lc8Bxa4iK2lnZwbd6kcQJbWSX4gcF1Hxdfp9mrGg+/f623GW+RAnQVaC50
+HvBLFuWxNaLbcOD0vSkLRutkiI9t9Ng3G7ADJ5xuHY6W68BmEG9DDfKO3Y5kfhIz
+mE/q4X9PcbpBAemzWX0YtNzh6aNqhOw/eKmApC0NbeVurZxYHVnRprO+/X/9WK5D
+i5K3E651AgMBAAGjITAfMB0GA1UdDgQWBBRo9BOhV2RYDu9UhucTMvIkp/ungTAN
+BgkqhkiG9w0BAQUFAAOCAQEAo7AW86pfkFJt9dRn0uF2evp/vaMEt0LjPfxlYlWd
+UgO6OS+s139HPujd+LwmyDN17d99KDb/EjLgdlXm0rnkMMTH9aAaXwoskxNP81vL
+ol+f5bAo/uHGLf00K4WhvJ8pS/94AhZmoo6hzEVqLuZCt7q2ugrQdxPhLxfrnPWm
+IovZxXOmViVYiqU88QVepTbRYF8QByQg2vFiXA9/rGnIKL2UDwci7rBO4mTheGyD
+GotaVth7XAN4t61JVnjHbClxBMgxILR74arkbzTesEYvcLozXfPNriXZfqbHDBTC
+AISmmx4Hh2G3+NC0Q2qqKQPpiKZKSahTMgb0Bja+Kaqb6w==
+-----END CERTIFICATE-----
diff --git a/src/tests/data/certstor/cert4.crt b/src/tests/data/certstor/cert4.crt
new file mode 100644
index 000000000..31a0bc27c
--- /dev/null
+++ b/src/tests/data/certstor/cert4.crt
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvjCCAaagAwIBAgIBATANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVjZXJ0
+NDAgFw0xNjA4MjUxMzQ4MDBaGA8yMDk2MDgyNTEzNDgwMFowEDEOMAwGA1UEAxMF
+Y2VydDQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQD72rrxGisXsflB
+yHtIZI4iNHc7Lbgu0CzxsksgzEYzrRNeW/6I8imu47tfZjY1f+XR6sEtROPwZ9vW
+Pqj366SGpYst+FHtmz7k8Wb5JeI0KAsr0JYyIPgMPDSTqpLIRFrMwhsFLo0tR5b6
+/oT8oSNSX+3jQlcwGJWrIQlIkrYzHxvkXiNBcikqTne9+zrAgVobjEvbeedvM+9n
+A9JUgScOQjnJ6YDiGaZ+0n6OzYF7duGHTKTlb/+3bJpbrOlgDrkCgZMMIUaAqDra
+2w8pArUI9sAVex6djUjavI9WzcjX7okjhqbru+TtXEL4FeUF5hAPRi8k02axwuBq
+9jGBRpRhAgMBAAGjITAfMB0GA1UdDgQWBBTW4dmVCqZjKmKS06pvbiAPeCXbdzAN
+BgkqhkiG9w0BAQUFAAOCAQEABcOEZ4gfcNLfYc5l0rRkie1OIOHQas4gIYXLLAxM
+Jh/gV730yR67NLUm1O/99St7GWLzuNpI7EgXhWA5HvaVCUUc92wxmyzrzZl1OmD8
+bAKHVtLUsL5dPgiK0zeJmiN03v2DjME/yLinbN4DtjDtzBFS7+vFCFPnrys2Mw5L
+JtSIfuDKF7f3FWuwsnTSNogG78hYVFQ/DA5YfftI3cPUO4eLLZazRCL3wpKJ6uE6
+2npn2S7e4kgMtstGydLaO19AyuMTG9+TLn+04h5yWdoIrmyAXsJZoFPn76d+8Mc8
+St04VY1xDjwZfxi83Wnywb6BMbW8BEHvfnOvC3K1YmcNww==
+-----END CERTIFICATE-----
diff --git a/src/tests/data/certstor/cert5a.crt b/src/tests/data/certstor/cert5a.crt
new file mode 100644
index 000000000..5a72e123a
--- /dev/null
+++ b/src/tests/data/certstor/cert5a.crt
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvjCCAaagAwIBAgIBATANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVjZXJ0
+NTAgFw0xNjA4MjUxMzQ4MDBaGA8yMDk2MDgyNTEzNDgwMFowEDEOMAwGA1UEAxMF
+Y2VydDUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCmAHBoCnzfzQmG
+evf6RDAdAy8Am2xcM70IxPHs2ZJV7kpswz0IH3dQqprHDAKLTnduG4YmeyHXf0JL
+hIIc49mwoXpc+c/brNHDdJBC/B7AF1gb8l9wkLCQEl1FyOJn3CnAuVuXwub/o48f
+zZQNJ10oGFKXwYHWCe9g8CGScDoRbD6p7+4xx7/k6ukD5EY9W8UoiXTuCkqGhi0z
+lbGCxpkHE4lwRMeAKCY1rhXhH3ue0tXe0/RTrR9rYKs4rjt3rBGcFNGELRhWd261
+2/SMN1fCfKK/N2PQZm0O3pnZ7dP/JaQ7phIqVQxts0gDehoA16u7qGgJzwEkJECC
+tFCLxU/PAgMBAAGjITAfMB0GA1UdDgQWBBTkMbO1+qNf/EfUGdkQ8oxq3T99HjAN
+BgkqhkiG9w0BAQUFAAOCAQEAVjOXcX2qbo7YaEYECIL0u35qc8L1qpovA0wpNjFN
+AzF+NbidJJfYAiFCkJgyE1Hl+ycsE2sxfWUky4Hv+ZWQDWb0yEqanbcrsfIHdReP
+40MQCvnJFGZ4N9lBqRUA6y3dc7FY61syamz9uemctq0FVfnXpCKtneje5xIBd0Hq
+fbkSb+yqfheQ/Nlou2iU/7gBC63Lm5D5lGQASS/acJN0jBQQY18mq/TPH9aFyzuj
+9U73anXRLqIJJsbc1OBQmQP3S7ozMKpYy5VIHJ0glE1xPWImIAQDVES64whjr93Y
+Nz8T9lwyby3D+vQtR9oWxA3aIPEKmcVPeFHA9b+fA+D1tw==
+-----END CERTIFICATE-----
diff --git a/src/tests/data/certstor/cert5b.crt b/src/tests/data/certstor/cert5b.crt
new file mode 100644
index 000000000..f766c17b2
--- /dev/null
+++ b/src/tests/data/certstor/cert5b.crt
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICvjCCAaagAwIBAgIBATANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVjZXJ0
+NTAgFw0xNjA4MjUxMzQ5MDBaGA8yMDk2MDgyNTEzNDkwMFowEDEOMAwGA1UEAxMF
+Y2VydDUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9dh63j9uRBb7m
+Axz65SrG94zowLFFkVm35Bbp+POwTGXWQFuQybXSJm+ltU8gI86UmRn0w30Vo0RF
+GHMfwq4W1tJ/Oxydduk8/QZxBSP91MKFfk7cDjJbPvXhqNEQI7EhRHuBTKk+27Aq
+zugEsSNVxOPReSA7dOOiX37hxV1sDU1fzEDg0U2P/VTGA+T0FQ5dfwI4CMUyCB9b
+WuFTgwPDmutV6eANlmEhvRvIzMUeYxrTTtgjOsKYKkbbZfBis09uMZ3xjLBDfsK/
+Uel5xNSEreh+/vhgURsYWsTFNO8NgJELy7mmRaX9hmz1lNwnNo6PMLF9vWh+Nulq
+2dBkQi3ZAgMBAAGjITAfMB0GA1UdDgQWBBSwyEY1ySgpquTbrMaFPHgbabe0RjAN
+BgkqhkiG9w0BAQUFAAOCAQEAO44gBp8zORkGbm4o+U0AGY8/lHkg4EuAloZp+o1z
+y3J17DSK2nTjzkM3ot4inc84eeQ3EXkcu3lNqii6xblORQGvAIyGC287cueY/e4R
+S7OfPo5GfmFXSsv31doKc53H1BHOXprqoHAp4Vo0V/nRzCWFQ10MoYiCdP5fZeMY
+W83/YTnElGLcnXXFdKIWaCHT13phYXpefYtGIv/NY+dyBzqwxusK5qUPomLbt1Qr
+UGCsGj46oqya+zKq2H+7gIu6xn+PEKqcH5ZYpMONNuoqE68gq7qlpKuRFvkJ0CYx
+LYvsZV9jmFl15ZDqlIXibXRQPI0lwJGQRaUQhYEZ7CG4zQ==
+-----END CERTIFICATE-----
diff --git a/src/tests/data/certstor/key01.pem b/src/tests/data/certstor/key01.pem
new file mode 100644
index 000000000..b77b9f3d9
--- /dev/null
+++ b/src/tests/data/certstor/key01.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkA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+soPxOCr4pv0CgYEAhrLwpLrnPrLmLUxtmMIW4ZFveYhbzqpBtcvyT3POy0PQUmxf
+KAvD+5neQG2EFSBT2h8bM73U+zRoFofMtwXAx3pAW0sCKwCFXwfm4/XLiF/67dOi
+FPu3BqYBfFF/2tWrBWJe0QPDRY2+e9ROilEzTlBkjWHfFhrpXQLd0WrKBB8CgYBA
+WuGrNY+9G+xfYhKU6eHfis1dgbHKM3ohZ+3hj/ka53NZOpQYFfii5wRou4hUs+ee
+sIbtkDFj0DcFBGOxVZQebjLXY8r+eLgNMz5kVqvAh5UvbMlDNzmCO2MY1RkMm3HF
+nhidzjonIexh+0iBIWKSA3GhPE7Cx5M0dFND7xCoIQKBgHZ4W0HHhYLTAxaUlp3F
+afRTMJhhn4w1N3uzEtNa96VEq3dUwD/Fr/7eLg9Ap/eCrVnJkmR1qHhs+KI397CK
+L+bL9nXEDZZRQV2Ch2EV+6ruU5vV3MvfH9MOg3a9phj25bSAMdQMIXSB0rBee9ss
+aCEgxxyjdAsdN4ESs8q3duJF
+-----END PRIVATE KEY-----
diff --git a/src/tests/data/certstor/key03.pem b/src/tests/data/certstor/key03.pem
new file mode 100644
index 000000000..c7cc94801
--- /dev/null
+++ b/src/tests/data/certstor/key03.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDBvhpDLopDxvrn
+Uo/zN4dEz39wfIepWno0soJBfvV2EuDTp4S89r0Q0dUeThKYlOlyTk3IR5QmcnoG
+7XD9+J+CXvcJI3X2h6uKL+f+2XL9tmSoVmw1u7QXK23cKkhpYIszkh/OK2gY9vfx
+0Tudt0lc8Bxa4iK2lnZwbd6kcQJbWSX4gcF1Hxdfp9mrGg+/f623GW+RAnQVaC50
+HvBLFuWxNaLbcOD0vSkLRutkiI9t9Ng3G7ADJ5xuHY6W68BmEG9DDfKO3Y5kfhIz
+mE/q4X9PcbpBAemzWX0YtNzh6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N/xgXYT50wCyc0BGl0FYmUAi
+PJ8WmGFaZg4/+tuj1Hgu3SHVrAK2ZCfP1aL967mg2wKBgDAGXaweI/CSzO9AhuTV
+QhZy5eDgcjm2SJICqNJ2Welt3JyTz7zgxkgShPT0gXTADqfj5WmJ6edbYhSDfC6p
+VAQlfixcogRX1Uxb3GhHCM85r6huOv71L9vX6tVo7ggUGN3rysRPAkf4mk8Cx4F+
+gUid5rlxYk2QhKirTaM1KZH6
+-----END PRIVATE KEY-----
diff --git a/src/tests/data/certstor/key04.pem b/src/tests/data/certstor/key04.pem
new file mode 100644
index 000000000..f148a1d72
--- /dev/null
+++ b/src/tests/data/certstor/key04.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD72rrxGisXsflB
+yHtIZI4iNHc7Lbgu0CzxsksgzEYzrRNeW/6I8imu47tfZjY1f+XR6sEtROPwZ9vW
+Pqj366SGpYst+FHtmz7k8Wb5JeI0KAsr0JYyIPgMPDSTqpLIRFrMwhsFLo0tR5b6
+/oT8oSNSX+3jQlcwGJWrIQlIkrYzHxvkXiNBcikqTne9+zrAgVobjEvbeedvM+9n
+A9JUgScOQjnJ6YDiGaZ+0n6OzYF7duGHTKTlb/+3bJpbrOlgDrkCgZMMIUaAqDra
+2w8pArUI9sAVex6djUjavI9WzcjX7okjhqbru+TtXEL4FeUF5hAPRi8k02axwuBq
+9jGBRpRhAgMBAAECggEASRulSHegKrCu+jmID+uglq1ELxmGbZBge4iV5l9lwXps
+NOffa0FgeDQDIB47fiwyOk065jkpMY/0cKyfv9fXWn6TeDStE5wNFcg9a/VjRGCb
+XYyfDM4lMugHGxZYpWmyMd3mmgp5ULuHSDS5xdvAtRjDpUSMqpl4WMSuPTLZUN0T
+gGpuyOFT5xF+BaQS/9Ech8Jk/FyWHCBn9Z4GE1u/DefEgA20jIcFLGVTGuIpx6J8
+HxuthrH9F4a1fFWO3tFwbES+XmGwNhAuMzSUvDJjUwTy6+g/YoKS2DreZFdYmHQD
+2tah5gHixyD2cmoJ2uJeASloXZKUUK6KAh/44OCfAQKBgQD/T0Hx19kEUJ7Po52R
+6fL6LmD00p2cYy4mzYpAZZqJCotyLrkfqx0u54zFmVgqsgjeng+121IRshZ6RV2K
+8fGCeQRkB+1XKIEHoCSaOVCpiDPU8i6nD4fDfPSHhgMLkdcWEVbLWDbCI+cbujjg
+aRjsWZ20RvRZaJ5grpFXv6vHtQKBgQD8iRSrBC/m8bpafxnv1kkYUz1BFwy0Nv8N
+2OjxFI4X9rQp5XCx0TSjrtCaKsiZnY6v/xgpWxQwo1ITILYihBI+GolQIbL8KJCk
+potJ3UxtLfjhcANTdCiLP+JslwMw5XbhUtpsvQX8jmnGTt220ghx0YxcoTkGWh0I
+4KWCi6ZtfQKBgH/n9DC2I5oezcFWxf0xCLLAA4ED90Q/CAMWnDmw7V/UsZHNyJ8N
++fvis0rXjS0urnThGRvRueb1on81Oyz+EzF7cXCv6/7rYuEwIMZHCps0iksX3bmC
+dVDBzDwNLn9gXDJJE4OiOSTAGetxO0dqP7tBFloX5hjY6eej7VrZwrS1AoGBAJOk
+4XyK2ia/tSArp1Jdiia6o9lmTHsgnEXQR4CLb/f6uKK2DgkoMwpvrm40DUwincWv
+8sRbB5bYJaghO9s6NCAzC4zZ5vceEFLzPARXadN7SUMkZg1ooDupggvSzn7L6ZEb
+C7D/YnyiFp1mhqHYci95QAL4D4rzLH6AOMP2ObtRAoGAJWRKgEX8vo1/chkcWYr7
+l4NNedCOHPceKnWa36Rg9J2ZMMZSVEEsjWluHylpwayMc5E98jEy5thNxm15Bnr8
+IUwMngDhrDreoPeoKXCgH/il0T5EKloOdXwYTARw+3gRM/lIJOYHfegjqQxzwsyI
+mlBDlfWh+LtgbCuIsgqCyEo=
+-----END PRIVATE KEY-----
diff --git a/src/tests/data/certstor/key05.pem b/src/tests/data/certstor/key05.pem
new file mode 100644
index 000000000..75a5b7a0e
---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89E8N9pmHWPO9cgzYgmQOQoDtURtegwR+zzC
+EK9a/PGpkpfWkuGYAf1DKwG0c9L2WYAwvUxxm5j6tv0Ok2iHkRYruLLoHHzeJic8
+Y0F0BA6mYQKBgQDKq36BA85iHJZadWS6l/ng6FsiiPSTF8u9pseHUmTCJjrha+3n
+wjA6UOv/ifAO0Dn+C64fVMefaoU+28uNOc4+k6qragkVTOaIg6Gin7/+Q0uUGVKZ
+LVmYLpBxvU1m1zU81mYv/gQKELiB0rDTOjRt0QBifWvGQqL9ulmIgraJ9wKBgQCL
+MkwHhuxHEIuHn2hMWA0InVOh0E9lQDRlJDhg2emhbtY8yF0C9uqCcrZjz89DkMhJ
+Rd8z/oJEhp3CZoBXyjHPpAbhsPKnX/jVYlClxxtcxQ+4R6sC3DvpC7I87Jod/D+D
+Up9YkOepqGhcpcOVvKUcsDbqENUg3f6gZW0rz6+XgQKBgQCJEWS+y0aSEalRDhVw
+xcIWtEVle9I4wuzuOCKSGzIkWiV0KSzDmLEsfFHQ/F7k09kvBmrIjRQuIm6e3PaK
+vffCp8DG/ctabF4RtQHWhnjFVxkPdm4EZSP7SFodi2aA+MNmUw5f7BnoZR7wCaZp
+25u8dPwvYEfjC3bFY+fdpKPwdg==
+-----END PRIVATE KEY-----
diff --git a/src/tests/data/certstor/key06.pem b/src/tests/data/certstor/key06.pem
new file mode 100644
index 000000000..63006d613
--- /dev/null
+++ b/src/tests/data/certstor/key06.pem
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC9dh63j9uRBb7m
+Axz65SrG94zowLFFkVm35Bbp+POwTGXWQFuQybXSJm+ltU8gI86UmRn0w30Vo0RF
+GHMfwq4W1tJ/Oxydduk8/QZxBSP91MKFfk7cDjJbPvXhqNEQI7EhRHuBTKk+27Aq
+zugEsSNVxOPReSA7dOOiX37hxV1sDU1fzEDg0U2P/VTGA+T0FQ5dfwI4CMUy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As06c9FqOqG2rKGw64a7cV/iiYyZwwqm4rDl3RsOGYvjs1M6g
+WtWPfYxcjhJnmJ/g9fbuySJ+Rq0E4zmi1WQPOpedDjjpAhN8PaebuThCelhWOnBr
+tMowRmDJytQXQulWsOZfiRVGNtIJbukRq7vsMVOVAoGAeEBXbWHKeGc8Qy7NRFVx
+9ZsSiPwk3PSYeRRcvRuHuQxN3PE196oP0AAG2F7k8gJmKHon4K1cEZ4VJjTpFN3P
+RB3SWcwAIKuzeDU89Zs5UTJ8nHQYdxZK/RmUsCWpqcxHK+cpo/c2TrOdgPuF+sbK
+PZ3qHGP8C1j5q/3xWjM2puA=
+-----END PRIVATE KEY-----
diff --git a/src/tests/test_certstor.cpp b/src/tests/test_certstor.cpp
new file mode 100644
index 000000000..02865c72c
--- /dev/null
+++ b/src/tests/test_certstor.cpp
@@ -0,0 +1,236 @@
+/*
+* (C) 2016 Kai Michaelis, Rohde & Schwarz Cybersecurity
+*
+* Botan is released under the Simplified BSD License (see license.txt)
+*/
+
+#include "tests.h"
+
+#if defined(BOTAN_HAS_CERTSTOR_SQLITE3)
+ #include <botan/certstor_sqlite.h>
+ #include <botan/sqlite3.h>
+ #include <botan/internal/filesystem.h>
+ #include <botan/pkcs8.h>
+ #include <botan/auto_rng.h>
+#endif
+
+#include <iostream>
+
+namespace Botan_Tests {
+
+namespace {
+
+#if defined(BOTAN_HAS_CERTSTOR_SQLITE3)
+
+Test::Result test_certstor_insert_find_remove_test(
+ const std::vector<std::pair<Botan::X509_Certificate,std::shared_ptr<Botan::Private_Key>>>& certs,
+ Botan::Certificate_Store_In_SQL& store)
+ {
+ Test::Result result("Certificate Store - Insert, Find, Remove");
+
+ for(auto cert_key: certs)
+ {
+ auto cert = cert_key.first;
+ auto key = cert_key.second;
+ auto wo_keyid = store.find_cert(cert.subject_dn(),{});
+ auto w_keyid = store.find_cert(cert.subject_dn(),cert.subject_key_id());
+
+ if(!wo_keyid || !w_keyid)
+ {
+ result.test_failure("Can't retrieve certificate");
+ return result;
+ }
+
+ auto priv = store.find_key(cert);
+ if(!priv && (certs[1] != cert_key && certs[0] != cert_key))
+ {
+ result.test_failure("Can't retrieve private key for " + cert.fingerprint("SHA1"));
+ return result;
+ }
+
+ result.test_eq("Got wrong certificate",cert.fingerprint(),w_keyid->fingerprint());
+
+ if(priv)
+ {
+ result.test_eq("Got wrong private key",key->pkcs8_private_key(),priv->pkcs8_private_key());
+ }
+
+ if(certs[4] != cert_key && certs[5] != cert_key)
+ {
+ result.test_eq("Got wrong certificate",cert.fingerprint(),wo_keyid->fingerprint());
+ }
+
+ result.test_eq("Can't remove certificate",store.remove_cert(cert),true);
+ result.test_eq("Can't remove certificate",!store.find_cert(cert.subject_dn(),cert.subject_key_id()),true);
+
+ if(priv)
+ {
+ store.remove_key(*key);
+ }
+
+ result.test_eq("Can't remove key",!store.find_key(cert),true);
+ }
+
+ return result;
+ }
+
+Test::Result test_certstor_crl_test(
+ const std::vector<std::pair<Botan::X509_Certificate,std::shared_ptr<Botan::Private_Key>>>& certs,
+ Botan::Certificate_Store_In_SQL& store)
+ {
+ Test::Result result("Certificate Store - CRL");
+
+ store.revoke_cert(certs[0].first,Botan::CA_COMPROMISE);
+ store.revoke_cert(certs[3].first,Botan::CA_COMPROMISE);
+ store.revoke_cert(certs[3].first,Botan::CA_COMPROMISE);
+
+ {
+ auto crls = store.generate_crls();
+
+ result.test_eq("Can't revoke certificate",crls.size(),2);
+ result.test_eq("Can't revoke certificate",crls[0].is_revoked(certs[0].first) ^ crls[1].is_revoked(certs[0].first),true);
+ result.test_eq("Can't revoke certificate",crls[0].is_revoked(certs[3].first) ^ crls[1].is_revoked(certs[3].first),true);
+ }
+
+ store.affirm_cert(certs[3].first);
+
+ {
+ auto crls = store.generate_crls();
+
+ result.test_eq("Can't revoke certificate, wrong crll size",crls.size(),1);
+ result.test_eq("Can't revoke certificate, cert 0 not revoked",crls[0].is_revoked(certs[0].first),true);
+ }
+
+ auto cert0_crl = store.find_crl_for(certs[0].first);
+
+ result.test_eq("Can't revoke certificate, crl for cert 0",!cert0_crl,false);
+ result.test_eq("Can't revoke certificate, crl for cert 0 size check",cert0_crl->get_revoked().size(),1);
+ result.test_eq("Can't revoke certificate, no crl for cert 0",cert0_crl->is_revoked(certs[0].first),true);
+
+ auto cert3_crl = store.find_crl_for(certs[3].first);
+
+ result.test_eq("Can't revoke certificate, crl for cert 3",!cert3_crl,true);
+
+ return result;
+ }
+
+Test::Result test_certstor_all_subjects_test(
+ const std::vector<std::pair<Botan::X509_Certificate,std::shared_ptr<Botan::Private_Key>>>& certs,
+ Botan::Certificate_Store_In_SQL& store)
+ {
+ Test::Result result("Certificate Store - All subjects");
+
+ auto subjects = store.all_subjects();
+
+ result.test_eq("Check subject list length",subjects.size(),6);
+
+ for(auto sub: subjects)
+ {
+ std::stringstream ss;
+
+ ss << sub;
+ result.test_eq("Check subject " + ss.str(),
+ certs[0].first.subject_dn() == sub ||
+ certs[1].first.subject_dn() == sub ||
+ certs[2].first.subject_dn() == sub ||
+ certs[3].first.subject_dn() == sub ||
+ certs[4].first.subject_dn() == sub ||
+ certs[5].first.subject_dn() == sub,true);
+
+ }
+ return result;
+ }
+
+class Certstor_Tests : public Test
+ {
+ public:
+ std::vector<Test::Result> run() override
+ {
+ const std::string test_dir = Test::data_dir() + "/certstor";
+ const std::vector<std::pair<std::string,std::string>> test_data({
+ std::make_pair("cert1.crt","key01.pem"),
+ std::make_pair("cert2.crt","key01.pem"),
+ std::make_pair("cert3.crt","key03.pem"),
+ std::make_pair("cert4.crt","key04.pem"),
+ std::make_pair("cert5a.crt","key05.pem"),
+ std::make_pair("cert5b.crt","key06.pem")
+ });
+
+ std::vector<Test::Result> results;
+ std::vector<std::pair<std::string,std::function<Test::Result(
+ const std::vector<std::pair<Botan::X509_Certificate,std::shared_ptr<Botan::Private_Key>>>&,
+ Botan::Certificate_Store_In_SQL&)>>>
+ fns({
+ std::make_pair("Certificate Store - Insert, Find, Remove",test_certstor_insert_find_remove_test),
+ std::make_pair("Certificate Store - CRL",test_certstor_crl_test),
+ std::make_pair("Certificate Store - All subjects",test_certstor_all_subjects_test)
+ });
+
+ try
+ {
+ // Do nothing, just test filesystem access
+ Botan::get_files_recursive(test_dir);
+ }
+ catch(Botan::No_Filesystem_Access&)
+ {
+ Test::Result result("Certificate Store");
+ result.test_note("Skipping due to missing filesystem access");
+ return {result};
+ }
+
+ const std::vector<std::string> all_files = Botan::get_files_recursive(test_dir);
+
+ if(all_files.empty())
+ {
+ Test::Result result("Certificate Store");
+ result.test_failure("No test files found in " + test_dir);
+ return {result};
+ }
+
+ for(auto fn: fns)
+ {
+ Test::Result result(fn.first);
+
+ try
+ {
+ Botan::Certificate_Store_In_SQLite store(fn.first + ".db","123");
+ std::vector<std::pair<Botan::X509_Certificate,std::shared_ptr<Botan::Private_Key>>> retrieve;
+
+ for(auto&& cert_key_pair : test_data)
+ {
+ Botan::X509_Certificate cert(test_dir + "/" + cert_key_pair.first);
+ Botan::AutoSeeded_RNG rng;
+ std::shared_ptr<Botan::Private_Key> key(Botan::PKCS8::load_key(test_dir + "/" + cert_key_pair.second,rng));
+
+ if(!key)
+ {
+ result.test_failure("Failed to load key from disk");
+ results.push_back(fn.second(retrieve,store));
+ continue;
+ }
+
+
+ store.insert_cert(cert);
+ store.insert_key(cert,*key);
+ retrieve.push_back(std::make_pair(cert,key));
+ }
+
+ results.push_back(fn.second(retrieve,store));
+ }
+ catch(std::exception& e)
+ {
+ results.push_back(Test::Result::Failure("Certstor test '" + fn.first + "'", e.what()));
+ }
+ }
+
+ return results;
+ }
+ };
+
+BOTAN_REGISTER_TEST("certstor", Certstor_Tests);
+
+#endif
+
+}
+
+}