Ejemplo n.º 1
0
    def setUp(self):
        from acme.messages import ChallengeBody
        from acme.messages import STATUS_VALID

        self.challbs = (
            ChallengeBody(
                uri='http://challb1', status=STATUS_VALID,
                chall=challenges.SimpleHTTP(token=b'IlirfxKKXAsHtmzK29Pj8A')),
            ChallengeBody(uri='http://challb2', status=STATUS_VALID,
                          chall=challenges.DNS(
                              token=b'DGyRejmCefe7v4NfDGDKfA')),
            ChallengeBody(uri='http://challb3', status=STATUS_VALID,
                          chall=challenges.RecoveryContact()),
        )
        combinations = ((0, 2), (1, 2))

        from acme.messages import Authorization
        from acme.messages import Identifier
        from acme.messages 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,
        }
Ejemplo n.º 2
0
    def setUp(self):
        challs = (
            challenges.SimpleHTTP(token='IlirfxKKXAsHtmzK29Pj8A'),
            challenges.DNS(token='DGyRejmCefe7v4NfDGDKfA'),
            challenges.RecoveryToken(),
        )
        combinations = ((0, 2), (1, 2))

        from 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.to_json() for chall in challs],
            'combinations': [[0, 2], [1, 2]],  # TODO array tuples
        }
Ejemplo n.º 3
0
 def test_resolved_combinations(self):
     self.assertEqual(
         self.msg.resolved_combinations,
         ((challenges.SimpleHTTP(token='IlirfxKKXAsHtmzK29Pj8A'),
           challenges.RecoveryToken()), (
               challenges.DNS(token='DGyRejmCefe7v4NfDGDKfA'),
               challenges.RecoveryToken(),
           )))
Ejemplo n.º 4
0
    def _test_simple_http(self, add):
        chall = challenges.SimpleHTTP(token=(b'x' * 16))
        response = challenges.SimpleHTTPResponse(tls=False)

        from acme.standalone import SimpleHTTPRequestHandler
        resource = SimpleHTTPRequestHandler.SimpleHTTPResource(
            chall=chall, response=response, validation=response.gen_validation(
                chall, self.account_key))
        if add:
            self.resources.add(resource)
        return resource.response.simple_verify(
            resource.chall, 'localhost', self.account_key.public_key(),
            port=self.port)
Ejemplo n.º 5
0
import os
import pkg_resources

import Crypto.PublicKey.RSA

from acme import challenges
from acme import jose
from acme import messages

KEY = jose.HashableRSAKey(
    Crypto.PublicKey.RSA.importKey(
        pkg_resources.resource_string(
            "acme.jose", os.path.join("testdata", "rsa512_key.pem"))))

# Challenges
SIMPLE_HTTP = challenges.SimpleHTTP(
    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()),