ó
    !Æàhc  ã                  óò   • S r SSKJr  SSKrSSKrSSKJr  SSKJr	  SSK
JrJrJrJr  \R                  " \5         SSKJr  SS	KJr  SSS5        S
/rSS jrSS jrSS jrSS jrg! , (       d  f       N&= f)zA
`pyOpenSSL <https://github.com/pyca/pyopenssl>`_-specific code.
é    )ÚannotationsN)ÚSequenceé   )Úextract_patterns)ÚDNS_IDÚCertificatePatternÚIPAddress_IDÚverify_service_identity)ÚX509)Ú
ConnectionÚverify_hostnamec                ó\   • [        [        U R                  5       5      [        U5      // S9  g)a÷  
Verify whether the certificate of *connection* is valid for *hostname*.

Args:
    connection: A pyOpenSSL connection object.

    hostname: The hostname that *connection* should be connected to.

Raises:
    service_identity.VerificationError:
        If *connection* does not provide a certificate that is valid for
        *hostname*.

    service_identity.CertificateError:
        If certificate provided by *connection* 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
   r   Úget_peer_certificater   )Ú
connectionÚhostnames     Úa/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/service_identity/pyopenssl.pyr   r      s0   € ô0 Ü&Ø×+Ñ+Ó-ó
ô ˜xÓ(Ð)Øóó    c                ó\   • [        [        U R                  5       5      [        U5      // S9  g)a  
Verify whether the certificate of *connection* is valid for *ip_address*.

Args:
    connection: A pyOpenSSL connection object.

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

Raises:
    service_identity.VerificationError:
        If *connection* does not provide a certificate that is valid for
        *ip_address*.

    service_identity.CertificateError:
        If the certificate chain of *connection* contains a certificate
        that contains invalid/unexpected data.

.. 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	   )r   Ú
ip_addresss     r   Úverify_ip_addressr   ?   s0   € ô6 Ü&Ø×+Ñ+Ó-ó
ô % ZÓ0Ð1Øór   c                ó4   • [        U R                  5       5      $ )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.
)Ú_cryptography_extract_patternsÚto_cryptography©Úcerts    r   r   r   c   s   € ô *¨$×*>Ñ*>Ó*@ÓAÐAr   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   r   s    r   Úextract_idsr(   s   s&   € ô ‡M‚MÜ#ØQØòô
 ˜DÓ!Ð!r   )r   r   r   ÚstrÚreturnÚNone)r   r   r   r)   r*   r+   )r   r   r*   zSequence[CertificatePattern])Ú__doc__Ú
__future__r   Ú
contextlibr%   Útypingr   Úcryptographyr   r   Úhazmatr   r   r	   r
   ÚsuppressÚImportErrorÚOpenSSL.cryptor   ÚOpenSSL.SSLr   Ú__all__r   r   r(   © r   r   Ú<module>r8      sk   ðñõ #ã Û å å L÷ó ð ×Ò˜Õ%å#Ý&÷ &ð Ð
€ôôB!ôHBõ "÷} &Õ%ús   »A(Á(
A6