AlkantarClanX12

Your IP : 3.133.108.224


Current Path : /proc/thread-self/root/proc/self/root/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/lib64/python2.7/ssl.pyo

�
zfc
@sPdZddlZddlZddlZddlZddlmZddlmZddl	Z	ddl	m
Z
mZmZddl	m
Z
ddl	mZmZmZmZmZmZddl	mZmZmZdd	l	mZmZdd
l	mZmZyddl	mZWnek
r+nXd�Zed
�ed�ed�ed�ed�ddl	m Z m!Z!m"Z"m#Z#m$Z$ddl	m%Z%d�e&�j'�D�Z(e)Z*y
e+Z,Wne-k
r�e.Z,nXddl/m/Z/m0Z0m1Z1m2Z3ej4dkr,ddl	m5Z5m6Z6nddl/m/Z/m7Z7m8Z8m9Z9ddl/m:Z:m;Z;ddl<Z<ddl=Z=ddl>Z>e	j?r�dgZ@ngZ@dZAdZBdeCfd��YZDdd �ZEd!�ZFed"d#�ZGd$�ZHd%ed%d&�fd'��YZId(eIfd)��YZJeJd*�eJ_KeJd+�eJ_Ld,e
fd-��YZMeJjKe.e.e.d.�ZNe)e.eOeJjKe.e.e.e.e.d/�	ZPePZQd0ZRd1�ZSeS�aTeUd2�ZVd3e/fd4��YZWe.e.eOee)e.eUeUe.d5�	ZXd6�ZYd7ZZd8Z[d9�Z\d:�Z]e)e.d;�Z^d<�Z_e.e.d=�Z`dS(>s�
This module provides some more Pythonic support for SSL.

Object types:

  SSLSocket -- subtype of socket.socket which does SSL over the socket

Exceptions:

  SSLError -- exception raised for I/O errors

Functions:

  cert_time_to_seconds -- convert time string used for certificate
                          notBefore and notAfter functions to integer
                          seconds past the Epoch (the time values
                          returned from time.time())

  fetch_server_certificate (HOST, PORT) -- fetch the certificate provided
                          by the server running on HOST at port PORT.  No
                          validation of the certificate is performed.

Integer constants:

SSL_ERROR_ZERO_RETURN
SSL_ERROR_WANT_READ
SSL_ERROR_WANT_WRITE
SSL_ERROR_WANT_X509_LOOKUP
SSL_ERROR_SYSCALL
SSL_ERROR_SSL
SSL_ERROR_WANT_CONNECT

SSL_ERROR_EOF
SSL_ERROR_INVALID_ERROR_CODE

The following group define certificate requirements that one side is
allowing/requiring from the other side:

CERT_NONE - no certificates from the other side are required (or will
            be looked at if provided)
CERT_OPTIONAL - certificates are not required, but if provided will be
                validated, and if validation fails, the connection will
                also fail
CERT_REQUIRED - certificates are required, and will be validated, and
                if validation fails, the connection will also fail

The following constants identify various SSL protocol variants:

PROTOCOL_SSLv2
PROTOCOL_SSLv3
PROTOCOL_SSLv23
PROTOCOL_TLS
PROTOCOL_TLSv1
PROTOCOL_TLSv1_1
PROTOCOL_TLSv1_2

The following constants identify various SSL alert message descriptions as per
http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6

ALERT_DESCRIPTION_CLOSE_NOTIFY
ALERT_DESCRIPTION_UNEXPECTED_MESSAGE
ALERT_DESCRIPTION_BAD_RECORD_MAC
ALERT_DESCRIPTION_RECORD_OVERFLOW
ALERT_DESCRIPTION_DECOMPRESSION_FAILURE
ALERT_DESCRIPTION_HANDSHAKE_FAILURE
ALERT_DESCRIPTION_BAD_CERTIFICATE
ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE
ALERT_DESCRIPTION_CERTIFICATE_REVOKED
ALERT_DESCRIPTION_CERTIFICATE_EXPIRED
ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN
ALERT_DESCRIPTION_ILLEGAL_PARAMETER
ALERT_DESCRIPTION_UNKNOWN_CA
ALERT_DESCRIPTION_ACCESS_DENIED
ALERT_DESCRIPTION_DECODE_ERROR
ALERT_DESCRIPTION_DECRYPT_ERROR
ALERT_DESCRIPTION_PROTOCOL_VERSION
ALERT_DESCRIPTION_INSUFFICIENT_SECURITY
ALERT_DESCRIPTION_INTERNAL_ERROR
ALERT_DESCRIPTION_USER_CANCELLED
ALERT_DESCRIPTION_NO_RENEGOTIATION
ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION
ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE
ALERT_DESCRIPTION_UNRECOGNIZED_NAME
ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE
ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE
ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY
i����N(t
namedtuple(tclosing(tOPENSSL_VERSION_NUMBERtOPENSSL_VERSION_INFOtOPENSSL_VERSION(t_SSLContext(tSSLErrortSSLZeroReturnErrortSSLWantReadErrortSSLWantWriteErrortSSLSyscallErrortSSLEOFError(t	CERT_NONEt
CERT_OPTIONALt
CERT_REQUIRED(ttxt2objtnid2obj(tRAND_statustRAND_add(tRAND_egdcCsCx<tt�D].}|j|�r
tt|�t�|<q
q
WdS(N(tdirt_sslt
startswithtgetattrtglobals(tprefixtn((s/usr/lib64/python2.7/ssl.pyt_import_symbolssstOP_tALERT_DESCRIPTION_t
SSL_ERROR_t	PROTOCOL_tVERIFY_(tHAS_SNItHAS_ECDHtHAS_NPNtHAS_ALPNtHAS_TLSv1_3(t_OPENSSL_API_VERSIONcCs:i|]0\}}|jd�r|dkr||�qS(RtPROTOCOL_SSLv23(R(t.0tnametvalue((s/usr/lib64/python2.7/ssl.pys
<dictcomp>�s		(tsockett_fileobjectt_delegate_methodsterrortwin32(tenum_certificatest	enum_crls(R+tAF_INETtSOCK_STREAMtcreate_connection(t
SOL_SOCKETtSO_TYPEs
tls-uniques�TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:!aNULL:!eNULL:!MD5:!3DESs�TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:ECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:!aNULL:!eNULL:!MD5:!DSS:!RC4:!3DEStCertificateErrorcBseZRS((t__name__t
__module__(((s/usr/lib64/python2.7/ssl.pyR7�sic
CsRg}|stS|jd�}|d}|d}|jd�}||krgtdt|���n|s�|j�|j�kS|dkr�|jd�nY|jd�s�|jd�r�|jtj	|��n"|jtj	|�j
dd	��x$|D]}|jtj	|��q�Wtjd
dj|�dtj
�}	|	j|�S(
shMatching according to RFC 6125, section 6.4.3

    http://tools.ietf.org/html/rfc6125#section-6.4.3
    t.iit*s,too many wildcards in certificate DNS name: s[^.]+sxn--s\*s[^.]*s\As\.s\Z(tFalsetsplittcountR7treprtlowertappendRtretescapetreplacetcompiletjoint
IGNORECASEtmatch(
tdnthostnamet
max_wildcardstpatstpiecestleftmostt	remaindert	wildcardstfragtpat((s/usr/lib64/python2.7/ssl.pyt_dnsname_match�s*

"
&cCs[|std��ng}|jdd
�}xC|D];\}}|dkr4t||�r_dS|j|�q4q4W|s�xc|jdd�D]L}xC|D];\}}|dkr�t||�r�dS|j|�q�q�Wq�Wnt|�dkrtd|d	jtt|��f��n;t|�dkrKtd
||df��ntd��dS(s)Verify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
    rules are followed, but IP addresses are not accepted for *hostname*.

    CertificateError is raised on failure. On success, the function
    returns nothing.
    stempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDtsubjectAltNametDNSNtsubjectt
commonNameis&hostname %r doesn't match either of %ss, shostname %r doesn't match %ris=no appropriate commonName or subjectAltName fields were found(((	t
ValueErrortgetRSRAtlenR7RFtmapR?(tcertRJtdnsnamestsantkeyR*tsub((s/usr/lib64/python2.7/ssl.pytmatch_hostname�s.%tDefaultVerifyPathssQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcCs�tj�}tjj|d|d�}tjj|d|d�}ttjj|�ra|ndtjj	|�r||nd|�S(s/Return paths to default cafile and capath.
    iiiiN(
Rtget_default_verify_pathstostenvironRYRbtpathtisfiletNonetisdir(tpartstcafiletcapath((s/usr/lib64/python2.7/ssl.pyRc.st_ASN1Objectsnid shortname longname oidcBs;eZdZdZd�Zed��Zed��ZRS(s#ASN.1 object identifier lookup
    cCs%tt|�j|t|dt��S(NR)(tsuperRmt__new__t_txt2objR<(tclstoid((s/usr/lib64/python2.7/ssl.pyRoAscCstt|�j|t|��S(s3Create _ASN1Object from OpenSSL numeric ID
        (RnRmRot_nid2obj(Rqtnid((s/usr/lib64/python2.7/ssl.pytfromnidDscCs%tt|�j|t|dt��S(s=Create _ASN1Object from short name, long name or OID
        R)(RnRmRoRptTrue(RqR)((s/usr/lib64/python2.7/ssl.pytfromnameJs((R8R9t__doc__t	__slots__RotclassmethodRuRw(((s/usr/lib64/python2.7/ssl.pyRm<s
	tPurposecBseZdZRS(sDSSLContext purpose flags with X509v3 Extended Key Usage objects
    (R8R9Rx(((s/usr/lib64/python2.7/ssl.pyR{Qss1.3.6.1.5.5.7.3.1s1.3.6.1.5.5.7.3.2t
SSLContextcBskeZdZdZd
Zd�Zd�Zeeedd�Z
d�Zd	�Zd
�Z
ejd�ZRS(s|An SSLContext holds various SSL-related configuration options and
    data, such as certificates and possibly a private key.tprotocolt__weakref__tCAtROOTcOs2tj||�}|tkr.|jt�n|S(N(RRot_SSLv2_IF_EXISTStset_cipherst_DEFAULT_CIPHERS(RqR}targstkwargstself((s/usr/lib64/python2.7/ssl.pyRo`scCs
||_dS(N(R}(R�R}((s/usr/lib64/python2.7/ssl.pyt__init__fsc
Cs+td|d|d|d|d|d|�S(Ntsocktserver_sidetdo_handshake_on_connecttsuppress_ragged_eofstserver_hostnamet_context(t	SSLSocket(R�R�R�R�R�R�((s/usr/lib64/python2.7/ssl.pytwrap_socketis
cCs�t�}xp|D]h}|jd�}t|�dksIt|�dkrXtd��n|jt|��|j|�qW|j|�dS(Ntasciiii�s(NPN protocols must be 1 to 255 in length(t	bytearraytencodeRZRRAtextendt_set_npn_protocols(R�t
npn_protocolstprotosR}tb((s/usr/lib64/python2.7/ssl.pytset_npn_protocolsss	
$cCs�t�}xp|D]h}|jd�}t|�dksIt|�dkrXtd��n|jt|��|j|�qW|j|�dS(NR�ii�s)ALPN protocols must be 1 to 255 in length(R�R�RZRRAR�t_set_alpn_protocols(R�talpn_protocolsR�R}R�((s/usr/lib64/python2.7/ssl.pytset_alpn_protocols~s	
$cCs�t�}y^xWt|�D]I\}}}|dkr|tksO|j|krb|j|�qbqqWWntk
r�tjd�nX|r�|jd|�n|S(Ntx509_asns-unable to enumerate Windows certificate storetcadata(	R�R0RvRrR�tOSErrortwarningstwarntload_verify_locations(R�t	storenametpurposetcertsR\tencodingttrust((s/usr/lib64/python2.7/ssl.pyt_load_windows_store_certs�s	
cCsbt|t�st|��ntjdkrTx$|jD]}|j||�q7Wn|j�dS(NR/(t
isinstanceRmt	TypeErrortsystplatformt_windows_cert_storesR�tset_default_verify_paths(R�R�R�((s/usr/lib64/python2.7/ssl.pytload_default_certs�s(R}R~(RR�N(R8R9RxRyR�RoR�R<RvRhR�R�R�R�R{tSERVER_AUTHR�(((s/usr/lib64/python2.7/ssl.pyR|Ys					cCs�t|t�st|��ntt�}|tjkrNt|_t	|_
n|tjkrm|jt
�n|s|s|r�|j|||�n|jtkr�|j|�n|S(s�Create a SSLContext object with default settings.

    NOTE: The protocol and settings may change anytime without prior
          deprecation. The values represent a fair balance between maximum
          compatibility and security.
    (R�RmR�R|tPROTOCOL_TLSR{R�Rtverify_modeRvtcheck_hostnametCLIENT_AUTHR�t_RESTRICTED_SERVER_CIPHERSR�RR�(R�RkRlR�tcontext((s/usr/lib64/python2.7/ssl.pytcreate_default_context�s	c	
Cs�t|t�st|��nt|�}	|dk	rB||	_n||	_|rg|rgtd��n|ss|r�|	j||�n|s�|s�|r�|	j	|||�n|	jt
kr�|	j|�n|	S(s/Create a SSLContext object for Python stdlib modules

    All Python stdlib modules shall use this function to create SSLContext
    objects in order to keep common settings in one place. The configuration
    is less restrict than create_default_context()'s to increase backward
    compatibility.
    scertfile must be specifiedN(R�RmR�R|RhR�R�RXtload_cert_chainR�RR�(
R}t	cert_reqsR�R�tcertfiletkeyfileRkRlR�R�((s/usr/lib64/python2.7/ssl.pyt_create_unverified_context�s	
tPYTHONHTTPSVERIFYcCs5tjjs1tjjt�}|dkr1tSntS(Nt0(	R�tflagstignore_environmentRdReRYt_https_verify_envvarR�R�(tconfig_setting((s/usr/lib64/python2.7/ssl.pyt_get_https_context_factory�s
cCs|rtantadS(s,Verify server HTTPS certificates by default?N(R�t_create_default_https_contextR�(tenable((s/usr/lib64/python2.7/ssl.pyt_https_verify_certificates�s	R�cBs�eZdZd'd'd'eeed'eee	dd'ed'd'd'd'd�Z
ed��Zej
d��Zd�Zd'd�Zd�Zdd'd	�Zd
�Zed�Zd�Zd
�Zd�Zd�Zdd�Zd'd�Zdd�Zddd�Zd'dd�Zddd�Zd'dd�Zd�Zd�Z d�Z!d�Z"d�Z#ed�Z$d�Z%d�Z&d�Z'd �Z(d!d"d#�Z)d$d%�Z*d&�Z+RS((s�This class implements a subtype of socket.socket that wraps
    the underlying OS socket in an SSL context when necessary, and
    provides read and write methods over that channel.icCs�d|_d|_|r$||_n|r@|r@td��n|r\|r\td��n|rr|rr|}nt|�|_||j_|r�|jj|�n|r�|jj||�n|r�|jj	|�n|r�|jj
|�n||_||_||_
||_||_||_|jtt�tkrQtd��ntj|d|j�x3tD]+}yt||�Wqntk
r�qnXqnW|r�|r�td��n|jjr�|r�td��n||_||_||_|
|_ |j!�}y|j"�Wnt#k
r0}|j$t$j%krB�nt&}|j!�dk}|j't&�y|j(d�}Wn:t#k
r�}|j$t$j%t$j)fkr��nd	}nX|j'|�|r7d
}t*|j$|�}||_+d|_,y|j-�Wnt.k
rnXz
|�Wdd}Xq7nXt/}|j0|�t&|_1d|_||_2|r�yb|jj3|j||d|�|_|r�|j!�}|dkr�td
��n|j4�nWq�t.tfk
r�|j-��q�XndS(Nis5certfile must be specified for server-side operationsscertfile must be specifieds!only stream sockets are supportedt_socks4server_hostname can only be specified in client modes'check_hostname requires server_hostnameits4Closed before TLS handshake with data in recv buffertssl_sockgsHdo_handshake_on_connect should not be specified for non-blocking sockets(5Rht_sslobjt_makefile_refsR�RXR|R�R�R�R�R�R�R�R�tssl_versiontca_certstcipherst
getsockoptR5R6R3tNotImplementedErrorR+R�R�R-tdelattrtAttributeErrorR�R�R�R�R�t
gettimeouttgetpeernametsocket_errorterrnotENOTCONNR<tsetblockingtrecvtEINVALRtreasontlibrarytcloseR�Rvt
settimeoutt_closedt
_connectedt_wrap_sockettdo_handshake(R�R�R�R�R�R�R�R�R�tfamilyttypetprototfilenoR�R�R�R�R�tattrtsock_timeouttet	connectedtblockingtnotconn_pre_handshake_dataR�t notconn_pre_handshake_data_errorttimeout((s/usr/lib64/python2.7/ssl.pyR�s�			


							

				


		


			
cCs|jS(N(R�(R�((s/usr/lib64/python2.7/ssl.pyR��scCs||_||j_dS(N(R�R�R�(R�tctx((s/usr/lib64/python2.7/ssl.pyR��s	cCstd|jj��dS(NsCan't dup() %s instances(R�t	__class__R8(R�((s/usr/lib64/python2.7/ssl.pytdup�scCsdS(N((R�tmsg((s/usr/lib64/python2.7/ssl.pyt_checkClosed�scCs|js|j�ndS(N(R�R�(R�((s/usr/lib64/python2.7/ssl.pyt_check_connected�s	icCs�|j�|js"td��ny>|dk	rI|jj||�}n|jj|�}|SWnItk
r�}|jdtkr�|jr�|dk	r�dSdSq��nXdS(sORead up to LEN bytes and return them.
        Return zero-length string on EOF.s'Read on closed or unwrapped SSL socket.iR�N(	R�R�RXRhtreadRR�t
SSL_ERROR_EOFR�(R�RZtbuffertvtx((s/usr/lib64/python2.7/ssl.pyR��s
	cCs2|j�|js"td��n|jj|�S(shWrite DATA to the underlying SSL channel.  Returns
        number of bytes of DATA actually transmitted.s(Write on closed or unwrapped SSL socket.(R�R�RXtwrite(R�tdata((s/usr/lib64/python2.7/ssl.pyR��s
	cCs$|j�|j�|jj|�S(s�Returns a formatted version of the data in the
        certificate provided by the other end of the SSL channel.
        Return None if no certificate was provided, {} if a
        certificate was provided, but not validated.(R�R�R�tpeer_certificate(R�tbinary_form((s/usr/lib64/python2.7/ssl.pytgetpeercert�s

cCs3|j�|jstjr"dS|jj�SdS(N(R�R�RR#Rhtselected_npn_protocol(R�((s/usr/lib64/python2.7/ssl.pyR��s
cCs3|j�|jstjr"dS|jj�SdS(N(R�R�RR$Rhtselected_alpn_protocol(R�((s/usr/lib64/python2.7/ssl.pyR��s
cCs(|j�|jsdS|jj�SdS(N(R�R�Rhtcipher(R�((s/usr/lib64/python2.7/ssl.pyR�s
	cCs(|j�|jsdS|jj�SdS(N(R�R�Rhtcompression(R�((s/usr/lib64/python2.7/ssl.pyR�s
	cCs�|j�|jr�|dkr5td|j��ny|jj|�}WnDtk
r�}|jdtkrtdS|jdtkr�dS�q�X|Sn|j	j
||�SdS(Nis3non-zero flags not allowed in calls to send() on %s(R�R�RXR�R�RR�tSSL_ERROR_WANT_READtSSL_ERROR_WANT_WRITER�tsend(R�R�R�R�R�((s/usr/lib64/python2.7/ssl.pyR�s 
	cCsb|j�|jr)td|j��n5|dkrH|jj||�S|jj|||�SdS(Ns%sendto not allowed on instances of %s(R�R�RXR�RhR�tsendto(R�R�t
flags_or_addrtaddr((s/usr/lib64/python2.7/ssl.pyR�s
	cCs�|j�|jr{|dkr5td|j��nt|�}d}x-||krv|j||�}||7}qJW|Stj|||�SdS(Nis6non-zero flags not allowed in calls to sendall() on %s(R�R�RXR�RZRR+tsendall(R�R�R�tamountR>R�((s/usr/lib64/python2.7/ssl.pyR�s
	cCsY|j�|jrB|dkr5td|j��n|j|�S|jj||�SdS(Nis3non-zero flags not allowed in calls to recv() on %s(R�R�RXR�R�R�R�(R�tbuflenR�((s/usr/lib64/python2.7/ssl.pyR�s
	
cCs�|j�|r+|dkr+t|�}n|dkr@d}n|jr{|dkrktd|j��n|j||�S|jj|||�SdS(Niis8non-zero flags not allowed in calls to recv_into() on %s(	R�RhRZR�RXR�R�R�t	recv_into(R�R�tnbytesR�((s/usr/lib64/python2.7/ssl.pyRs
		cCs@|j�|jr)td|j��n|jj||�SdS(Ns'recvfrom not allowed on instances of %s(R�R�RXR�R�trecvfrom(R�R
R�((s/usr/lib64/python2.7/ssl.pyR
)s

	cCsC|j�|jr)td|j��n|jj|||�SdS(Ns,recvfrom_into not allowed on instances of %s(R�R�RXR�R�t
recvfrom_into(R�R�RR�((s/usr/lib64/python2.7/ssl.pyR1s

	cCs(|j�|jr |jj�SdSdS(Ni(R�R�tpending(R�((s/usr/lib64/python2.7/ssl.pyR:s
	
cCs'|j�d|_tj||�dS(N(R�RhR�R+tshutdown(R�thow((s/usr/lib64/python2.7/ssl.pyRAs
	cCs;|jdkr(d|_tj|�n|jd8_dS(Ni(R�RhR�R+R�(R�((s/usr/lib64/python2.7/ssl.pyR�Fs	cCs?|jr%|jj�}d|_|Stdt|���dS(NsNo SSL wrapper around (R�RRhRXtstr(R�ts((s/usr/lib64/python2.7/ssl.pytunwrapMs
		cCsd|_tj|�dS(N(RhR�R+t_real_close(R�((s/usr/lib64/python2.7/ssl.pyRUs	cCs�|j�|j�}z3|dkr;|r;|jd�n|jj�Wd|j|�X|jjr�|js~t	d��nt
|j�|j�ndS(sPerform a TLS/SSL handshake.gNs-check_hostname needs server_hostname argument(R�R�R�RhR�R�R�R�R�RXRaR�(R�tblockR�((s/usr/lib64/python2.7/ssl.pyR�Ys
	cCs�|jrtd��n|jr0td��n|jj|jt|jd|�|_ya|rut	j
||�}nd}t	j||�|s�t
|_|jr�|j�q�n|SWn#ttfk
r�d|_�nXdS(Ns!can't connect in server-side modes/attempt to connect already-connected SSLSocket!R�(R�RXR�R�R�R�R<R�R�R+t
connect_exRhtconnectRvR�R�R�(R�RRtrc((s/usr/lib64/python2.7/ssl.pyt
_real_connectjs$		'			cCs|j|t�dS(sQConnects to remote ADDR, and then wraps the connection in
        an SSL channel.N(RR<(R�R((s/usr/lib64/python2.7/ssl.pyR�scCs|j|t�S(sQConnects to remote ADDR, and then wraps the connection in
        an SSL channel.(RRv(R�R((s/usr/lib64/python2.7/ssl.pyR�scCsItj|�\}}|jj|d|jd|jdt�}||fS(s�Accepts a new connection from a remote client, and returns
        a tuple containing that new connection wrapped with a server-side
        SSL channel, and the address of the remote client.R�R�R�(R+tacceptR�R�R�R�Rv(R�tnewsockR((s/usr/lib64/python2.7/ssl.pyR�s			tri����cCs%|jd7_t|||dt�S(s�Make and return a file-like object that
        works with the SSL connection.  Just use the code
        from the socket module.iR�(R�R,Rv(R�tmodetbufsize((s/usr/lib64/python2.7/ssl.pytmakefile�ss
tls-uniquecCs_|tkrtd��n|dkr?tdj|���n|jdkrRdS|jj�S(s�Get channel binding data for current connection.  Raise ValueError
        if the requested `cb_type` is not supported.  Return bytes of the data
        or None if the data is not available (e.g. before the handshake).
        s Unsupported channel binding types
tls-uniques({0} channel binding type not implementedN(tCHANNEL_BINDING_TYPESRXR�tformatR�Rht
tls_unique_cb(R�tcb_type((s/usr/lib64/python2.7/ssl.pytget_channel_binding�scCs |jdkrdS|jj�S(s�
        Return a string identifying the protocol version used by the
        current SSL channel, or None if there is no established channel.
        N(R�Rhtversion(R�((s/usr/lib64/python2.7/ssl.pyR&�sN(,R8R9RxRhR<RR�RvR2R3R�tpropertyR�tsetterR�R�R�R�R�R�R�R�RRRRRR�RR
RRRR�RRR�RRRRR R%R&(((s/usr/lib64/python2.7/ssl.pyR�sR		u				
														c

CsCtd|d|d|d|d|d|d|d|d	|d
|	�
S(NR�R�R�R�R�R�R�R�R�R�(R�(
R�R�R�R�R�R�R�R�R�R�((s/usr/lib64/python2.7/ssl.pyR��scCs�ddlm}ddlm}d}d}y!|j|d j��d}Wn'tk
rvtd||f��n3X||d|�}||d|f|dd!�SdS(s�Return the time in seconds since the Epoch, given the timestring
    representing the "notBefore" or "notAfter" date from a certificate
    in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale).

    "notBefore" or "notAfter" dates must use UTC (RFC 5280).

    Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    UTC should be specified as GMT (see ASN1_TIME_print())
    i����(tstrptime(ttimegmtJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDecs %d %H:%M:%S %Y GMTiis*time data %r does not match format "%%b%s"iiiN(R+R,R-R.R/R0R1R2R3R4R5R6(ttimeR)tcalendarR*tindexttitleRX(t	cert_timeR)R*tmonthsttime_formattmonth_numberttt((s/usr/lib64/python2.7/ssl.pytcert_time_to_seconds�s
!
s-----BEGIN CERTIFICATE-----s-----END CERTIFICATE-----cCs<tj|�jd�}tdtj|d�dtdS(s[Takes a certificate in binary DER format and returns the
    PEM version of it as a string.R�s
i@(tbase64tstandard_b64encodetdecodet
PEM_HEADERttextwraptfillt
PEM_FOOTER(tder_cert_bytestf((s/usr/lib64/python2.7/ssl.pytDER_cert_to_PEM_cert�scCs�|jt�s"tdt��n|j�jt�sJtdt��n|j�tt�tt�!}tj|j	dd��S(shTakes a certificate in ASCII PEM format and returns the
    DER-encoded version of it as a byte sequences(Invalid PEM encoding; must start with %ss&Invalid PEM encoding; must end with %stASCIItstrict(
RRDRXtstriptendswithRGRZRAtdecodestringR�(tpem_cert_stringtd((s/usr/lib64/python2.7/ssl.pytPEM_cert_to_DER_cert�s

 c

Cs�|\}}|dk	r!t}nt}t|d|d|�}tt|���4}t|j|���}|jt�}	WdQXWdQXt	|	�S(s�Retrieve the certificate from the server at the specified address,
    and return it as a PEM-encoded string.
    If 'ca_certs' is specified, validate the server cert against it.
    If 'ssl_version' is specified, use it in the connection attempt.R�RkN(
RhRRt_create_stdlib_contextRR4R�R�RvRJ(
RR�R�thosttportR�R�R�tsslsocktdercert((s/usr/lib64/python2.7/ssl.pytget_server_certificates			cCstj|d�S(Ns	<unknown>(t_PROTOCOL_NAMESRY(t
protocol_code((s/usr/lib64/python2.7/ssl.pytget_protocol_namescCs�t|d�r|j}ntt�}|s3|rF|j||�n|j|dt�}y|j�Wntk
r|nX|j	�|S(s�A replacement for the old socket.ssl function.  Designed
    for compability with Python 2.5 and earlier.  Will disappear in
    Python 3.0.R�R�(
thasattrR�R|R'R�R�R<R�R�R�(R�R�R�R�R�((s/usr/lib64/python2.7/ssl.pytsslwrap_simples

(aRxRERBR�RdtcollectionsRt
contextlibRRRRRRRRRR	R
RRR
RRRpRRsRRRtImportErrorRR!R"R#R$R%R&RtitemsRYR�R'tPROTOCOL_SSLv2R�t	NameErrorRhR+R,R-R.R�R�R0R1R2R3R4R5R6RAR�R�tHAS_TLS_UNIQUER!R�R�RXR7RSRaRbRcRmR{R�R�R|R�R<R�RSR�R�R�RvR�R�R�R@RDRGRJRRRXR[R](((s/usr/lib64/python2.7/ssl.pyt<module>Ys�.
	




(


""	3	+		G		%			��