HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/acme/__pycache__/messages.cpython-39.pyc
a

�`]�@sBdZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZzdd	l
mZWney�dd	lmZYn0d
ZdZdd
ddddddddddddddddddd d!d"d#d$d%d&�Zed'd(�e��D��Ze�ed)d(�e��D���d*d+�ZejGd,d-�d-ejej��ZGd.d/�d/eje�ZGd0d1�d1e�Zed2�Zed3�Z ed4�Z!ed5�Z"ed6�Z#ed7�Z$ed8�Z%ed9�Z&Gd:d;�d;e�Z'e'd<�Z(Gd=d>�d>ej�Z)Gd?d@�d@ej�Z*GdAdB�dBej�Z+GdCdD�dDe+�Z,GdEdF�dFej�Z-GdGdH�dHe.�Z/GdIdJ�dJe-�Z0e*j1GdKdL�dLee0��Z2GdMdN�dNee0�Z3GdOdP�dPe,�Z4GdQdR�dRe-�Z5GdSdT�dTe+�Z6GdUdV�dVe-�Z7e*j1GdWdX�dXee7��Z8GdYdZ�dZee7�Z9Gd[d\�d\e,�Z:e*j1Gd]d^�d^eej��Z;Gd_d`�d`e,�Z<e*j1Gdadb�dbeej��Z=Gdcdd�dde-�Z>Gdedf�dfe,�Z?e*j1Gdgdh�dhe>��Z@dS)izACME protocol messages.�N��
challenges)�errors)�fields)�jws)�util)�
ResourceMixin)�Hashablezurn:acme:error:zurn:ietf:params:acme:error:z4The request specified an account that does not existzOThe request specified a certificate to be revoked that has already been revokedz2The CSR is unacceptable (e.g., due to a short key)z1The client sent an unacceptable anti-replay noncez>The JWS was signed by a public key the server does not supportz;The revocation reason provided is not allowed by the serverz@The JWS was signed with an algorithm the server does not supportz\Certification Authority Authorization (CAA) records forbid the CA from issuing a certificatezBSpecific error conditions are indicated in the "subproblems" arrayz?The server could not connect to the client to verify the domainzAThere was a problem with a DNS query during identifier validationz4The server could not validate a DNSSEC signed domainz;Response received didn't match the challenge's requirementsz1The provided email for a registration was invalidz$The provided contact URI was invalidz!The request message was malformedz9The server will not issue certificates for the identifierzLThe request attempted to finalize an order that is not ready to be finalizedz,There were too many requests of a given typez(The server experienced an internal errorz=The server experienced a TLS error during domain verificationz)The client lacks sufficient authorizationz@A contact URL for an account used an unsupported protocol schemez*The server could not resolve a domain namez'An identifier is of an unsupported typez,The server requires external account binding)ZaccountDoesNotExistZalreadyRevokedZbadCSRZbadNonceZbadPublicKeyZbadRevocationReasonZbadSignatureAlgorithmZcaaZcompoundZ
connection�dnsZdnssecZincorrectResponseZinvalidEmailZinvalidContactZ	malformedZrejectedIdentifierZ
orderNotReadyZrateLimitedZserverInternalZtlsZunauthorizedZunsupportedContactZunknownHostZunsupportedIdentifier�externalAccountRequiredccs|]\}}t||fVqdS�N)�ERROR_PREFIX��.0�nameZdesc�r�//usr/lib/python3/dist-packages/acme/messages.py�	<genexpr>9srccs|]\}}t||fVqdSr)�OLD_ERROR_PREFIXrrrrr<scCs,t|t�r(|jdur(t|jvp&t|jvSdS)z#Check if argument is an ACME error.NF)�
isinstance�Error�typr
r)�errrrr�
is_acme_error@src@sheZdZdZejdddd�Zejddd�Zejddd�Ze	d	d
��Z
edd��Zed
d��Z
dd�ZdS)rz�ACME error.

    https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00

    :ivar unicode typ:
    :ivar unicode title:
    :ivar unicode detail:

    �typeTzabout:blank��	omitempty�default�title�r�detailcKs.|tvrtd|��t|}|fd|i|��S)z�Create an Error instance with an ACME Error code.

        :unicode code: An ACME error code, like 'dnssec'.
        :kwargs: kwargs to pass to Error.

        z4The supplied code: %s is not a known ACME error coder)�ERROR_CODES�
ValueErrorr
)�cls�code�kwargsrrrr�	with_codeVs�zError.with_codecCst�|j�S)z�Hardcoded error description based on its type.

        :returns: Description if standard ACME error or ``None``.
        :rtype: unicode

        )�ERROR_TYPE_DESCRIPTIONS�getr��selfrrr�descriptiondszError.descriptioncCs$t|j��d�d}|tvr |SdS)z�ACME error code.

        Basically self.typ without the ERROR_PREFIX.

        :returns: error code if standard ACME code or ``None``.
        :rtype: unicode

        �:���N)�strr�splitr!)r*r$rrrr$ns
z
Error.codecCs(d�dd�|j|j|j|jfD����S)Ns :: css"|]}|dur|�dd�VqdS)N�ascii�backslashreplace)�encode)r�partrrrr~s�z Error.__str__.<locals>.<genexpr>)�joinrr+r r�decoder)rrr�__str__}s
�z
Error.__str__N)�__name__�
__module__�__qualname__�__doc__�jose�Fieldrrr �classmethodr&�propertyr+r$r6rrrrrGs	


	
rcs\eZdZdZdZeZ�fdd�Zdd�Ze	dd��Z
d	d
�Zdd�Zd
d�Z
dd�Z�ZS)�	_ConstantzACME constant.�rcs"tt|���||j|<||_dSr)�superr?�__init__�POSSIBLE_NAMESr�r*r��	__class__rrrB�s
z_Constant.__init__cCs|jSrr@r)rrr�to_partial_json�sz_Constant.to_partial_jsoncCs&||jvrt�d�|j���|j|S)Nz{0} not recognized)rCr;ZDeserializationError�formatr7�r#�jobjrrr�	from_json�s


�z_Constant.from_jsoncCsd�|jj|j�S)Nz{0}({1}))rHrFr7rr)rrr�__repr__�sz_Constant.__repr__cCst|t|��o|j|jkSr)rrr�r*�otherrrr�__eq__�sz_Constant.__eq__cCst|j|jf�Sr)�hashrFrr)rrr�__hash__�sz_Constant.__hash__cCs
||kSrrrMrrr�__ne__�sz_Constant.__ne__)r7r8r9r:�	__slots__�NotImplementedrCrBrGr=rKrLrOrQrR�
__classcell__rrrErr?�s
r?c@seZdZdZiZdS)�StatuszACME "status" field.N�r7r8r9r:rCrrrrrV�srV�unknown�pendingZ
processingZvalidZinvalidZrevokedZreadyZdeactivatedc@seZdZdZiZdS)�IdentifierTypezACME identifier type.NrWrrrrrZ�srZr
c@s*eZdZdZejdejd�Ze�d�Z	dS)�
IdentifierzNACME identifier.

    :ivar IdentifierType typ:
    :ivar unicode value:

    r��decoder�valueN)
r7r8r9r:r;r<rZrKrr^rrrrr[�sr[c@sjeZdZdZiZGdd�dej�Zedd��Z	edd��Z
dd	�Zd
d�Zdd
�Z
dd�Zedd��ZdS)�	Directoryz
Directory.cs�eZdZdZejddd�Zejddd�Zejddd�Zejddd�Z	ejddd�Z
�fd	d
�Zedd��Z
�fd
d�Zdd�Z�ZS)zDirectory.MetazDirectory Meta.zterms-of-serviceTrZtermsOfService�websiteZ
caaIdentitiesrcs2�fdd�|��D�}ttj��jfi|��dS)Ncsi|]\}}��|�|�qSr��_internal_name�r�k�vr)rr�
<dictcomp>��z+Directory.Meta.__init__.<locals>.<dictcomp>)�itemsrAr_�MetarB�r*r%rEr)rrB�szDirectory.Meta.__init__cCs|jp
|jS)zURL for the CA TOS)�_terms_of_service�_terms_of_service_v2r)rrr�terms_of_service�szDirectory.Meta.terms_of_servicec#s4ttj|���D]}|dkr(|dd�n|VqdS)Nrk�)rAr_ri�__iter__rDrErrro�szDirectory.Meta.__iter__cCs|dkrd|S|S)Nrm�_rrDrrrrb�szDirectory.Meta._internal_name)r7r8r9r:r;r<rkrlr`Zcaa_identitiesZexternal_account_requiredrBr>rmrorbrUrrrErri�s
ricCst|d|�S)N�
resource_type)�getattr)r#�keyrrr�
_canon_key�szDirectory._canon_keycCs"|j}||jvsJ�||j|<|S)zRegister resource.)rq�_REGISTERED_TYPES)r#Zresource_body_clsrqrrr�register�s
zDirectory.registercCst�||j�}||_dSr)rZmap_keysrt�_jobj)r*rJZ
canon_jobjrrrrB�szDirectory.__init__c
CsHz||�dd�WStyB}ztt|���WYd}~n
d}~00dS)Nrp�-)�replace�KeyError�AttributeErrorr.)r*r�errorrrr�__getattr__�szDirectory.__getattr__cCs@z|j|�|�WSty:td|�|�d��Yn0dS)NzDirectory field "z" not found)rwrtrzrDrrr�__getitem__�szDirectory.__getitem__cCs|jSr)rwr)rrrrGszDirectory.to_partial_jsoncCs |j�|�di��|d<||�S)N�meta)rirK�poprIrrrrKszDirectory.from_jsonN)r7r8r9r:rur;�JSONObjectWithFieldsrir=rtrvrBr}r~rGrKrrrrr_�s

r_c@seZdZdZe�d�ZdS)�ResourcezOACME Resource.

    :ivar acme.messages.ResourceBody body: Resource body.

    �bodyN)r7r8r9r:r;r<r�rrrrr�
sr�c@seZdZdZe�d�ZdS)�ResourceWithURIzQACME Resource with URI.

    :ivar unicode ~.uri: Location of the resource.

    �uriN)r7r8r9r:r;r<r�rrrrr�sr�c@seZdZdZdS)�ResourceBodyzACME Resource Body.N)r7r8r9r:rrrrr�sr�c@seZdZdZedd��ZdS)�ExternalAccountBindingzACME External Account Bindingc	CsRt�|�����}tj�|�}|d}tj�	|tj
j|d�tjj
d||�}|��S)zLCreate External Account Binding Resource from contact details, kid and hmac.Z
newAccount)rsN)�json�dumpsrGr2r;Zb64Z	b64decoderZJWSZsignZjwkZJWKOctZjwaZHS256)	r#Zaccount_public_keyZkidZhmac_keyZ	directoryZkey_jsonZdecoded_hmac_key�urlZeabrrr�	from_data#s�z ExternalAccountBinding.from_dataN)r7r8r9r:r=r�rrrrr� sr�cs�eZdZdZejddejjd�Zejdddd�Z	ejddd	�Z
ejd
dd	�Zejddd	�Zejddd	�Z
ejd
dd	�ZdZdZed!dd��Z�fdd�Zdd�Zdd�Z�fdd�Z�fdd�Zedd��Zedd ��Z�ZS)"�Registrationz�Registration Resource Body.

    :ivar josepy.jwk.JWK key: Public key.
    :ivar tuple contact: Contact information following ACME spec,
        `tuple` of `unicode`.
    :ivar unicode agreement:

    rsT�rr]�contactrr�	agreementr�statusZtermsOfServiceAgreedZonlyReturnExistingZexternalAccountBindingztel:zmailto:Ncs�d|v}t|�dd��}|dur0|��j|�|durV|��fdd�|�d�D��|s^|rjt|�|d<|rv||d<�fi|��S)a
        Create registration resource from contact details.

        The `contact` keyword being passed to a Registration object is meaningful, so
        this function represents empty iterables in its kwargs by passing on an empty
        `tuple`.
        r�rNcsg|]}�j|�qSr)�email_prefix)rZmail�r#rr�
<listcomp>]rgz*Registration.from_data.<locals>.<listcomp>�,�external_account_binding)�listr��append�phone_prefix�extendr/�tuple)r#ZphoneZemailr�r%Zcontact_providedZdetailsrr�rr�KszRegistration.from_datacs0d|vrt�|dd�tt|�jfi|��dS)z;Note if the user provides a value for the `contact` member.r��_add_contactTN)�object�__setattr__rAr�rBrjrErrrBiszRegistration.__init__cst�fdd�|jD��S)Nc3s(|] }|���r|t��d�VqdSr)�
startswith�len)rr ��prefixrrrqs
�z/Registration._filter_contact.<locals>.<genexpr>)r�r�)r*r�rr�r�_filter_contactps�zRegistration._filter_contactcCst|dd�r|�d�|d<|S)a�
        The `contact` member of Registration objects should not be required when
        de-serializing (as it would be if the Fields' `omitempty` flag were `False`), but
        it should be included in serializations if it was provided.

        :param jobj: Dictionary containing this Registrations' data
        :type jobj: dict

        :returns: Dictionary containing Registrations data to transmit to the server
        :rtype: dict
        r�Fr�)rrr2�r*rJrrr�_add_contact_if_appropriateusz(Registration._add_contact_if_appropriatecstt|���}|�|�S)z2Modify josepy.JSONDeserializable.to_partial_json())rAr�rGr�r�rErrrG�szRegistration.to_partial_jsoncstt|���}|�|�S)z;Modify josepy.JSONObjectWithFields.fields_to_partial_json())rAr��fields_to_partial_jsonr�r�rErrr��sz#Registration.fields_to_partial_jsoncCs|�|j�S)z*All phones found in the ``contact`` field.)r�r�r)rrr�phones�szRegistration.phonescCs|�|j�S)z*All emails found in the ``contact`` field.)r�r�r)rrr�emails�szRegistration.emails)NNN)r7r8r9r:r;r<ZJWKrKrsr�r�r�Zterms_of_service_agreedZonly_return_existingr�r�r�r=r�rBr�r�rGr�r>r�r�rUrrrErr�2s*

r�c@seZdZdZdZe�e�ZdS)�NewRegistrationzNew registration.znew-regN�r7r8r9r:rqrr��resourcerrrrr��sr�c@seZdZdZdZe�e�ZdS)�UpdateRegistrationzUpdate registration.ZregNr�rrrrr��sr�c@s<eZdZdZejdejd�Zejddd�Z	ejddd�Z
dS)	�RegistrationResourcez�Registration Resource.

    :ivar acme.messages.Registration body:
    :ivar unicode new_authzr_uri: Deprecated. Do not use.
    :ivar unicode terms_of_service: URL for the CA TOS.

    r�r\�new_authzr_uriTrrmN)r7r8r9r:r;r<r�rKr�r�rmrrrrr��sr�cs�eZdZdZdZejdddd�Zejdddd�Zejde	j
ded	�Ze
jd
dd�Zejdej
ddd	�Z�fd
d�Z�fdd�Z�fdd�Ze�fdd��Zedd��Zdd�Z�fdd�Zdd�Z�ZS)�
ChallengeBodya>Challenge Resource Body.

    .. todo::
       Confusingly, this has a similar name to `.challenges.Challenge`,
       as well as `.achallenges.AnnotatedChallenge`. Please use names
       such as ``challb`` to distinguish instances of this class from
       ``achall``.

    :ivar acme.challenges.Challenge: Wrapped challenge.
        Conveniently, all challenge fields are proxied, i.e. you can
        call ``challb.x`` to get ``challb.chall.x`` contents.
    :ivar acme.messages.Status status:
    :ivar datetime.datetime validated:
    :ivar messages.Error error:

    )�challr�TNrr�r�)r]rr�	validatedrr|cs0�fdd�|��D�}tt��jfi|��dS)Ncsi|]\}}��|�|�qSrrarcr)rrrf�rgz*ChallengeBody.__init__.<locals>.<dictcomp>)rhrAr�rBrjrEr)rrB�szChallengeBody.__init__cstt|��|�|��Sr)rAr�r2rbrDrErrr2�szChallengeBody.encodecs"tt|���}|�|j���|Sr)rAr�rG�updater�r�rErrrG�szChallengeBody.to_partial_jsoncs$tt|��|�}tj�|�|d<|S)Nr�)rAr��fields_from_jsonrZ	ChallengerK)r#rJZjobj_fieldsrErrr��szChallengeBody.fields_from_jsoncCs|jp
|jS)zThe URL of this challenge.)�_url�_urir)rrrr��szChallengeBody.uricCst|j|�Sr)rrr�rDrrrr}�szChallengeBody.__getattr__c#s2tt|���D]}|dkr&|dd�n|VqdS)Nr�rn)rAr�rorDrErrro�szChallengeBody.__iter__cCs|dkrd|S|S)Nr�rprrDrrrrb�szChallengeBody._internal_name)r7r8r9r:rSr;r<r�r�rVrK�STATUS_PENDINGr�r�RFC3339Fieldr�rr|rBr2rGr=r�r>r�r}rorbrUrrrErr��s*
�
�
r�c@s6eZdZdZejdejd�Ze�d�Z	e
dd��ZdS)�ChallengeResourcez�Challenge Resource.

    :ivar acme.messages.ChallengeBody body:
    :ivar unicode authzr_uri: URI found in the 'up' ``Link`` header.

    r�r\�
authzr_uricCs|jjS)zThe URL of the challenge body.)r�r�r)rrrr�szChallengeResource.uriN)r7r8r9r:r;r<r�rKr�r�r>r�rrrrr��s

r�c@s�eZdZdZejdejdd�Zejddd�Z	ejddd�Z
ejddejd	�Ze
jd
dd�Zejddd�Ze	jdd
��Z	edd��ZdS)�
Authorizationa^Authorization Resource Body.

    :ivar acme.messages.Identifier identifier:
    :ivar list challenges: `list` of `.ChallengeBody`
    :ivar tuple combinations: Challenge combinations (`tuple` of `tuple`
        of `int`, as opposed to `list` of `list` from the spec).
    :ivar acme.messages.Status status:
    :ivar datetime.datetime expires:

    �
identifierT�r]rrr�combinationsr�r��expires�wildcardcCstdd�|D��S)Ncss|]}t�|�VqdSr)r�rK)rr�rrrr rgz+Authorization.challenges.<locals>.<genexpr>�r��r^rrrrszAuthorization.challengescst�fdd��jD��S)z0Combinations with challenges instead of indices.c3s$|]}t�fdd�|D��VqdS)c3s|]}�j|VqdSrr)r�idxr)rrr%rgz@Authorization.resolved_combinations.<locals>.<genexpr>.<genexpr>Nr�)rZcombor)rrr%s�z6Authorization.resolved_combinations.<locals>.<genexpr>)r�r�r)rr)r�resolved_combinations"s�z#Authorization.resolved_combinationsN)r7r8r9r:r;r<r[rKr�rr�rVr�rr�r�r�r]r>r�rrrrr�s

r�c@seZdZdZdZe�e�ZdS)�NewAuthorizationzNew authorization.z	new-authzNr�rrrrr�)sr�c@seZdZdZdZe�e�ZdS)�UpdateAuthorizationzUpdate authorization.ZauthzNr�rrrrr�0sr�c@s.eZdZdZejdejd�Zejddd�Z	dS)�AuthorizationResourcez�Authorization Resource.

    :ivar acme.messages.Authorization body:
    :ivar unicode new_cert_uri: Deprecated. Do not use.

    r�r\�new_cert_uriTrN)
r7r8r9r:r;r<r�rKr�r�rrrrr�6sr�c@s2eZdZdZdZe�e�Zej	dej
ejd�ZdS)�CertificateRequestz�ACME new-cert request.

    :ivar josepy.util.ComparableX509 csr:
        `OpenSSL.crypto.X509Req` wrapped in `.ComparableX509`

    znew-cert�csr�r]�encoderN)
r7r8r9r:rqrr�r�r;r<Z
decode_csrZ
encode_csrr�rrrrr�As
r�c@s$eZdZdZe�d�Ze�d�ZdS)�CertificateResourceaCertificate Resource.

    :ivar josepy.util.ComparableX509 body:
        `OpenSSL.crypto.X509` wrapped in `.ComparableX509`
    :ivar unicode cert_chain_uri: URI found in the 'up' ``Link`` header
    :ivar tuple authzrs: `tuple` of `AuthorizationResource`.

    �cert_chain_uri�authzrsN)r7r8r9r:r;r<r�r�rrrrr�Ns
r�c@s<eZdZdZdZe�e�Zej	dej
ejd�Ze�	d�Z
dS)�
Revocationz|Revocation message.

    :ivar .ComparableX509 certificate: `OpenSSL.crypto.X509` wrapped in
        `.ComparableX509`

    zrevoke-cert�certificater��reasonN)r7r8r9r:rqrr�r�r;r<Zdecode_certZencode_certr�r�rrrrr�[s

�r�c@s�eZdZdZejddd�Zejdejdd�Z	ejddd�Z
ejddd�Zejd	dd�Ze
jd
dd�Zejddejd�Zejd
d��ZdS)�Ordera_Order Resource Body.

    :ivar identifiers: List of identifiers for the certificate.
    :vartype identifiers: `list` of `.Identifier`
    :ivar acme.messages.Status status:
    :ivar authorizations: URLs of authorizations.
    :vartype authorizations: `list` of `str`
    :ivar str certificate: URL to download certificate as a fullchain PEM.
    :ivar str finalize: URL to POST to to request issuance once all
        authorizations have "valid" status.
    :ivar datetime.datetime expires: When the order expires.
    :ivar ~.Error error: Any error that occurred during finalization, if applicable.
    �identifiersTrr�r��authorizationsr��finalizer�r|r�cCstdd�|D��S)Ncss|]}t�|�VqdSr)r[rK)rr�rrrr�rgz$Order.identifiers.<locals>.<genexpr>r�r�rrrr��szOrder.identifiersN)r7r8r9r:r;r<r�rVrKr�r�r�r�rr�r�rr|r]rrrrr�js

�r�c@sTeZdZdZejdejd�Zejddd�Z	e�d�Z
ejddd�Zejd	dd�Zd
S)�
OrderResourcea�Order Resource.

    :ivar acme.messages.Order body:
    :ivar str csr_pem: The CSR this Order will be finalized with.
    :ivar authorizations: Fully-fetched AuthorizationResource objects.
    :vartype authorizations: `list` of `acme.messages.AuthorizationResource`
    :ivar str fullchain_pem: The fetched contents of the certificate URL
        produced once the order was finalized, if it's present.
    :ivar alternative_fullchains_pem: The fetched contents of alternative certificate
        chain URLs produced once the order was finalized, if present and requested during
        finalization.
    :vartype alternative_fullchains_pem: `list` of `str`
    r�r\�csr_pemTrr��
fullchain_pem�alternative_fullchains_pemN)
r7r8r9r:r;r<r�rKr�r�r�r�r�rrrrr��s

r�c@seZdZdZdZdS)�NewOrderz
New order.z	new-orderN)r7r8r9r:rqrrrrr��sr�)Ar:r�Zjosepyr;ZsixZacmerrrrrZacme.mixinsr�collections.abcr	�ImportError�collectionsrr
r!�dictrhr'r�rZpython_2_unicode_compatibler�rZJSONDeSerializabler?rVZSTATUS_UNKNOWNr�ZSTATUS_PROCESSINGZSTATUS_VALIDZSTATUS_INVALIDZSTATUS_REVOKEDZSTATUS_READYZSTATUS_DEACTIVATEDrZZIDENTIFIER_FQDNr[r_r�r�r�r�r�r�rvr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�<module>s��!��
<!G		i
B"