def setUp(self):
        self.installer = mock.MagicMock()
        certs = [CERT0_PATH, CERT1_PATH, CERT2_PATH, CERT3_PATH]
        keys = [None, None, CERT2_KEY_PATH, CERT3_KEY_PATH]
        self.installer.get_all_certs_keys.return_value = zip(
            certs, keys, 4 * [None])
        self.proof_of_pos = proof_of_possession.ProofOfPossession(
            self.installer)

        hints = challenges.ProofOfPossession.Hints(
            jwk=jose.JWKRSA(key=CERT3_KEY),
            cert_fingerprints=(),
            certs=(),
            serial_numbers=(),
            subject_key_identifiers=(),
            issuers=(),
            authorized_for=())
        chall = challenges.ProofOfPossession(alg=jose.RS256,
                                             nonce='zczv4HMLVe_0kimJ25Juig',
                                             hints=hints)
        challb = messages.ChallengeBody(chall=chall,
                                        uri="http://example",
                                        status=messages.STATUS_PENDING)
        self.achall = achallenges.ProofOfPossession(challb=challb,
                                                    domain="example.com")
Пример #2
0
 def test_perform_bad_challenge(self):
     hints = challenges.ProofOfPossession.Hints(
         jwk=jose.jwk.JWKOct(key=CERT3_KEY), cert_fingerprints=(),
         certs=(), serial_numbers=(), subject_key_identifiers=(),
         issuers=(), authorized_for=())
     chall = challenges.ProofOfPossession(
         alg=jose.HS512, nonce='zczv4HMLVe_0kimJ25Juig', hints=hints)
     challb = messages2.ChallengeBody(
         chall=chall, uri="http://example", status=messages2.STATUS_PENDING)
     self.achall = achallenges.ProofOfPossession(
         challb=challb, domain="example.com")
     self.assertEqual(self.proof_of_pos.perform(self.achall), None)
Пример #3
0
    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"),
        serial_numbers=(34234239832, 23993939911, 17),
        issuers=(
            "C=US, O=SuperT LLC, CN=SuperTrustworthy Public CA",
            "O=LessTrustworthy CA Inc, CN=LessTrustworthy But StillSecure",
        ),
        authorized_for=("www.example.com", "example.net"),
    ))

CHALLENGES = [SIMPLE_HTTP, DVSNI, DNS, RECOVERY_CONTACT, RECOVERY_TOKEN, POP]
DV_CHALLENGES = [
    chall for chall in CHALLENGES if isinstance(chall, challenges.DVChallenge)
]
CONT_CHALLENGES = [
    chall for chall in CHALLENGES