File: //var/opt/nydus/ops/oscrypto/__pycache__/_tls.cpython-39.pyc
a
�,�h�E � @ s$ d dl mZmZmZmZ d dlZd dlmZ ddlmZm Z m
Z
ddlmZ ddl
mZmZmZ g d�Zd d
� Zdd� Zd
d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zd#d$� Zd%d&� Z d'd(� Z!d)d*� Z"d+d,� Z#d-d.� Z$d/d0� Z%d1d2� Z&d3d4� Z'd5d6� Z(dS )7� )�unicode_literals�division�absolute_import�print_functionN)�datetime� )�Certificate�int_from_bytes�timezone)�CIPHER_SUITE_MAP)�TLSVerificationError�TLSDisconnectError�TLSError)�detect_client_auth_request�
extract_chain�get_dh_params_length�parse_alert�parse_handshake_messages�parse_session_info�parse_tls_records�raise_client_auth�raise_dh_params�raise_disconnection�raise_expired_not_yet_valid�raise_handshake�raise_hostname�raise_no_issuer�raise_protocol_error�
raise_revoked�raise_self_signed�raise_verification�raise_weak_signaturec
C s� g }d}t | �D ]>\}}}|dkr$qt|�D ]\}}|dkr,|} qFq,|r qPq|r�d}|t|�k r�t|||d � �} |d }
|
| }|}||
|� }|�t�|�� qX|S )a
Extracts the X.509 certificates from the server handshake bytes for use
when debugging
:param server_handshake_bytes:
A byte string of the handshake data received from the server
:return:
A list of asn1crypto.x509.Certificate objects
N� � � )r r �lenr �appendr �load)
�server_handshake_bytes�outputZchain_bytes�record_type�_�record_data�message_type�message_data�pointerZcert_lengthZ
cert_startZcert_endZ
cert_bytes� r0 �>/opt/nydus/tmp/pip-target-wkfpz8uv/lib/python/oscrypto/_tls.pyr # s* r c C sD t | �D ]6\}}}|dkrqt|�D ]\}}|dkr$ dS q$qdS )a)
Determines if a CertificateRequest message is sent from the server asking
the client for a certificate
:param server_handshake_bytes:
A byte string of the handshake data received from the server
:return:
A boolean - if a client certificate request was found
r"