def setUp(self):
        challs = (
            challenges.SimpleHTTPS(token='IlirfxKKXAsHtmzK29Pj8A'),
            challenges.DNS(token='DGyRejmCefe7v4NfDGDKfA'),
            challenges.RecoveryToken(),
        )
        combinations = ((0, 2), (1, 2))

        from letsencrypt.acme.messages import Challenge
        self.msg = Challenge(
            session_id='aefoGaavieG9Wihuk2aufai3aeZ5EeW4',
            nonce='\xec\xd6\xf2oYH\xeb\x13\xd5#q\xe0\xdd\xa2\x92\xa9',
            challenges=challs, combinations=combinations)

        self.jmsg_to = {
            'type': 'challenge',
            'sessionID': 'aefoGaavieG9Wihuk2aufai3aeZ5EeW4',
            'nonce': '7Nbyb1lI6xPVI3Hg3aKSqQ',
            'challenges': challs,
            'combinations': combinations,
        }

        self.jmsg_from = {
            'type': 'challenge',
            'sessionID': 'aefoGaavieG9Wihuk2aufai3aeZ5EeW4',
            'nonce': '7Nbyb1lI6xPVI3Hg3aKSqQ',
            'challenges': [chall.fully_serialize() for chall in challs],
            'combinations': [[0, 2], [1, 2]], # TODO array tuples
        }
    def setUp(self):
        from letsencrypt.acme.messages2 import ChallengeBody
        from letsencrypt.acme.messages2 import STATUS_VALID
        self.challbs = (
            ChallengeBody(
                uri='http://challb1', status=STATUS_VALID,
                chall=challenges.SimpleHTTPS(token='IlirfxKKXAsHtmzK29Pj8A')),
            ChallengeBody(uri='http://challb2', status=STATUS_VALID,
                          chall=challenges.DNS(token='DGyRejmCefe7v4NfDGDKfA')),
            ChallengeBody(uri='http://challb3', status=STATUS_VALID,
                          chall=challenges.RecoveryToken()),
        )
        combinations = ((0, 2), (1, 2))

        from letsencrypt.acme.messages2 import Authorization
        from letsencrypt.acme.messages2 import Identifier
        from letsencrypt.acme.messages2 import IDENTIFIER_FQDN
        identifier = Identifier(typ=IDENTIFIER_FQDN, value='example.com')
        self.authz = Authorization(
            identifier=identifier, combinations=combinations,
            challenges=self.challbs)

        self.jobj_from = {
            'identifier': identifier.to_json(),
            'challenges': [challb.to_json() for challb in self.challbs],
            'combinations': combinations,
        }
 def test_resolved_combinations(self):
     self.assertEqual(
         self.msg.resolved_combinations,
         ((challenges.SimpleHTTPS(token='IlirfxKKXAsHtmzK29Pj8A'),
           challenges.RecoveryToken()), (
               challenges.DNS(token='DGyRejmCefe7v4NfDGDKfA'),
               challenges.RecoveryToken(),
           )))
    def setUp(self):
        from letsencrypt.client.network2 import Network
        self.net = Network(
            new_reg_uri='https://www.letsencrypt-demo.org/acme/new-reg',
            key=KEY,
            alg=jose.RS256)
        self.response = mock.MagicMock(ok=True, status_code=httplib.OK)
        self.response.headers = {}
        self.response.links = {}

        self.identifier = messages2.Identifier(typ=messages2.IDENTIFIER_FQDN,
                                               value='example.com')

        # Registration
        self.contact = ('mailto:[email protected]', 'tel:+12025551212')
        reg = messages2.Registration(contact=self.contact,
                                     key=KEY.public(),
                                     recovery_token='t')
        self.regr = messages2.RegistrationResource(
            body=reg,
            uri='https://www.letsencrypt-demo.org/acme/reg/1',
            new_authzr_uri='https://www.letsencrypt-demo.org/acme/new-reg',
            terms_of_service='https://www.letsencrypt-demo.org/tos')

        # Authorization
        authzr_uri = 'https://www.letsencrypt-demo.org/acme/authz/1'
        challb = messages2.ChallengeBody(uri=(authzr_uri + '/1'),
                                         status=messages2.STATUS_VALID,
                                         chall=challenges.DNS(token='foo'))
        self.challr = messages2.ChallengeResource(body=challb,
                                                  authzr_uri=authzr_uri)
        self.authz = messages2.Authorization(identifier=messages2.Identifier(
            typ=messages2.IDENTIFIER_FQDN, value='example.com'),
                                             challenges=(challb, ),
                                             combinations=None,
                                             key=KEY.public())
        self.authzr = messages2.AuthorizationResource(
            body=self.authz,
            uri=authzr_uri,
            new_cert_uri='https://www.letsencrypt-demo.org/acme/new-cert')

        # Request issuance
        self.certr = messages2.CertificateResource(
            body=CERT,
            authzrs=(self.authzr, ),
            uri='https://www.letsencrypt-demo.org/acme/cert/1',
            cert_chain_uri='https://www.letsencrypt-demo.org/ca')
    def setUp(self):
        self.chall = challenges.DNS(token='foo')

        from letsencrypt.acme.messages2 import ChallengeBody
        from letsencrypt.acme.messages2 import STATUS_VALID
        self.status = STATUS_VALID
        self.challb = ChallengeBody(
            uri='http://challb', chall=self.chall, status=self.status)

        self.jobj_to = {
            'uri': 'http://challb',
            'status': self.status,
            'type': 'dns',
            'token': 'foo',
        }
        self.jobj_from = self.jobj_to.copy()
        self.jobj_from['status'] = 'valid'
Exemple #6
0
from letsencrypt.acme import jose

KEY = jose.HashableRSAKey(
    Crypto.PublicKey.RSA.importKey(
        pkg_resources.resource_string(
            "letsencrypt.client.tests",
            os.path.join("testdata", "rsa256_key.pem"))))

# Challenges
SIMPLE_HTTPS = challenges.SimpleHTTPS(
    token="evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ+PCt92wr+oA")
DVSNI = challenges.DVSNI(
    r="O*\xb4-\xad\xec\x95>\xed\xa9\r0\x94\xe8\x97\x9c&6\xbf'\xb3"
    "\xed\x9a9nX\x0f'\\m\xe7\x12",
    nonce="a82d5ff8ef740d12881f6d3c2277ab2e")
DNS = challenges.DNS(token="17817c66b60ce2e4012dfad92657527a")
RECOVERY_CONTACT = challenges.RecoveryContact(
    activation_url="https://example.ca/sendrecovery/a5bd99383fb0",
    success_url="https://example.ca/confirmrecovery/bb1b9928932",
    contact="c********[email protected]")
RECOVERY_TOKEN = challenges.RecoveryToken()
POP = challenges.ProofOfPossession(
    alg="RS256",
    nonce="xD\xf9\xb9\xdbU\xed\xaa\x17\xf1y|\x81\x88\x99 ",
    hints=challenges.ProofOfPossession.Hints(
        jwk=jose.JWKRSA(key=KEY.publickey()),
        cert_fingerprints=("93416768eb85e33adc4277f4c9acd63e7418fcfe",
                           "16d95b7b63f1972b980b14c20291f3c0d1855d95",
                           "48b46570d9fc6358108af43ad1649484def0debf"),
        certs=(),  # TODO
        subject_key_identifiers=("d0083162dcc4c8a23ecb8aecbd86120e56fd24e5"),