diff --git a/certbot/certbot/_internal/tests/crypto_util_test.py b/certbot/certbot/_internal/tests/crypto_util_test.py index f8531f382..67b358da9 100644 --- a/certbot/certbot/_internal/tests/crypto_util_test.py +++ b/certbot/certbot/_internal/tests/crypto_util_test.py @@ -20,15 +20,16 @@ from certbot.compat import filesystem from certbot.compat import os import certbot.tests.util as test_util -RSA256_KEY = test_util.load_vector('rsa256_key.pem') -RSA256_KEY_PATH = test_util.vector_path('rsa256_key.pem') RSA512_KEY = test_util.load_vector('rsa512_key.pem') +RSA512_KEY_PATH = test_util.vector_path('rsa512_key.pem') +RSA2048_KEY = test_util.load_vector('rsa2048_key.pem') RSA2048_KEY_PATH = test_util.vector_path('rsa2048_key.pem') CERT_PATH = test_util.vector_path('cert_512.pem') CERT = test_util.load_vector('cert_512.pem') SS_CERT_PATH = test_util.vector_path('cert_2048.pem') SS_CERT = test_util.load_vector('cert_2048.pem') P256_KEY = test_util.load_vector('nistp256_key.pem') +P256_KEY_PATH = test_util.vector_path('nistp256_key.pem') P256_CERT_PATH = test_util.vector_path('cert-nosans_nistp256.pem') P256_CERT = test_util.load_vector('cert-nosans_nistp256.pem') # CERT_LEAF is signed by CERT_ISSUER. CERT_ALT_ISSUER is a cross-sign of CERT_ISSUER. @@ -126,7 +127,7 @@ class CSRMatchesPubkeyTest(unittest.TestCase): def test_invalid_false(self): assert not self._call( - test_util.load_vector('csr_512.pem'), RSA256_KEY) + test_util.load_vector('csr_512.pem'), P256_KEY) class ImportCSRFileTest(unittest.TestCase): @@ -305,7 +306,7 @@ class VerifyCertMatchesPrivKeyTest(VerifyCertSetup): assert self._call(self.renewable_cert) is None def test_cert_priv_key_mismatch(self): - self.bad_renewable_cert.privkey = RSA256_KEY_PATH + self.bad_renewable_cert.privkey = P256_KEY_PATH self.bad_renewable_cert.cert = SS_CERT_PATH with pytest.raises(errors.Error): diff --git a/certbot/certbot/_internal/tests/main_test.py b/certbot/certbot/_internal/tests/main_test.py index 5fa499efb..4b76e9423 100644 --- a/certbot/certbot/_internal/tests/main_test.py +++ b/certbot/certbot/_internal/tests/main_test.py @@ -43,9 +43,9 @@ import certbot.tests.util as test_util CERT_PATH = test_util.vector_path('cert_512.pem') CERT = test_util.vector_path('cert_512.pem') CSR = test_util.vector_path('csr_512.der') -KEY = test_util.vector_path('rsa256_key.pem') JWK = jose.JWKRSA.load(test_util.load_vector('rsa512_key.pem')) RSA2048_KEY_PATH = test_util.vector_path('rsa2048_key.pem') +P256_KEY_PATH = test_util.vector_path('p256_key.pem') SS_CERT_PATH = test_util.vector_path('cert_2048.pem') @@ -1824,7 +1824,7 @@ class MainTest(test_util.ConfigTestCase): def test_revoke_with_key_mismatch(self): server = 'foo.bar' with pytest.raises(errors.Error): - self._call_no_clientmock(['--cert-path', CERT, '--key-path', KEY, + self._call_no_clientmock(['--cert-path', CERT, '--key-path', P256_KEY_PATH, '--server', server, 'revoke']) @mock.patch('certbot._internal.main._delete_if_appropriate') diff --git a/certbot/certbot/tests/testdata/README b/certbot/certbot/tests/testdata/README index 6cbadcab2..35cab603a 100644 --- a/certbot/certbot/tests/testdata/README +++ b/certbot/certbot/tests/testdata/README @@ -1,6 +1,6 @@ The following command has been used to generate test keys: - for x in 256 512 2048; do openssl genrsa -out rsa${k}_key.pem $k; done + for x in 512 2048; do openssl genrsa -out rsa${k}_key.pem $k; done For the elliptic curve private keys, this command was used: diff --git a/certbot/certbot/tests/testdata/rsa256_key.pem b/certbot/certbot/tests/testdata/rsa256_key.pem deleted file mode 100644 index 659274d1d..000000000 --- a/certbot/certbot/tests/testdata/rsa256_key.pem +++ /dev/null @@ -1,6 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIGrAgEAAiEAm2Fylv+Uz7trgTW8EBHP3FQSMeZs2GNQ6VRo1sIVJEkCAwEAAQIh -AJT0BA/xD01dFCAXzSNyj9nfSZa3NpqzJZZn/eOm7vghAhEAzUVNZn4lLLBD1R6N -E8TKNQIRAMHHyn3O5JeY36lwKwkUlEUCEAliRauN0L0+QZuYjfJ9aJECEGx4dru3 -rTPCyighdqWNlHUCEQCiLjlwSRtWgmMBudCkVjzt ------END RSA PRIVATE KEY-----