ó
    ð›‘h�  ã                  óú   • S r SSKJr  SSKrSSKJr  SSKJrJrJ	r	J
r
JrJrJr  SSKJr  SSKJr  SSKJr  S	S
KJr  S	SKJrJrJrJrJrJrJrJr  S/r      SS jr       SS jr!\" S5      r"SS jr#SS jr$g)zL
`cryptography.x509 <https://github.com/pyca/cryptography>`_-specific code.
é    )ÚannotationsN)ÚSequence)ÚCertificateÚDNSNameÚExtensionOIDÚ	IPAddressÚObjectIdentifierÚ	OtherNameÚUniformResourceIdentifier)ÚExtensionNotFound)Údecode)Ú	IA5Stringé   )ÚCertificateError)ÚDNS_IDÚCertificatePatternÚ
DNSPatternÚIPAddress_IDÚIPAddressPatternÚ
SRVPatternÚ
URIPatternÚverify_service_identityÚverify_certificate_hostnamec                ó@   • [        [        U 5      [        U5      // S9  g)aX  
Verify whether *certificate* is valid for *hostname*.

.. note::
    Nothing is verified about the *authority* of the certificate;
    the caller must verify that the certificate chains to an appropriate
    trust root themselves.

Args:
    certificate: A *cryptography* X509 certificate object.

    hostname: The hostname that *certificate* should be valid for.

Raises:
    service_identity.VerificationError:
        If *certificate* is not valid for *hostname*.

    service_identity.CertificateError:
        If *certificate* contains invalid / unexpected data. This includes
        the case where the certificate contains no `subjectAltName`\ s.

.. versionchanged:: 24.1.0
    :exc:`~service_identity.CertificateError` is raised if the certificate
    contains no ``subjectAltName``\ s instead of
    :exc:`~service_identity.VerificationError`.
©Úcert_patternsÚobligatory_idsÚoptional_idsN)r   Úextract_patternsr   )ÚcertificateÚhostnames     ÚaC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\service_identity/cryptography.pyr   r   (   s"   € ô: Ü& {Ó3Ü˜xÓ(Ð)Øóó    c                ó@   • [        [        U 5      [        U5      // S9  g)a¬  
Verify whether *certificate* is valid for *ip_address*.

.. note::
    Nothing is verified about the *authority* of the certificate;
    the caller must verify that the certificate chains to an appropriate
    trust root themselves.

Args:
    certificate: A *cryptography* X509 certificate object.

    ip_address:
        The IP address that *connection* should be valid for.  Can be an
        IPv4 or IPv6 address.

Raises:
    service_identity.VerificationError:
        If *certificate* is not valid for *ip_address*.

    service_identity.CertificateError:
        If *certificate* contains invalid / unexpected data. This includes
        the case where the certificate contains no ``subjectAltName``\ s.

.. versionadded:: 18.1.0

.. versionchanged:: 24.1.0
    :exc:`~service_identity.CertificateError` is raised if the certificate
    contains no ``subjectAltName``\ s instead of
    :exc:`~service_identity.VerificationError`.
r   N)r   r   r   )r    Ú
ip_addresss     r"   Úverify_certificate_ip_addressr&   L   s#   € ôB Ü& {Ó3Ü$ ZÓ0Ð1Øór#   z1.3.6.1.5.5.7.8.7c           
     ó  • / n U R                   R                  [        R                  5      nUR	                  UR
                  R                  [        5       Vs/ s H(  n[        R                  " UR                  S5      5      PM*     sn5        UR	                  UR
                  R                  [        5       Vs/ s H(  n[        R                  " UR                  S5      5      PM*     sn5        UR	                  UR
                  R                  [        5       Vs/ s H  n[        U5      PM     sn5        UR
                  R                  [        5       H…  nUR                   ["        :X  d  M  [%        UR
                  5      u  px['        U[(        5      (       a5  UR+                  [,        R                  " UR/                  5       5      5        Mz  Sn	[1        U	5      e   U$ s  snf s  snf s  snf ! [2         a     U$ f = f)zê
Extract all valid ID patterns from a certificate for service verification.

Args:
    cert: The certificate to be dissected.

Returns:
    List of IDs.

.. versionchanged:: 23.1.0
   ``commonName`` is not used as a fallback anymore.
zutf-8zUnexpected certificate content.)Ú
extensionsÚget_extension_for_oidr   ÚSUBJECT_ALTERNATIVE_NAMEÚextendÚvalueÚget_values_for_typer   r   Ú
from_bytesÚencoder   r   r   r   r
   Útype_idÚID_ON_DNS_SRVr   Ú
isinstancer   Úappendr   ÚasOctetsr   r   )
ÚcertÚidsÚextÚnameÚuriÚipÚotherÚsrvÚ_Úmsgs
             r"   r   r   w   s°  € ð %'€Cð"0Ø�o‰o×3Ñ3Ü×1Ñ1ó
ˆð 	�
‰
ð  ŸI™I×9Ñ9¼'ÔBóâB�Dô ×%Ò% d§k¡k°'Ó&:Ö;ÙBñô	
ð 	�
‰
ð Ÿ9™9×8Ñ8Ü-ôóò�Cô ×%Ò% c§j¡j°Ó&9Ö:ññô	
ð 	�
‰
ð Ÿ)™)×7Ñ7¼	ÔBóâB�Bô ! Ö$ÙBñô	
ð —Y‘Y×2Ñ2´9Ö=ˆEØ�}‰}¤Õ-Ü §¡Ó,‘�Ü˜c¤9×-Ñ-Ø—J‘Jœz×4Ò4°S·\±\³^ÓDÖEà;�CÜ*¨3Ó/Ð/ñ >ð €Jùò9ùòùòøô% ó Øð> €JðAús#   „)G2 Á/G#Â;/G(ÄG-Ç2
H Ç?H c                óL   • [         R                  " [        SSS9  [        U 5      $ )za
Deprecated and never public API.  Use :func:`extract_patterns` instead.

.. deprecated:: 23.1.0
z?`extract_ids()` is deprecated, please use `extract_patterns()`.é   )ÚcategoryÚmessageÚ
stacklevel)ÚwarningsÚwarnÚDeprecationWarningr   )r5   s    r"   Úextract_idsrG   ¬   s&   € ô ‡M‚MÜ#ØQØòô
 ˜DÓ!Ð!r#   )r    r   r!   ÚstrÚreturnÚNone)r    r   r%   rH   rI   rJ   )r5   r   rI   zSequence[CertificatePattern])%Ú__doc__Ú
__future__r   rD   Útypingr   Úcryptography.x509r   r   r   r   r	   r
   r   Úcryptography.x509.extensionsr   Úpyasn1.codec.der.decoderr   Úpyasn1.type.charr   Ú
exceptionsr   Úhazmatr   r   r   r   r   r   r   r   Ú__all__r   r&   r1   r   rG   © r#   r"   Ú<module>rV      sŸ   ðñõ #ã å ÷÷ ñ õ ;Ý +Ý &å (÷	÷ 	ó 	ð )Ð
)€ð!Øð!Ø(+ð!à	ô!ðH%Øð%Ø*-ð%à	ô%ñP !Ð!4Ó5€ô2õj"r#   