Remove csr_matches_names.

c.f. #127 and
https://github.com/letsencrypt/lets-encrypt-preview/pull/127#discussion-diff-21613376
This commit is contained in:
Jakub Warmuz
2014-12-12 10:37:57 +01:00
parent 40837e9d56
commit 0b7121341f
3 changed files with 0 additions and 48 deletions
-5
View File
@@ -118,11 +118,6 @@ class Client(object):
# Make sure we have key and csr to perform challenges
self.init_key_csr()
# TODO: Handle this exception/problem
if not crypto_util.csr_matches_names(self.csr.data, self.names):
raise errors.LetsEncryptClientError(
"CSR subject does not contain one of the specified names")
# Perform Challenges
responses, challenge_objs = self.verify_identity(challenge_msg)
# Get Authorization
-21
View File
@@ -129,27 +129,6 @@ def valid_csr(csr):
return False
def csr_matches_names(csr, domains):
"""Check if CSR contains the subject of one of the domains.
M2Crypto currently does not expose the OpenSSL interface to
also check the SAN extension. This is insufficient for full testing
:param str csr: CSR in DER.
:param list domains: Domains the CSR should contain.
:returns: If the CSR subject contains one of the domains
:rtype: bool
"""
try:
csr_obj = M2Crypto.X509.load_request_der_string(csr)
return csr_obj.get_subject().CN in domains
except M2Crypto.X509.X509Error:
return False
def csr_matches_pubkey(csr, privkey):
"""Does private key correspond to the subject public key in the CSR?
@@ -97,28 +97,6 @@ class ValidCSRTest(unittest.TestCase):
self.assertFalse(self._call('foo bar'))
class CSRMatchesNamesTest(unittest.TestCase):
"""Tests for letsencrypt.client.crypto_util.csr_matches_names."""
def _call(self, csr, domains):
from letsencrypt.client.crypto_util import csr_matches_names
return csr_matches_names(csr, domains)
def _call_testdata(self, name, domains):
return self._call(pkg_resources.resource_string(
__name__, os.path.join('testdata', name)), domains)
def test_single_domain(self):
self.assertTrue(self._call_testdata('csr.der', ['example.com']))
self.assertFalse(self._call_testdata('csr.der', ['www.example.com']))
self.assertFalse(self._call_testdata('csr.der', ['example']))
def test_san(self):
self.assertTrue(self._call_testdata('csr-san.der', ['example.com']))
self.assertTrue(self._call_testdata('csr-san.der', ['www.example.com']))
self.assertFalse(self._call_testdata('csr-san.der', ['example']))
class CSRMatchesPubkeyTest(unittest.TestCase):
"""Tests for letsencrypt.client.crypto_util.csr_matches_pubkey."""