%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/service_identity/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/service_identity/__pycache__/pyopenssl.cpython-312.pyc

�

զe���0�dZddlmZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZd	d
lmZd	dlmZmZmZmZmZmZmZmZej4e�5ddlmZdd
lmZddd�dgZ dd�Z!dd�Z"ed�Z#dd�Z$dd�Z%y#1swY�%xYw)zA
`pyOpenSSL <https://github.com/pyca/pyopenssl>`_-specific code.
�)�annotationsN)�Sequence)�decode)�	IA5String)�ObjectIdentifier)�GeneralNames�)�CertificateError)�DNS_ID�CertificatePattern�
DNSPattern�IPAddress_ID�IPAddressPattern�
SRVPattern�
URIPattern�verify_service_identity)�X509)�
Connection�verify_hostnamec�b�tt|j��t|�gg��y)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�extract_patterns�get_peer_certificater)�
connection�hostnames  �</usr/lib/python3/dist-packages/service_identity/pyopenssl.pyrr's0��0�&��+�+�-�
��x�(�)���c�b�tt|j��t|�gg��y)aX
    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`.
    rN)rrrr)r�
ip_addresss  r�verify_ip_addressr#Hs0��6�&��+�+�-�
�%�Z�0�1��r z1.3.6.1.5.5.7.8.7c���g}t|j��D�]�}|j|�}|j�dk(s�)t	|j�t
���\}}|D�]�}|j�}|dk(rA|jtj|j�j����Z|dk(rA|jtj|j�j�����|dk(rA|jtj|j�j�����|dk(r�|j�}|jd�}	|	t k(rlt	|jd��\}
}t#|
t$�r4|jt'j|
j�����vt)d	�����������|S)
a

    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.
    ssubjectAltName)�asn1Spec�dNSName�	iPAddress�uniformResourceIdentifier�	otherNamerr	zUnexpected certificate content.)�range�get_extension_count�
get_extension�get_short_namer�get_datar�getName�appendr
�
from_bytes�getComponent�asOctetsrr�getComponentByPosition�
ID_ON_DNS_SRV�
isinstancerrr
)�cert�ids�i�ext�names�_�n�name_string�comp�oid�srvs           rrros���%'�C�
�4�+�+�-�
.�"��� � ��#������#4�4��c�l�l�n�|�~�F�H�E�1��
���i�i�k���)�+��J�J�"�-�-�a�n�n�.>�.G�.G�.I�J��!�K�/��J�J�(�3�3��N�N�,�5�5�7���
!�$?�?��J�J�"�-�-�a�n�n�.>�.G�.G�.I�J��!�K�/��>�>�+�D��5�5�a�8�C��m�+�!'��(C�(C�A�(F�!G���Q�%�c�9�5��J�J�z�'<�'<�S�\�\�^�'L�M�"2� A�#����=
�	"�H�Jr c�P�tjtdd��t|�S)zm
    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)r7s r�extract_idsrJ�s&��
�M�M�#�Q���
�D�!�!r )rrr�str�return�None)rrr"rKrLrM)r7rrLzSequence[CertificatePattern])&�__doc__�
__future__r�
contextlibrG�typingr�pyasn1.codec.der.decoderr�pyasn1.type.charr�pyasn1.type.univr�pyasn1_modules.rfc2459r�
exceptionsr
�hazmatrrr
rrrrr�suppress�ImportError�OpenSSL.cryptor�OpenSSL.SSLr�__all__rr#r5rrJ�r r�<module>r^s����#����+�&�-�/�(�	�	�	��Z����%�'�#�&�'��
���B!�H!�!4�5�
�2�j"�M'�'�s�
B�B

Zerion Mini Shell 1.0