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(),
           )))
Exemplo n.º 4
0
import os
import pkg_resources

import Crypto.PublicKey.RSA

from letsencrypt.acme import challenges
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()),