Skip to content

Commit

Permalink
[auth] Use QGIS test certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Oct 17, 2017
1 parent 8b0f423 commit b1c45d5
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 227 deletions.
24 changes: 12 additions & 12 deletions tests/src/python/test_qgsauthsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,32 +563,32 @@ def test_100_auth_db(self):

def test_110_pkcs12_cas(self):
"""Test if CAs can be read from a pkcs12 bundle"""
path = PKIDATA + '/alice_w-chain.p12'
path = PKIDATA + '/fra_w-chain.p12'
cas = QgsAuthCertUtils.pkcs12BundleCas(path, 'password')

self.assertEqual(cas[0].issuerInfo(b'CN'), ['Boundless Test Root CA'])
self.assertEqual(cas[0].subjectInfo(b'CN'), ['Boundless Test Issuer CA'])
self.assertEqual(cas[0].issuerInfo(b'CN'), ['QGIS Test Root CA'])
self.assertEqual(cas[0].subjectInfo(b'CN'), ['QGIS Test Issuer CA'])
self.assertEqual(cas[0].serialNumber(), b'02')
self.assertEqual(cas[1].issuerInfo(b'CN'), ['Boundless Test Root CA'])
self.assertEqual(cas[1].subjectInfo(b'CN'), ['Boundless Test Root CA'])
self.assertEqual(cas[1].issuerInfo(b'CN'), ['QGIS Test Root CA'])
self.assertEqual(cas[1].subjectInfo(b'CN'), ['QGIS Test Root CA'])
self.assertEqual(cas[1].serialNumber(), b'01')

def test_120_pem_cas_from_file(self):
"""Test if CAs can be read from a pem bundle"""
path = PKIDATA + '/alice-cert_w-chain.pem'
path = PKIDATA + '/fra_w-chain.pem'
cas = QgsAuthCertUtils.casFromFile(path)

self.assertEqual(cas[0].issuerInfo(b'CN'), ['Boundless Test Root CA'])
self.assertEqual(cas[0].subjectInfo(b'CN'), ['Boundless Test Issuer CA'])
self.assertEqual(cas[0].issuerInfo(b'CN'), ['QGIS Test Root CA'])
self.assertEqual(cas[0].subjectInfo(b'CN'), ['QGIS Test Issuer CA'])
self.assertEqual(cas[0].serialNumber(), b'02')
self.assertEqual(cas[1].issuerInfo(b'CN'), ['Boundless Test Root CA'])
self.assertEqual(cas[1].subjectInfo(b'CN'), ['Boundless Test Root CA'])
self.assertEqual(cas[1].issuerInfo(b'CN'), ['QGIS Test Root CA'])
self.assertEqual(cas[1].subjectInfo(b'CN'), ['QGIS Test Root CA'])
self.assertEqual(cas[1].serialNumber(), b'01')

def test_130_cas_merge(self):
"""Test CAs merge """
trusted_path = PKIDATA + '/subissuer_ca_cert.pem'
extra_path = PKIDATA + '/alice-cert_w-chain.pem'
extra_path = PKIDATA + '/fra_w-chain.pem'

trusted = QgsAuthCertUtils.casFromFile(trusted_path)
extra = QgsAuthCertUtils.casFromFile(extra_path)
Expand All @@ -605,7 +605,7 @@ def test_130_cas_merge(self):

def test_140_cas_remove_self_signed(self):
"""Test CAs merge """
extra_path = PKIDATA + '/alice-cert_w-chain.pem'
extra_path = PKIDATA + '/fra_w-chain.pem'

extra = QgsAuthCertUtils.casFromFile(extra_path)
filtered = QgsAuthCertUtils.casRemoveSelfSigned(extra)
Expand Down
80 changes: 0 additions & 80 deletions tests/testdata/auth_system/certs_keys/alice-cert_w-chain.pem

This file was deleted.

Binary file not shown.
103 changes: 103 additions & 0 deletions tests/testdata/auth_system/certs_keys/fra_w-chain.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Bag Attributes
friendlyName: Fra
localKeyID: C3 63 3C 42 8D 44 18 53 97 3E 50 81 BA 9B E3 9F 66 7F 5A F6
subject=/C=US/ST=Alaska/L=Anchorage/O=QGIS Test CA/OU=Client Certificate/CN=Fra/emailAddress=testcert@qgis.org
issuer=/C=US/ST=Alaska/L=Anchorage/O=QGIS Test CA/OU=Certificate Authority/CN=QGIS Test Issuer CA/emailAddress=testcert@qgis.org
-----BEGIN CERTIFICATE-----
MIIEATCCA2qgAwIBAgIBBDANBgkqhkiG9w0BAQsFADCBqTELMAkGA1UEBhMCVVMx
DzANBgNVBAgTBkFsYXNrYTESMBAGA1UEBxMJQW5jaG9y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FoDAeBglghkgBhvhCAQ0E
ERYPeGNhIGNlcnRpZmljYXRlMA0GCSqGSIb3DQEBCwUAA4GBACmpNMi07f5UlEqV
6fX4YqnLnix7q9OEF5ttjMenPSv2xA83xLU/HdldWyEX4drkvplJr88fKqsBzrvn
Y7iQnepGQAcYg4Pvag8VEamXVd9n3xjJBEz41j+lGny/uDl0or/j6dzkt/mFqMhT
z2F4b7+QTrZItROHfw729vaxU34A
-----END CERTIFICATE-----
Bag Attributes: <No Attributes>
subject=/C=US/ST=Alaska/L=Anchorage/O=QGIS Test CA/OU=Certificate Authority/CN=QGIS Test Issuer CA/emailAddress=testcert@qgis.org
issuer=/C=US/ST=Alaska/L=Anchorage/O=QGIS Test CA/OU=Certificate Authority/CN=QGIS Test Root CA/emailAddress=testcert@qgis.org
-----BEGIN CERTIFICATE-----
MIIEFTCCA36gAwIBAgIBAjANBgkqhkiG9w0BAQsFADCBpzELMAkGA1UEBhMCVVMx
DzANBgNVBAgTBkFsYXNrYTESMBAGA1UEBxMJQW5jaG9yYWdlMRUwEwYDVQQKEwxR
R0lTIFRlc3QgQ0ExHjAcBgNVBAsTFUNlcnRpZmljYXRlIEF1dGhvcml0eTEaMBgG
A1UEAxMRUUdJUyBUZXN0IFJvb3QgQ0ExIDAeBgkqhkiG9w0BCQEWEXRlc3RjZXJ0
QHFnaXMub3JnMB4XDTE1MDYyMzAwMDAwMFoXDTI1MDYyMjIzNTk1OVowgakxCzAJ
BgNVBAYTAlVTMQ8wDQYDVQQIEwZBbGFza2ExEjAQBgNVBAcTCUFuY2hvcmFnZTEV
MBMGA1UEChMMUUdJUyBUZXN0IENBMR4wHAYDVQQLExVDZXJ0aWZpY2F0ZSBBdXRo
b3JpdHkxHDAaBgNVBAMTE1FHSVMgVGVzdCBJc3N1ZXIgQ0ExIDAeBgkqhkiG9w0B
CQEWEXRlc3RjZXJ0QHFnaXMub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
gQDtww6peeGANmz0ltmvhnv5e0sNAeLYrySpTBzYcLCA3nptlKyPThpBkcy+whLD
z/kKv876l9h4I5R2JCSKEDGNDN4XF+Sc6qXumXQ4ZUwkyZh4k1LkGy8jHmWZHWYj
0qnaqraupTKvGmLdeWoUgN4ofm6kAZJM/y6Ox14eUE9RDQIDAQABo4IBSzCCAUcw
DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUuVKjlsjIdCX/Vlw2CjVFBvyB+Uow
gdQGA1UdIwSBzDCByYAUAcssIcaDkz29/6pVsXDEZC7yL3ahga2kgaowgacxCzAJ
BgNVBAYTAlVTMQ8wDQYDVQQIEwZBbGFza2ExEjAQBgNVBAcTCUFuY2hvcmFnZTEV
MBMGA1UEChMMUUdJUyBUZXN0IENBMR4wHAYDVQQLExVDZXJ0aWZpY2F0ZSBBdXRo
b3JpdHkxGjAYBgNVBAMTEVFHSVMgVGVzdCBSb290IENBMSAwHgYJKoZIhvcNAQkB
FhF0ZXN0Y2VydEBxZ2lzLm9yZ4IBATALBgNVHQ8EBAMCAQYwEQYJYIZIAYb4QgEB
BAQDAgAHMB4GCWCGSAGG+EIBDQQRFg94Y2EgY2VydGlmaWNhdGUwDQYJKoZIhvcN
AQELBQADgYEAmRQFTK+52IVItHrd6xpPrB0uPvZ5iSp2iAbxYj8M0qLu1f8iVyCv
ZbbzByCEWheSdsXRGT+Xdc+RZ9eRzkt1Rm+CgPow865SpXYKnwZSZP6O5qL/uPyJ
DBtk3Txn3J/ZxKxIC1F9dHsWh32AtfmB2b4YVP1I411RgIDDP5bpClY=
-----END CERTIFICATE-----
Bag Attributes: <No Attributes>
subject=/C=US/ST=Alaska/L=Anchorage/O=QGIS Test CA/OU=Certificate Authority/CN=QGIS Test Root CA/emailAddress=testcert@qgis.org
issuer=/C=US/ST=Alaska/L=Anchorage/O=QGIS Test CA/OU=Certificate Authority/CN=QGIS Test Root CA/emailAddress=testcert@qgis.org
-----BEGIN CERTIFICATE-----
MIIEEzCCA3ygAwIBAgIBATANBgk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DQTEgMB4GCSqGSIb3DQEJARYR
dGVzdGNlcnRAcWdpcy5vcmeCAQEwCwYDVR0PBAQDAgEGMBEGCWCGSAGG+EIBAQQE
AwIABzAeBglghkgBhvhCAQ0EERYPeGNhIGNlcnRpZmljYXRlMA0GCSqGSIb3DQEB
CwUAA4GBAGk9qY01w5g2zuWWrwzrTzr6SFpykoMPG3sdvDLuXg3IWoQ2FX+ezwxh
erwIb2wMbRnGDr6fHD5dEnLP6OeOTQ114l1FOGJtaxllwK5opGoR4c88rKpQ+1pn
PMLPNyGv0Ju5vbsXHO+4ZmJdxx0DMeRIuRQnRDN/t24JuPV89hnY
-----END CERTIFICATE-----
Bag Attributes
friendlyName: Fra
localKeyID: C3 63 3C 42 8D 44 18 53 97 3E 50 81 BA 9B E3 9F 66 7F 5A F6
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAOOA/yLAj0TOL6Z3
OGY+2JxaSmStwl5veQjp+VoAOoxDVjQDOxuBNihZ1gGUVPc2cQm8HS+nMizw9SiC
l0ZiP23QqkL9Xgd1+scE1Hhxf8cvTp2Ek3QKbKlfol3wGZgGElwkrVed77+l7PjX
VxLd2UbnZEF8TURntOyMKeYwi53vAgMBAAECgYA9/tIH41dnVZSQlV5uJmQav1QU
eXFFELV342KKzxMlU9gy1kqOJTjf6BM0XPqGX3SQRY3ihXpb2tHD10pn6LAFtiOR
ymfPJ+fs3TiPUn+Ut7TkedKkTxu5IT5C5Nu0FllcTo9mpi5ytfu6D+gkrB8fX/fZ
5+jGdevrd9WWU+v5wQJBAP8AerrTiFLCJRocP/jIdwg+gmEdcPYg5cmeNVpAUuAN
CSa5QYIQ9xB3ERUVo4ODCEGQFdYDZaPPvGp5wICo9U8CQQDkZPaaj4UegQZp/Vkf
7fQBmRzVhccxewV/HlEqJR1iQydjN3SfTU3cI0QmZL805emSN0f2sgT4lV4tdLbJ
ueVhAkEAk2C+jf21u0bz1IxhOLL7gKtIBULTx5yp0gX7BedJPq6qDFRjlP2jHUQD
fnEcKOTxP5s7043xD2T/m3Y0mOeNpwJAaFDI5Y05otYRhOVnCJNZSEWTit7APRRQ
TWAeeB5djlzXp5RTmtLnBe3BmbuYLWP5S4QeRUnHxXYLfr15IyfZ4QJBAMxGWwet
yoR03gyOwSagP53hcV5wGWu1ThKlmzrLl6ulJYb/3lwbYeNCaI5ZzGaSiycWC/8K
9zIREiwz1u/iupk=
-----END PRIVATE KEY-----
Binary file not shown.
Loading

0 comments on commit b1c45d5

Please sign in to comment.