Example #1
0
 def setUp(self):
     self.challb = acme_util.chall_to_challb(acme_util.DVSNI, "pending")
     key = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
     from letsencrypt.achallenges import DVSNI
     self.achall = DVSNI(challb=self.challb,
                         domain="example.com",
                         account_key=key)
    def setUp(self):
        self.chall = acme_util.chall_to_challb(
            challenges.DVSNI(r="r_value", nonce="12345ABCDE"), "pending")
        self.response = challenges.DVSNIResponse()
        key = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))

        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(challb=self.chall, domain="example.com", key=key)
    def setUp(self):
        self.chall = acme_util.chall_to_challb(
            challenges.DVSNI(r="r_value", nonce="12345ABCDE"), "pending")
        self.response = challenges.DVSNIResponse()
        key = le_util.Key(
            "path",
            pkg_resources.resource_string(
                "acme.jose", os.path.join("testdata", "rsa512_key.pem")))

        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(challb=self.chall, domain="example.com", key=key)
class DVSNITest(unittest.TestCase):
    """Tests for letsencrypt.achallenges.DVSNI."""

    def setUp(self):
        self.chall = acme_util.chall_to_challb(
            challenges.DVSNI(r="r_value", nonce="12345ABCDE"), "pending")
        self.response = challenges.DVSNIResponse()
        key = le_util.Key("path", pkg_resources.resource_string(
            "acme.jose", os.path.join("testdata", "rsa512_key.pem")))

        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(challb=self.chall, domain="example.com", key=key)

    def test_proxy(self):
        self.assertEqual(self.chall.r, self.achall.r)
        self.assertEqual(self.chall.nonce, self.achall.nonce)

    def test_gen_cert_and_response(self):
        cert_pem, _ = self.achall.gen_cert_and_response(s=self.response.s)

        cert = OpenSSL.crypto.load_certificate(
            OpenSSL.crypto.FILETYPE_PEM, cert_pem)
        self.assertEqual(cert.get_subject().CN, "example.com")
        # pylint: disable=protected-access
        self.assertEqual(crypto_util._pyopenssl_cert_or_req_san(cert), [
            "example.com", self.chall.nonce_domain,
            self.response.z_domain(self.chall)])
class DVSNITest(unittest.TestCase):
    """Tests for letsencrypt.achallenges.DVSNI."""
    def setUp(self):
        self.chall = acme_util.chall_to_challb(
            challenges.DVSNI(r="r_value", nonce="12345ABCDE"), "pending")
        self.response = challenges.DVSNIResponse()
        key = le_util.Key(
            "path",
            pkg_resources.resource_string(
                "acme.jose", os.path.join("testdata", "rsa512_key.pem")))

        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(challb=self.chall, domain="example.com", key=key)

    def test_proxy(self):
        self.assertEqual(self.chall.r, self.achall.r)
        self.assertEqual(self.chall.nonce, self.achall.nonce)

    def test_gen_cert_and_response(self):
        cert_pem, _ = self.achall.gen_cert_and_response(s=self.response.s)

        cert = M2Crypto.X509.load_cert_string(cert_pem)
        self.assertEqual(cert.get_subject().CN, self.chall.nonce_domain)

        sans = cert.get_ext("subjectAltName").get_value()
        self.assertEqual(
            set([
                self.chall.nonce_domain, "example.com",
                self.response.z_domain(self.chall)
            ]),
            set(re.findall(r"DNS:([^, $]*)", sans)),
        )
class DVSNITest(unittest.TestCase):
    """Tests for letsencrypt.achallenges.DVSNI."""

    def setUp(self):
        self.chall = acme_util.chall_to_challb(
            challenges.DVSNI(r="r_value", nonce="12345ABCDE"), "pending")
        self.response = challenges.DVSNIResponse()
        key = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))

        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(challb=self.chall, domain="example.com", key=key)

    def test_proxy(self):
        self.assertEqual(self.chall.r, self.achall.r)
        self.assertEqual(self.chall.nonce, self.achall.nonce)

    def test_gen_cert_and_response(self):
        cert_pem, _ = self.achall.gen_cert_and_response(s=self.response.s)

        cert = OpenSSL.crypto.load_certificate(
            OpenSSL.crypto.FILETYPE_PEM, cert_pem)
        self.assertEqual(cert.get_subject().CN, "example.com")
        # pylint: disable=protected-access
        self.assertEqual(acme_crypto_util._pyopenssl_cert_or_req_san(cert), [
            "example.com", self.chall.nonce_domain,
            self.response.z_domain(self.chall)])
class DVSNITest(unittest.TestCase):
    """Tests for letsencrypt.achallenges.DVSNI."""

    def setUp(self):
        self.chall = acme_util.chall_to_challb(
            challenges.DVSNI(r="r_value", nonce="12345ABCDE"), "pending")
        self.response = challenges.DVSNIResponse()
        key = le_util.Key("path", pkg_resources.resource_string(
            "acme.jose", os.path.join("testdata", "rsa512_key.pem")))

        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(challb=self.chall, domain="example.com", key=key)

    def test_proxy(self):
        self.assertEqual(self.chall.r, self.achall.r)
        self.assertEqual(self.chall.nonce, self.achall.nonce)

    def test_gen_cert_and_response(self):
        cert_pem, _ = self.achall.gen_cert_and_response(s=self.response.s)

        cert = M2Crypto.X509.load_cert_string(cert_pem)
        self.assertEqual(cert.get_subject().CN, self.chall.nonce_domain)

        sans = cert.get_ext("subjectAltName").get_value()
        self.assertEqual(
            set([self.chall.nonce_domain, "example.com",
                 self.response.z_domain(self.chall)]),
            set(re.findall(r"DNS:([^, $]*)", sans)),
        )
    def setUp(self):
        self.chall = acme_util.chall_to_challb(
            challenges.DVSNI(r="r_value", nonce="12345ABCDE"), "pending")
        self.response = challenges.DVSNIResponse()
        key = le_util.Key("path", pkg_resources.resource_string(
            "acme.jose", os.path.join("testdata", "rsa512_key.pem")))

        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(challb=self.chall, domain="example.com", key=key)
Example #9
0
class DVSNITest(unittest.TestCase):
    """Tests for letsencrypt.achallenges.DVSNI."""

    def setUp(self):
        self.challb = acme_util.chall_to_challb(acme_util.DVSNI, "pending")
        key = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(
            challb=self.challb, domain="example.com", account_key=key)

    def test_proxy(self):
        self.assertEqual(self.challb.token, self.achall.token)

    def test_gen_cert_and_response(self):
        response, cert_pem, key_pem = self.achall.gen_cert_and_response()
        self.assertTrue(isinstance(response, challenges.DVSNIResponse))
        self.assertTrue(isinstance(cert_pem, bytes))
        self.assertTrue(isinstance(key_pem, bytes))
Example #10
0
class DVSNITest(unittest.TestCase):
    """Tests for letsencrypt.achallenges.DVSNI."""
    def setUp(self):
        self.challb = acme_util.chall_to_challb(acme_util.DVSNI, "pending")
        key = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
        from letsencrypt.achallenges import DVSNI
        self.achall = DVSNI(challb=self.challb,
                            domain="example.com",
                            account_key=key)

    def test_proxy(self):
        self.assertEqual(self.challb.token, self.achall.token)

    def test_gen_cert_and_response(self):
        response, cert_pem, key_pem = self.achall.gen_cert_and_response()
        self.assertTrue(isinstance(response, challenges.DVSNIResponse))
        self.assertTrue(isinstance(cert_pem, bytes))
        self.assertTrue(isinstance(key_pem, bytes))
Example #11
0
 def setUp(self):
     self.challb = acme_util.chall_to_challb(acme_util.DVSNI, "pending")
     key = jose.JWKRSA.load(test_util.load_vector("rsa512_key.pem"))
     from letsencrypt.achallenges import DVSNI
     self.achall = DVSNI(
         challb=self.challb, domain="example.com", account_key=key)