3 گaP @sjdZddlZddlmZddlmZddlZddlmZddlm Z ddl m Z ddl m Z ejje jd Ze jd Zejd d Zejd d Zejd d ZeegZee jeeedfdddZeje je jdddZeee jZeee jZeee jZ eegZ!e j"eedZ#e j"eedZ$e j"e edZ%e#e$gZ&de je'eejee je(e j)dddZ*dS)zACME utilities for testing.N)Iterable)Tuple) challenges)messages) auth_handler)utilzrsa512_key.pems+evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ+PCt92wr+oA)tokens 17817c66b60ce2e4012dfad92657527as cafecafecafecafecafecafe0feedbac.)challbsreturncCstddt|DS)z*Generate natural combinations for challbs.css|]\}}|fVqdS)N).0i_r r /usr/lib/python3.6/acme_util.py szgen_combos..)tuple enumerate)r r r r gen_combossr)challstatusr cCs<||jd|d}|tjkr0|jdtjjitjf|S)z$Return ChallengeBody from Challenge.Z_uri)rurirZ validated)typr STATUS_VALIDupdatedatetimenow ChallengeBody)rrkwargsr r rchall_to_challbs  rz example.comz example.orgzesimerkki.example.orgT) authz_statusdomainchallsstatusescombosr cCstddt||D}tjtj|d|d}|rD|jdt|i|tjkrr|j|tjj tj dddn|jd |itj d tj f|d S) a&Generate an authorization resource. :param authz_status: Status object :type authz_status: :class:`acme.messages.Status` :param list challs: Challenge objects :param list statuses: status of each challenge object :param bool combos: Whether or not to add combinations css|]\}}t||VqdS)N)r)r rrr r rrJszgen_authzr..)rvalue)Z identifierr combinations)Zdays)rZexpiresrz%https://trusted.ca/new-authz-resource)rZbody) rziprZ IdentifierZIDENTIFIER_FQDNrrrrrZ timedeltaAuthorizationResourceZ Authorization)rr r!r"r#r Z authz_kwargsr r r gen_authzr=s"    r))T)+__doc__rZtypingrrZjosepyZjoseZacmerrZcertbot._internalrZ certbot.testsrZJWKloadZ load_vectorZload_rsa_private_keyZKEYZHTTP01ZDNS01ZDNS01_2Z CHALLENGESrintrZ ChallengeZStatusrZSTATUS_PENDINGZHTTP01_PZDNS01_PZ DNS01_P_2Z CHALLENGES_PZchallb_to_achallZHTTP01_AZDNS01_AZ DNS01_A_2Z ACHALLENGESstrboolr(r)r r r rs4         "