관리-도구
편집 파일: ssl_.cpython-36.opt-1.pyc
3 h��f35 � ) @ s d dl mZ d dlZd dlZd dlZd dlZd dlmZmZ d dl m Z mZmZ ddl mZmZmZ ddlmZ dZdZdZdZe eed �Zd d� Zeede�Zy,d dlZd d lmZmZmZ d dlmZ W n ek r� Y nX yd dlm Z m!Z!m"Z" W n" ek �r d6\Z Z!dZ"Y nX e#ed��r2ej$Z$n4yd dl%Z%dd� Z$W n ek �rd dd� Z$Y nX dj&dddddddddd d!d"d#d$d%d&g�Z'yd d'lmZ W n. ek �r� d dl(Z(G d(d)� d)e)�ZY nX d*d+� Z*d,d-� Z+d.d/� Z,d7d0d1�Z-d8d2d3�Z.d4d5� Z/dS )9� )�absolute_importN)�hexlify� unhexlify)�md5�sha1�sha256� )�SSLError�InsecurePlatformWarning�SNIMissingWarning)�sixF)� �( �@ c C sH t t| �t|� �}x*tt| �t|��D ]\}}|||A O }q(W |dkS )z� Compare two digests of equal length in constant time. The digests must be of type str/bytes. Returns True if the digests match, and False otherwise. r )�abs�len�zip� bytearray)�a�b�result�l�r� r �/usr/lib/python3.6/ssl_.py�_const_compare_digest_backport s r Zcompare_digest)�wrap_socket� CERT_NONE�PROTOCOL_SSLv23)�HAS_SNI)�OP_NO_SSLv2�OP_NO_SSLv3�OP_NO_COMPRESSION� � i � inet_ptonc C s t |t�r|jd�}tj|�S )N�ascii)� isinstance�bytes�decode� ipaddressZ ip_address)�_�hostr r r r% D s c C s t j|�S )N)�socketZ inet_aton)r+ r, r r r r% J s �:zTLS13-AES-256-GCM-SHA384zTLS13-CHACHA20-POLY1305-SHA256zTLS13-AES-128-GCM-SHA256zECDH+AESGCMz ECDH+CHACHA20z DH+AESGCMzDH+CHACHA20zECDH+AES256z DH+AES256zECDH+AES128zDH+AESz RSA+AESGCMzRSA+AESz!aNULLz!eNULLz!MD5)� SSLContextc @ s8 e Zd Zdd� Zdd� Zd dd�Zdd � Zddd�ZdS )r/ c C s6 || _ d| _tj| _d | _d| _d | _d | _d | _ d S )NFr ) �protocol�check_hostname�sslr �verify_mode�ca_certs�options�certfile�keyfile�ciphers)�selfZprotocol_versionr r r �__init__v s zSSLContext.__init__c C s || _ || _d S )N)r6 r7 )r9 r6 r7 r r r �load_cert_chain� s zSSLContext.load_cert_chainNc C s || _ |d k rtd��d S )Nz-CA directories not supported in older Pythons)r4 r )r9 ZcafileZcapathr r r �load_verify_locations� s z SSLContext.load_verify_locationsc C s || _ d S )N)r8 )r9 Zcipher_suiter r r �set_ciphers� s zSSLContext.set_ciphersFc C s>