diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-09-22 12:54:51 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2017-09-22 12:54:51 -0700 |
commit | 519d5a034de887982136fcfdb6dffef47e46dd88 (patch) | |
tree | 2e6c0265b86d35d26b323923c176eed1ca621b67 | |
parent | f511eaf487d59fe60271b2e4aac5fe0470fecf92 (diff) |
Move cert tests & copies of related keys into separate folder.
This prevents non-cert-related tests from incidentally loading
the certs, which was masking issues (re #1071)
-rw-r--r-- | tests/cert_support/test_dss.key | 12 | ||||
-rw-r--r-- | tests/cert_support/test_dss.key-cert.pub (renamed from tests/test_dss.key-cert.pub) | 0 | ||||
-rw-r--r-- | tests/cert_support/test_ecdsa_256.key | 5 | ||||
-rw-r--r-- | tests/cert_support/test_ecdsa_256.key-cert.pub (renamed from tests/test_ecdsa_256.key-cert.pub) | 0 | ||||
-rw-r--r-- | tests/cert_support/test_ed25519.key | 8 | ||||
-rw-r--r-- | tests/cert_support/test_ed25519.key-cert.pub (renamed from tests/test_ed25519.key-cert.pub) | 0 | ||||
-rw-r--r-- | tests/cert_support/test_rsa.key | 15 | ||||
-rw-r--r-- | tests/cert_support/test_rsa.key-cert.pub (renamed from tests/test_rsa.key-cert.pub) | 0 | ||||
-rw-r--r-- | tests/test_client.py | 6 | ||||
-rw-r--r-- | tests/test_pkey.py | 11 |
10 files changed, 52 insertions, 5 deletions
diff --git a/tests/cert_support/test_dss.key b/tests/cert_support/test_dss.key new file mode 100644 index 00000000..e10807f1 --- /dev/null +++ b/tests/cert_support/test_dss.key @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBuwIBAAKBgQDngaYDZ30c6/7cJgEEbtl8FgKdwhba1Z7oOrOn4MI/6C42G1bY +wMuqZf4dBCglsdq39SHrcjbE8Vq54gPSOh3g4+uV9Rcg5IOoPLbwp2jQfF6f1FIb +sx7hrDCIqUcQccPSxetPBKmXI9RN8rZLaFuQeTnI65BKM98Ruwvq6SI2LwIVAPDP +hSeawaJI27mKqOfe5PPBSmyHAoGBAJMXxXmPD9sGaQ419DIpmZecJKBUAy9uXD8x +gbgeDpwfDaFJP8owByCKREocPFfi86LjCuQkyUKOfjYMN6iHIf1oEZjB8uJAatUr +FzI0ArXtUqOhwTLwTyFuUojE5own2WYsOAGByvgfyWjsGhvckYNhI4ODpNdPlxQ8 +ZamaPGPsAoGARmR7CCPjodxASvRbIyzaVpZoJ/Z6x7dAumV+ysrV1BVYd0lYukmn +jO1kKBWApqpH1ve9XDQYN8zgxM4b16L21kpoWQnZtXrY3GZ4/it9kUgyB7+NwacI +BlXa8cMDL7Q/69o0d54U0X/NeX5QxuYR6OMJlrkQB7oiW/P/1mwjQgECFGI9QPSc +h9pT9XHqn+1rZ4bK+QGA +-----END DSA PRIVATE KEY----- diff --git a/tests/test_dss.key-cert.pub b/tests/cert_support/test_dss.key-cert.pub index 07fd5578..07fd5578 100644 --- a/tests/test_dss.key-cert.pub +++ b/tests/cert_support/test_dss.key-cert.pub diff --git a/tests/cert_support/test_ecdsa_256.key b/tests/cert_support/test_ecdsa_256.key new file mode 100644 index 00000000..42d44734 --- /dev/null +++ b/tests/cert_support/test_ecdsa_256.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIKB6ty3yVyKEnfF/zprx0qwC76MsMlHY4HXCnqho2eKioAoGCCqGSM49 +AwEHoUQDQgAElI9mbdlaS+T9nHxY/59lFnn80EEecZDBHq4gLpccY8Mge5ZTMiMD +ADRvOqQ5R98Sxst765CAqXmRtz8vwoD96g== +-----END EC PRIVATE KEY----- diff --git a/tests/test_ecdsa_256.key-cert.pub b/tests/cert_support/test_ecdsa_256.key-cert.pub index f2c93ccf..f2c93ccf 100644 --- a/tests/test_ecdsa_256.key-cert.pub +++ b/tests/cert_support/test_ecdsa_256.key-cert.pub diff --git a/tests/cert_support/test_ed25519.key b/tests/cert_support/test_ed25519.key new file mode 100644 index 00000000..eb9f94c2 --- /dev/null +++ b/tests/cert_support/test_ed25519.key @@ -0,0 +1,8 @@ +-----BEGIN OPENSSH PRIVATE KEY----- +b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW +QyNTUxOQAAACB69SvZKJh/9VgSL0G27b5xVYa8nethH3IERbi0YqJDXwAAAKhjwAdrY8AH +awAAAAtzc2gtZWQyNTUxOQAAACB69SvZKJh/9VgSL0G27b5xVYa8nethH3IERbi0YqJDXw +AAAEA9tGQi2IrprbOSbDCF+RmAHd6meNSXBUQ2ekKXm4/8xnr1K9komH/1WBIvQbbtvnFV +hryd62EfcgRFuLRiokNfAAAAI2FsZXhfZ2F5bm9yQEFsZXhzLU1hY0Jvb2stQWlyLmxvY2 +FsAQI= +-----END OPENSSH PRIVATE KEY----- diff --git a/tests/test_ed25519.key-cert.pub b/tests/cert_support/test_ed25519.key-cert.pub index 4e01415a..4e01415a 100644 --- a/tests/test_ed25519.key-cert.pub +++ b/tests/cert_support/test_ed25519.key-cert.pub diff --git a/tests/cert_support/test_rsa.key b/tests/cert_support/test_rsa.key new file mode 100644 index 00000000..f50e9c53 --- /dev/null +++ b/tests/cert_support/test_rsa.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICWgIBAAKBgQDTj1bqB4WmayWNPB+8jVSYpZYk80Ujvj680pOTh2bORBjbIAyz +oWGW+GUjzKxTiiPvVmxFgx5wdsFvF03v34lEVVhMpouqPAYQ15N37K/ir5XY+9m/ +d8ufMCkjeXsQkKqFbAlQcnWMCRnOoPHS3I4vi6hmnDDeeYTSRvfLbW0fhwIBIwKB +gBIiOqZYaoqbeD9OS9z2K9KR2atlTxGxOJPXiP4ESqP3NVScWNwyZ3NXHpyrJLa0 +EbVtzsQhLn6rF+TzXnOlcipFvjsem3iYzCpuChfGQ6SovTcOjHV9z+hnpXvQ/fon +soVRZY65wKnF7IAoUwTmJS9opqgrN6kRgCd3DASAMd1bAkEA96SBVWFt/fJBNJ9H +tYnBKZGw0VeHOYmVYbvMSstssn8un+pQpUm9vlG/bp7Oxd/m+b9KWEh2xPfv6zqU +avNwHwJBANqzGZa/EpzF4J8pGti7oIAPUIDGMtfIcmqNXVMckrmzQ2vTfqtkEZsA +4rE1IERRyiJQx6EJsz21wJmGV9WJQ5kCQQDwkS0uXqVdFzgHO6S++tjmjYcxwr3g +H0CoFYSgbddOT6miqRskOQF3DZVkJT3kyuBgU2zKygz52ukQZMqxCb1fAkASvuTv +qfpH87Qq5kQhNKdbbwbmd2NxlNabazPijWuphGTdW0VfJdWfklyS2Kr+iqrs/5wV +HhathJt636Eg7oIjAkA8ht3MQ+XSl9yIJIS8gVpbPxSw5OMfw0PjVE7tBdQruiSc +nvuQES5C9BMHjF39LZiGH1iLQy7FgdHyoP+eodI7 +-----END RSA PRIVATE KEY----- diff --git a/tests/test_rsa.key-cert.pub b/tests/cert_support/test_rsa.key-cert.pub index 7487ab66..7487ab66 100644 --- a/tests/test_rsa.key-cert.pub +++ b/tests/cert_support/test_rsa.key-cert.pub diff --git a/tests/test_client.py b/tests/test_client.py index 5d616fcf..7058f394 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -266,7 +266,8 @@ class SSHClientTest (unittest.TestCase): # server-side behavior is 100% identical.) # NOTE: only bothered whipping up one cert per overall class/family. for type_ in ('rsa', 'dss', 'ecdsa_256', 'ed25519'): - cert_path = test_path('test_{0}.key-cert.pub'.format(type_)) + cert_name = 'test_{0}.key-cert.pub'.format(type_) + cert_path = test_path(os.path.join('cert_support', cert_name)) self._test_connection( key_filename=cert_path, public_blob=PublicBlob.from_file(cert_path), @@ -280,7 +281,8 @@ class SSHClientTest (unittest.TestCase): # that a specific cert was found, along with regular authorization # succeeding proving that the overall flow works. for type_ in ('rsa', 'dss', 'ecdsa_256', 'ed25519'): - key_path = test_path('test_{0}.key'.format(type_)) + key_name = 'test_{0}.key'.format(type_) + key_path = test_path(os.path.join('cert_support', key_name)) self._test_connection( key_filename=key_path, public_blob=PublicBlob.from_file( diff --git a/tests/test_pkey.py b/tests/test_pkey.py index 099fa4b0..95557621 100644 --- a/tests/test_pkey.py +++ b/tests/test_pkey.py @@ -489,9 +489,13 @@ class KeyTest(unittest.TestCase): def test_certificates(self): # PKey.load_certificate - key = RSAKey.from_private_key_file(test_path('test_rsa.key')) + key_path = test_path(os.path.join('cert_support', 'test_rsa.key')) + key = RSAKey.from_private_key_file(key_path) self.assertTrue(key.public_blob is None) - key.load_certificate(test_path('test_rsa.key-cert.pub')) + cert_path = test_path( + os.path.join('cert_support', 'test_rsa.key-cert.pub') + ) + key.load_certificate(cert_path) self.assertTrue(key.public_blob is not None) self.assertEqual(key.public_blob.key_type, 'ssh-rsa-cert-v01@openssh.com') self.assertEqual(key.public_blob.comment, 'test_rsa.key.pub') @@ -507,7 +511,8 @@ class KeyTest(unittest.TestCase): self.assertEqual(msg.get_int64(), 1234) # Prevented from loading certificate that doesn't match - key1 = Ed25519Key.from_private_key_file(test_path('test_ed25519.key')) + key_path = test_path(os.path.join('cert_support', 'test_ed25519.key')) + key1 = Ed25519Key.from_private_key_file(key_path) self.assertRaises( ValueError, key1.load_certificate, |