%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__/cryptography.cpython-312.pyc

�

զe����dZddlmZddlZddlmZddlmZmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZd	d
lmZd	dlmZmZmZmZmZmZmZmZdgZ						dd
�Z 						dd�Z!ed�Z"dd�Z#dd�Z$y)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�F�tt|�t|�gg��y)a�
    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  �?/usr/lib/python3/dist-packages/service_identity/cryptography.pyrr(s"��:�&�{�3��x�(�)���c�F�tt|�t|�gg��y)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`.
    rN)rrr)r �
ip_addresss  r"�verify_certificate_ip_addressr&Ls#��B�&�{�3�$�Z�0�1��r#z1.3.6.1.5.5.7.8.7c
���g}	|jjtj�}|j	|j
j
t�D�cgc]&}tj|jd����(c}�|j	|j
j
t�D�cgc]&}tj|jd����(c}�|j	|j
j
t�D�cgc]
}t|���c}�|j
j
t�D]{}|j t"k(s�t%|j
�\}}t'|t(�r3|j+t-j|j/����rt1d��|Scc}wcc}wcc}w#t2$rY|SwxYw)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.
    zutf-8zUnexpected certificate content.)�
extensions�get_extension_for_oidr�SUBJECT_ALTERNATIVE_NAME�extend�value�get_values_for_typerr�
from_bytes�encoderrrrr
�type_id�
ID_ON_DNS_SRVr
�
isinstancer�appendr�asOctetsrr)	�cert�ids�ext�name�uri�ip�other�srv�_s	         r"rrws���%'�C�!N��o�o�3�3��1�1�
��	�
�
� �I�I�9�9�'�B�
���%�%�d�k�k�'�&:�;�
�	
�	�
�
��9�9�8�8�-��
���%�%�c�j�j��&9�:�
�	
�	�
�
��)�)�7�7�	�B�
��!��$�
�	
��Y�Y�2�2�9�=�	N�E��}�}�
�-�����,���Q��c�9�-��J�J�z�4�4�S�\�\�^�D�E�*�+L�M�M�
	N��J��7
��
��
��%�
��<�J�?
�s#�)G�+G
�7+G�G�	G)�(G)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)r5s r"�extract_idsrF�s&��
�M�M�#�Q���
�D�!�!r#)r rr!�str�return�None)r rr%rGrHrI)r5rrHzSequence[CertificatePattern])%�__doc__�
__future__rrC�typingr�cryptography.x509rrrrr	r
r�cryptography.x509.extensionsr�pyasn1.codec.der.decoderr
�pyasn1.type.charr�
exceptionsr�hazmatrrrrrrrr�__all__rr&r1rrF�r#r"�<module>rUs����#������;�+�&�(�	�	�	�)�
)��!��!�(+�!�	�!�H%��%�*-�%�	�%�P!�!4�5�
�1�h"r#

Zerion Mini Shell 1.0