관리-도구
편집 파일: ssl_.cpython-36.pyc
3 �Pf�/ � ! @ s� d dl mZ d dlZd dlZd dlZd dlmZmZ d dlm Z m Z mZ ddlm Z mZmZ dZdZdZdZe e ed�Zd d � Zeede�Zy,d dlZd dlmZmZmZ d d lmZ W n ek r� Y nX yd dlmZmZmZ W n" ek �r d0\ZZdZY nX dj dddddddddddddd d!d"g�Z!yd d#lmZ W n. ek �rr d dl"Z"G d$d%� d%e#�ZY nX d&d'� Z$d(d)� Z%d*d+� Z&d1d,d-�Z'd2d.d/�Z(dS )3� )�absolute_importN)�hexlify� unhexlify)�md5�sha1�sha256� )�SSLError�InsecurePlatformWarning�SNIMissingWarningF)� �( �@ 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 �: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 @ s\ e Zd Zdej kodk n p*dejkZdd� Zdd� Zdd d �Zdd� Z ddd�Z dS )r% 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__c s zSSLContext.__init__c C s || _ || _d S )N)r. r/ )r1 r. r/ r r r �load_cert_chainn s zSSLContext.load_cert_chainNc C s || _ |d k rtd��d S )Nz-CA directories not supported in older Pythons)r, r )r1 ZcafileZcapathr r r �load_verify_locationsr s z SSLContext.load_verify_locationsc C s | j std��|| _d S )Nz�Your version of Python does not support setting a custom cipher suite. Please upgrade to Python 2.7, 3.2, or later if you need this functionality.)�supports_set_ciphers� TypeErrorr0 )r1 Zcipher_suiter r r �set_ciphersx s zSSLContext.set_ciphersFc C sT t jdt� | j| j| j| j| j|d�}| jrDt |fd| j i|��S t |f|�S d S )Na2 A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings)r/ r. r, � cert_reqs�ssl_version�server_sider0 )�warnings�warnr r/ r. r, r+ r( r5 r r0 )r1 Zsocket�server_hostnamer: �kwargsr r r r � s zSSLContext.wrap_socket)r r&