관리-도구
편집 파일: sslproto.cpython-36.opt-2.pyc
3 \�e � @ s� d dl Z d dlZyd dlZW n ek r4 dZY nX ddlmZ ddlmZ ddlmZ ddlmZ ddl m Z dd � Zd d� ZdZ d ZdZdZG dd� de�ZG dd� dejej�ZG dd� dej�ZdS )� N� )�base_events)�compat)� protocols)� transports)�loggerc C sj | rt d��ttd�r*tj� }|sfd|_n<tjtj�}| jtjO _| jtj O _|j � tj|_|S )Nz(Server side SSL needs a valid SSLContext�create_default_contextF) � ValueError�hasattr�sslr �check_hostnameZ SSLContextZPROTOCOL_SSLv23ZoptionsZOP_NO_SSLv2ZOP_NO_SSLv3Zset_default_verify_pathsZ CERT_REQUIRED�verify_mode)�server_side�server_hostname� sslcontext� r �(/usr/lib64/python3.6/asyncio/sslproto.py�_create_transport_context s r c C s t td�S )N� MemoryBIO)r r r r r r �_is_sslproto_available% s r Z UNWRAPPEDZDO_HANDSHAKEZWRAPPEDZSHUTDOWNc @ sz e Zd ZdZddd�Zedd� �Zedd � �Zed d� �Zedd � �Z ddd�Z ddd�Zdd� Zddd�Z ddd�ZdS ) �_SSLPipe� i Nc C sH || _ || _|| _t| _tj� | _tj� | _d | _ d| _ d | _d | _d S )NF) �_context�_server_side�_server_hostname� _UNWRAPPED�_stater r � _incoming� _outgoing�_sslobj� _need_ssldata� _handshake_cb�_shutdown_cb)�self�contextr r r r r �__init__D s z_SSLPipe.__init__c C s | j S )N)r )r# r r r r$ Z s z_SSLPipe.contextc C s | j S )N)r )r# r r r � ssl_object_ s z_SSLPipe.ssl_objectc C s | j S )N)r )r# r r r �need_ssldatag s z_SSLPipe.need_ssldatac C s | j tkS )N)r �_WRAPPED)r# r r r �wrappedm s z_SSLPipe.wrappedc C sR | j tkrtd��| jj| j| j| j| jd�| _ t | _ || _| jddd�\}}|S )Nz"handshake in progress or completed)r r � T)�only_handshake) r r �RuntimeErrorr Zwrap_bior r r r r � _DO_HANDSHAKEr! �feed_ssldata)r# �callback�ssldata�appdatar r r �do_handshakev s z_SSLPipe.do_handshakec C sB | j tkrtd��| j tkr$td��t| _ || _| jd�\}}|S )Nzno security layer presentzshutdown in progressr* )r r r, � _SHUTDOWNr"