Current File : //usr/lib/python3/dist-packages/service_identity/__pycache__/pyopenssl.cpython-312.pyc |
�
զe� � �0 � d Z ddlmZ ddlZddlZddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZ d d
lmZ d dlmZmZmZmZmZmZmZmZ ej4 e� 5 ddlmZ dd
lmZ ddd� dgZ dd�Z!dd�Z" ed� Z#dd�Z$dd�Z%y# 1 sw Y �%xY w)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 � t t | 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.pyr r '