Skip to content
Permalink
Browse files

[auth] New test cases for EC SSL Keys and encodings

  • Loading branch information
elpaso committed Nov 10, 2017
1 parent f52dbeb commit 10292762f5ca13bcc3604816070d140d2a82d035
@@ -744,12 +744,16 @@ def test_160_cert_viable(self):
self.assertFalse(QgsAuthCertUtils.certIsViable(cert))

def test_170_pki_key_encoding(self):
"""Test that a DER or PEM key can be opened whatever the extension is"""
"""Test that a DER/PEM RSA/DSA/EC keys can be opened whatever the extension is"""

self.assertFalse(QgsAuthCertUtils.keyFromFile(PKIDATA + '/' + 'ptolemy_key.pem').isNull())
self.assertFalse(QgsAuthCertUtils.keyFromFile(PKIDATA + '/' + 'ptolemy_key.der').isNull())
self.assertFalse(QgsAuthCertUtils.keyFromFile(PKIDATA + '/' + 'ptolemy_key_pem.key').isNull())
self.assertFalse(QgsAuthCertUtils.keyFromFile(PKIDATA + '/' + 'ptolemy_key_der.key').isNull())
self.assertFalse(QgsAuthCertUtils.keyFromFile(PKIDATA + '/' + 'donald_key_DSA.pem').isNull())
self.assertFalse(QgsAuthCertUtils.keyFromFile(PKIDATA + '/' + 'donald_key_DSA.der').isNull())
self.assertFalse(QgsAuthCertUtils.keyFromFile(PKIDATA + '/' + 'donald_key_EC.pem').isNull())
self.assertFalse(QgsAuthCertUtils.keyFromFile(PKIDATA + '/' + 'donald_key_EC.der').isNull())

self.assertEqual(QgsAuthCertUtils.validatePKIBundle(self.mkPEMBundle('ptolemy_cert.pem', 'ptolemy_key.pem', 'password', 'chain_subissuer-issuer-root.pem'), True, True), [])
self.assertEqual(QgsAuthCertUtils.validatePKIBundle(self.mkPEMBundle('ptolemy_cert.pem', 'ptolemy_key.der', 'password', 'chain_subissuer-issuer-root.pem'), True, True), [])
Binary file not shown.
@@ -0,0 +1,20 @@
-----BEGIN DSA PRIVATE KEY-----
MIIDVgIBAAKCAQEAwVdYLRBhy3TS0vjvf7cHOwSdumAqX3klBOvgUiU8uG3+BmBA
01u9x2xZDigsc6fAS0SF4ZO9Hzd3AQw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Y-----
Binary file not shown.
@@ -0,0 +1,5 @@
-----BEGIN EC PRIVATE KEY-----
MF8CAQEEGIsQLxNQtoHQcIzLa3vu1MVG9en2pUgqKKAKBggqhkjOPQMBAaE0AzIA
BDhZ5yKtc6E9igj0XMsTMP2rN6SPAryUoAn5yFrOvkaWlqATluDMx9VTuzBELeDL
Jg==
-----END EC PRIVATE KEY-----
Binary file not shown.

0 comments on commit 1029276

Please sign in to comment.
You can’t perform that action at this time.