Current File : //opt/imh-python/lib/python2.7/test/test_ssl.pyc
�
��Wc@s@ddlZddlZddlmZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlmZejd�Zeej�ZejZd�Zed�Zej ej!��Z"ed�Z#ed	�Z$e#j ej!��Z%e$j ej!��Z&ed
�Z'ed�Z(dZ)ed
�Z*e*j ej!��Z+ed
d�Z,ed
d�Z-ed�Z.ed�Z/ed�Z0ed�Z1dZ2ed�Z3ed�Z4ed�Z5ed�Z6ed�Z7ed�Z8ed�Z9ed�Z:e:j ej!��Z;d�Z<dej=fd��YZ>d �Z?d!�Z@d"�ZAd#�ZBd$�ZCd%�ZDejEejFd&�ZGd'ej=fd(��YZHd)ej=fd*��YZId+ej=fd,��YZJd-ej=fd.��YZKyddlLZLWneMk
r�eNZOn�XePZOdd/lQmRZRd0eLjSfd1��YZTd2eLjSfd3��YZUd4ePeNeVd5�ZWeVd6d6d7�ZXd8ej=fd9��YZYeNd:�ZZe[d;kr<eZ�ndS(<i����N(ttest_support(tassert_python_ok(tclosingtsslcGstjjtjjt�|�S(N(tostpathtjointdirnamet__file__(tname((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt	data_filesskeycert.pemsssl_cert.pemsssl_key.pemskeycert.passwd.pemsssl_key.passwd.pemtsomepasstcapaths
4e1295a3.0s
5ed36f99.0srevocation.crlskeycert3.pemskeycert4.pemspycacert.pemsself-signed.pythontest.netsselfsigned_pythontestdotnet.pemsnullcert.pemsbadcert.pemsXXXnonexisting.pems
badkey.pems	nokia.pemsnullbytecert.pems
dh1024.pemcCsBdjtjtj���}tjr>tjj||�ndS(Nt (	Rt	tracebacktformat_exceptiontsystexc_infotsupporttverbosetstdouttwrite(tprefixt
exc_format((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pythandle_errorKs	t
BasicTestscBseZd�ZRS(cCs�ytjtjtj��Wn(tk
rG}|jdkrAqH�nXy tjtjtj�j�Wn(tk
r�}|jdkr�q��nXdS(Ni (Rtsslwrap_simpletsockettAF_INETtIOErrorterrnot_sock(tselfte((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_sslwrap_simpleSs (t__name__t
__module__R"(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRQscCs
tjdkS(Nii	ii
i(ii	ii
i(Rt_OPENSSL_API_VERSION(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytcan_clear_optionsescCs
tjdkS(Nii	iii(ii	iii(RtOPENSSL_VERSION_INFO(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytno_sslv2_implies_sslv3_helloiscCs
tjdkS(Nii	ii(ii	iii(RR'(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pythave_verify_flagsmscCs.tjr&tj�jdkr&tjStjS(Ni(ttimetdaylightt	localtimettm_isdsttaltzonettimezone(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
utc_offsetqscCs{tjdkrwd}tjj||�}|jdd�}|j|�}|ddkrw|d d	|d
}qwn|S(Nii	iis%b %d %H:%M:%S %Y GMTtsecondit0R
i(ii	ii	i(RR%tdatetimetstrptimetreplacetstrftime(t	cert_timetfmttdt((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytasn1timewscs9ttd�r1tj���fd��}|S�SdS(NtPROTOCOL_SSLv2cskytjtj�WnGtjk
r]tjd	kr^tj�d
kr^tjd��q^nX�||�S(Nii	iitdebianssqueeze/sidts'Patched Ubuntu OpenSSL breaks behaviour(ii	iii(R<ssqueeze/sidR=(	Rt
SSLContextR;tSSLErrorR'tplatformtlinux_distributiontunittesttSkipTest(targstkwargs(tfunc(sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytf�s(thasattrRt	functoolstwraps(RFRG((RFsf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytskip_if_broken_ubuntu_ssl�s	s SNI support needed for this testtBasicSocketTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zej	d��Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zejdejkd�d��Zd�Zejejdkd�d��Zejejdkd�d��Zd�Zd�Z d�Z!d�Z"d�Z#eje$�d�d��Z%d �Z&ej'd!d"�d#��Z(RS($cCs�tjtjtjtjtjtjr6tjntjdkrOtj	n|j
tjtt
h�|j
tjtt
h�dS(Nii(ii(Rt	CERT_NONEt
CERT_OPTIONALt
CERT_REQUIREDtOP_CIPHER_SERVER_PREFERENCEtOP_SINGLE_DH_USEtHAS_ECDHtOP_SINGLE_ECDH_USER'tOP_NO_COMPRESSIONtassertIntHAS_SNItTruetFalse(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_constants�s	

cCs�tj�}tjr>tjjd||r0dp3df�nttd�r|jt	tj
d�|jt	tj
dd�ntjdd�dS(	Ns
 RAND_status is %d (%s)
ssufficient randomnesssinsufficient randomnesstRAND_egditfoosthis is a random stringg�R@(RtRAND_statusRRRRRRHtassertRaisest	TypeErrorRZtRAND_add(R tv((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_random�s	cCsttjjt�}tjr?tjjdt	j
|�d�n|j|dddd!d#f�|j|dtd��|j|d
td��|j|dd�|j|dd%d'd)d+f�|j|dd-�tjjt
�}tjrtjjdt	j
|�d�n|j|dd.d/f�|j|dd0�|j|dd1�|j|dd2�dS(3Ns
tissuertcountryNametXYtlocalityNamesCastle AnthraxtorganizationNamesPython Software Foundationt
commonNamet	localhosttnotAftersOct  5 23:01:56 2020 GMTt	notBeforesOct  8 23:01:56 2010 GMTtserialNumbertD7C7381919AFC24EtsubjecttsubjectAltNametDNSsprojects.developer.nokia.comsprojects.forum.nokia.comtOCSPshttp://ocsp.verisign.comt	caIssuerss0http://SVRIntl-G3-aia.verisign.com/SVRIntlG3.certcrlDistributionPointss0http://SVRIntl-G3-crl.verisign.com/SVRIntlG3.crl(RcRd((RcRd(ResCastle Anthrax((ResCastle Anthrax(RfsPython Software Foundation((RfsPython Software Foundation(RgRh((RgRh(RcRd((RcRd(ResCastle Anthrax((ResCastle Anthrax(RfsPython Software Foundation((RfsPython Software Foundation(RgRh((RgRh(RoRh((RoRh(Rosprojects.developer.nokia.com(Rosprojects.forum.nokia.com(shttp://ocsp.verisign.com(s0http://SVRIntl-G3-aia.verisign.com/SVRIntlG3.cer(s0http://SVRIntl-G3-crl.verisign.com/SVRIntlG3.crl(Rt_sslt_test_decode_certtCERTFILERRRRRtpprinttpformattassertEqualR:t	NOKIACERT(R tp((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_parse_cert�s8	$



	$



cCs�tjjt�}tjr?tjjdt	j
|�d�nd!d#d%d'd)d+d-f}|j|d|�|j|d|�tjd.kr�d/d0d1d2d3f}nd4d5d6d7d8f}|j|d|�dS(9Ns
RctUStstateOrProvinceNametOregonRet	BeavertonRfsPython Software FoundationtorganizationalUnitNamesPython Core DevelopmentRgsnull.python.orgexample.orgtemailAddressspython-dev@python.orgRmRbii	iRosaltnull.python.orgexample.comtemails null@python.orguser@example.orgtURIs)http://null.python.orghttp://example.orgs
IP Addresss	192.0.2.1s2001:DB8:0:0:0:0:0:1
s	<invalid>Rn(scountryNameR|((scountryNameR|(R}R~((R}R~(slocalityNameR((slocalityNameR(sorganizationNamesPython Software Foundation((sorganizationNamesPython Software Foundation(R�sPython Core Development((R�sPython Core Development(s
commonNamesnull.python.orgexample.org((s
commonNamesnull.python.orgexample.org(R�spython-dev@python.org((R�spython-dev@python.org(ii	i(sDNSsaltnull.python.orgexample.com(R�s null@python.orguser@example.org(R�s)http://null.python.orghttp://example.org(s
IP Addresss	192.0.2.1(s
IP Addresss2001:DB8:0:0:0:0:0:1
(sDNSsaltnull.python.orgexample.com(R�s null@python.orguser@example.org(R�s)http://null.python.orghttp://example.org(s
IP Addresss	192.0.2.1(s
IP Addresss	<invalid>(
RRsRttNULLBYTECERTRRRRRRvRwRxR%(R RzRmtsan((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_parse_cert_CVE_2013_4238�s0	$		cCs�ttd��}|j�}WdQXtj|�}tj|�}tj|�}|j||�|jtjd�s�|j	d|�n|j
dtjd�s�|j	d|�ndS(Ntrs
s-DER-to-PEM didn't include correct header:
%r
s-DER-to-PEM didn't include correct footer:
%r
(topent
CAFILE_CACERTtreadRtPEM_cert_to_DER_certtDER_cert_to_PEM_certRxt
startswitht
PEM_HEADERtfailtendswitht
PEM_FOOTER(R RGtpemtd1tp2td2((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_DER_to_PEM�sc	Cs�tj}tj}tj}|j|ttf�|j|t�|j|t�|j	|d�|j
|d�|\}}}}}|j	|d�|j
|d�|j	|d�|j
|d�|j	|d�|j
|d�|j	|d�|j|d�|j	|d�|j|d�d|kr`|j|j
d	j||��||f�n.|j|j
d
j|||��||f�dS(Ni�i0iiii?itLibreSSLsLibreSSL {:d}.{:d}sOpenSSL {:d}.{:d}.{:d}(RtOPENSSL_VERSION_NUMBERR'tOPENSSL_VERSIONtassertIsInstancetinttlongttupletstrtassertGreaterEqualt
assertLesstassertLessEqualt
assertTrueR�tformat(	R tntttstmajortminortfixtpatchtstatus((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_openssl_versions0			!cCsJtjtj�}tj|�}tj|�}~|j|�d�dS(N(RRRtwrap_sockettweakreftrefRxtNone(R R�tsstwr((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
test_refcycle#s
c
Cs�tjtj�}ttj|����}|jtj|jd�|jtj|jt	d��|jtj|j
d�|jtj|jt	d�d�|jtj|jd�|jtj|j
dd�WdQXdS(Nitxs0.0.0.0i(s0.0.0.0i(RRRRR�R]terrortrecvt	recv_intot	bytearraytrecvfromt
recvfrom_intotsendtsendto(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_wrapped_unconnected-s"cCshxadD]Y}tjtj�}|j|�ttj|���}|j||j��WdQXqWdS(Ngg@(Ngg@(	R�RRt
settimeoutRRR�Rxt
gettimeout(R ttimeoutR�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_timeout9s


cCs�tj�}|jtdtj|dt�|jtdtj|dt�|jtdtj|dtdd�ttj|dtdt���&}|jtd|jt	df�WdQX|j
t��5}ttj���}tj|dt�WdQXWdQX|j
|jjtj�|j
t��;}ttj��� }tj|dtdt�WdQXWdQX|j
|jjtj�|j
t��;}ttj��� }tj|dtdt�WdQXWdQX|j
|jjtj�dS(	Nscertfile must be specifiedtkeyfiles5certfile must be specified for server-side operationstserver_sidetcertfileR=s!can't connect in server-side modei�(RtassertRaisesRegexpt
ValueErrorRR�RuRWRtconnecttHOSTR]RtNONEXISTINGCERTRxt	exceptionRtENOENT(R tsockR�tcm((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_errorsBs6			$c
Cstjjtjjt�p!tj|�}tj�}|j|j�|j	t
j��!t
j|d|dt
j
�WdQXdS(s;Check that trying to use the given client certificate failsR�tssl_versionN(RRRRRtcurdirRt
addCleanuptcloseR]RR?R�tPROTOCOL_TLSv1(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
bad_cert_test_s!	cCs|jd�dS(s Wrapping with an empty cert filesnullcert.pemN(R�(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_empty_certjscCs|jd�dS(s:Wrapping with a badly formatted certificate (syntax error)sbadcert.pemN(R�(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_malformed_certnscCs|jd�dS(s2Wrapping with a badly formatted key (syntax error)s
badkey.pemN(R�(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_malformed_keyrscs�d�}�fd�}idEd6}||d�||d�||d�||d�||d	�||d
�idHd6}||d�||d
�||d�||d�||d�idKd6}||d�||d�||d�||d�||d�idNd6}||d�||d	�||d�idQd6}||d
�||d�||d�||d�idTd6}||d�||d�||d�djd�jd�}id|fffd6}|||�idWd6}|||�idZd6}|||�d!jd�jd�}id|fffd6}||d"jd�jd��||d#jd�jd��||d$jd�jd��||d%jd�jd��id&d'6d]d6d^d_d`fd.6}||d*�||d+�||d-�||d(�id/d'6dbdddfdhdjfd6}||d8�||d9�||d3�id/d'6dldndpdrfd6}||d8�id:d'6dtdvdxdzfd6d|d.6}||d8�id:d'6d~d�d�d�fd6d�d.6}||d<��jttjdd��jttjid�id�d6}||d>�id�d6}||d>�id�d6}�jtj��}tj|dA�WdQX�jdBt	|j
��dS(�NcSstj||�dS(N(Rtmatch_hostname(tcertthostname((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytokwscs �jtjtj||�dS(N(R]RtCertificateErrorR�(R�R�(R (sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR�ysRgsexample.comRmsExAmple.cOmswww.example.coms.example.comsexample.orgtexampleXcoms*.a.coms	foo.a.coms
bar.foo.a.comsa.comsXa.coms.a.comsf*.comsfoo.comsf.comsbar.comsbar.foo.comsnull.python.orgexample.orgsnull.python.orgs	*.*.a.comsa.*.coms	a.foo.comsa..comupüthon.python.orgtidnatasciis
x*.python.orgsxn--p*.python.orguwww*.pythön.orguwww.pythön.orguwww1.pythön.orguftp.pythön.orgupythön.orgsJun 26 21:41:46 2011 GMTRislinuxfrz.orgRoslinuxfr.orgslinuxfr.comt	othernames
<unsupported>RnsDec 18 23:59:59 2011 GMTRcR|R}t
CaliforniaRes
Mountain ViewRfs
Google Incsmail.google.coms	gmail.comsDec 18 23:59:59 2099 GMTtblablas
google.comsa*b.comsaxxb.comsa*b.co*sa*b*.comsaxxbxxc.comstoo many wildcards(s
commonNamesexample.com((s
commonNamesexample.com(((s
commonNamesexample.com(s
commonNames*.a.com((s
commonNames*.a.com(((s
commonNames*.a.com(s
commonNamesf*.com((s
commonNamesf*.com(((s
commonNamesf*.com(s
commonNamesnull.python.orgexample.org((s
commonNamesnull.python.orgexample.org(((s
commonNamesnull.python.orgexample.org(s
commonNames	*.*.a.com((s
commonNames	*.*.a.com(((s
commonNames	*.*.a.com(s
commonNamesa.*.com((s
commonNamesa.*.com(((s
commonNamesa.*.com(s
commonNames
x*.python.org((s
commonNames
x*.python.org(((s
commonNames
x*.python.org(s
commonNamesxn--p*.python.org((s
commonNamesxn--p*.python.org(((s
commonNamesxn--p*.python.org(s
commonNameslinuxfrz.org((s
commonNameslinuxfrz.org(((s
commonNameslinuxfrz.org(sDNSslinuxfr.org(sDNSslinuxfr.com(R�s
<unsupported>(scountryNamesUS((scountryNamesUS(sstateOrProvinceNameR�((sstateOrProvinceNameR�(slocalityNames
Mountain View((slocalityNames
Mountain View(sorganizationNames
Google Inc((sorganizationNames
Google Inc(s
commonNamesmail.google.com((s
commonNamesmail.google.com(scountryNamesUS((scountryNamesUS(sstateOrProvinceNameR�((sstateOrProvinceNameR�(slocalityNames
Mountain View((slocalityNames
Mountain View(sorganizationNames
Google Inc((sorganizationNames
Google Inc(scountryNamesUS((scountryNamesUS(sstateOrProvinceNameR�((sstateOrProvinceNameR�(slocalityNames
Mountain View((slocalityNames
Mountain View(s
commonNamesmail.google.com((s
commonNamesmail.google.com(R�R�((R�R�(scountryNamesUS((scountryNamesUS(sstateOrProvinceNameR�((sstateOrProvinceNameR�(slocalityNames
Mountain View((slocalityNames
Mountain View(sorganizationNames
Google Inc((sorganizationNames
Google Inc(R�R�((R�R�(s
commonNamesa*b.com((s
commonNamesa*b.com(((s
commonNamesa*b.com(s
commonNamesa*b.co*((s
commonNamesa*b.co*(((s
commonNamesa*b.co*(s
commonNamesa*b*.com((s
commonNamesa*b*.com(((s
commonNamesa*b*.com(tencodetdecodeR]R�RR�R�R�RUR�R�(R R�R�R�R�R�((R sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_match_hostnamevs�	































































cCsPtjtj�}ttj���&}|jt|j|tdd�WdQXdS(Ntserver_hostnames
some.hostname(	RR>tPROTOCOL_SSLv23RRR]R�R�RW(R tctxR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_server_side�sc
CsWtjtj�}ttj|���*}|jt��|jd�WdQXWdQXdS(Nsunknown-type(RRRRR�R]R�tget_channel_binding(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_unknown_channel_bindingss
tls-uniques*'tls-unique' channel binding not availablecCs�tjtj�}ttj|���}|j|jd��WdQXtjtj�}ttj|dtdt���}|j|jd��WdQXdS(Ns
tls-uniqueR�R�(	RRRRR�tassertIsNoneR�RWRu(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_tls_unique_channel_binding	s$cCs�tj�}|jt|�d�|j|tj�tj��M}t|d<t	|d<tj�}|j|j
t	�|j|jt�WdQXdS(NitSSL_CERT_DIRt
SSL_CERT_FILE(Rtget_default_verify_pathsRxtlenR�tDefaultVerifyPathsRtEnvironmentVarGuardtCAPATHRutcafileR(R tpathstenv((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_get_default_verify_pathss

twin32sWindows specificc	CsI|jtjd��|jtjd��|jttj�|jttjd�t�}x�dD]�}tj|�}|j|t�x�|D]�}|j|t	�|j
t|�d�|\}}}|j|t�|j
|ddh�|j|ttf�t|t�r�|j|�q�q�WqeWd}|j
||�dS(	NtCAtROOTR=itx509_asnt
pkcs_7_asns1.3.6.1.5.5.7.3.1(R�R�(R�Rtenum_certificatesR]R^tWindowsErrortsetR�tlistR�RxR�tbytesRUtboolt
isinstancetupdate(	R t
trust_oidst	storenametstoretelementR�tencttrustt
serverAuth((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_enum_certificates!s&	

cCs�|jtjd��|jttj�|jttjd�tjd�}|j|t�xb|D]Z}|j|t�|j	t
|�d�|j|dt�|j|dddh�qeWdS(NR�R=iiiR�R�(
R�Rt	enum_crlsR]R^R�R�RR�RxR�RRU(R tcrlsR	((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_enum_crls:s
cCsDd}tjd�}|j||�|j|jd�|j|jd�|j|jd�|j|jd�|j|tj�|jt	tjd�tjj
d�}|j||�|j|tj�|jt	tjj
d�|jt	d��tjj
d�WdQXx�td�D]�}ytjj
|�}Wnt	k
rMqX|j|jt
�|j|jt�|j|jt�|j|jttd�f�qWtjjd�}|j||�|j|tj�|jtjjd�|�|jtjjd�|�|jt	d	��tjjd
�WdQXdS(Ni�RsTLS Web Server Authentications1.3.6.1.5.5.7.3.1i����sunknown NID 100000i��i�sunknown object 'serverauth't
serverauth(i�s
serverAuthsTLS Web Server Authentications1.3.6.1.5.5.7.3.1(Rt_ASN1ObjectRxtnidt	shortnametlongnametoidR�R]R�tfromnidR�trangeR�R�ttypeR�tfromname(R texpectedtvaltitobj((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_asn1objectIsB
#cCstjd�}|jtjjtj�|jtjj|�|jtjjjd�|jtjjjd�|jtjjjd�tjd�}|jtjj	tj�|jtjj	|�|jtjj	jd�|jtjj	jd�|jtjj	jd�dS(Ns1.3.6.1.5.5.7.3.1i�Rs1.3.6.1.5.5.7.3.2i�t
clientAuth(
RRR�tPurposetSERVER_AUTHRxRRRtCLIENT_AUTH(R R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_purpose_enumpscCs�tjtjtj�}|j|j�|jt��}tj|dtj	�WdQX|j
t|j�d�tj
tj�}|jt��}|j|�WdQX|j
t|j�d�dS(Nt	cert_reqss!only stream sockets are supported(RRt
SOCK_DGRAMR�R�R]tNotImplementedErrorRR�RMRxR�R�R>R�(R R�tcxR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_unsupported_dtls�scCs|jtj|�|�dS(N(RxRtcert_time_to_seconds(R t
timestringt	timestamp((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytcert_time_ok�scCs'|jt��tj|�WdQXdS(N(R]R�RR*(R R+((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytcert_time_fail�ss)local time needs to be different from UTCcCs$|jdd�|jdd�dS(NsMay  9 00:00:00 2007 GMTg�C��AsJan  5 09:34:43 2018 GMTg��ѓ�A(R-(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt"test_cert_time_to_seconds_timezone�scCs*d}d}|j||�|jtjd|�|�|jd|�|jd|�|jd�|jd�|jd�|jd	�|jd
�|jd�|jd�d
}|jd|�|jd|�|jdd�|jdd�|jdd�|jd�|jdd�dS(NsJan  5 09:34:43 2018 GMTg��ѓ�AR7sJan 05 09:34:43 2018 GMTsJaN  5 09:34:43 2018 GmTsJan  5 09:34 2018 GMTsJan  5 09:34:43 2018sJan  5 09:34:43 2018 UTCsJan 35 09:34:43 2018 GMTsJon  5 09:34:43 2018 GMTsJan  5 24:00:00 2018 GMTsJan  5 09:60:43 2018 GMTg�W�AsDec 31 23:59:60 2008 GMTsJan  1 00:00:00 2009 GMTsJan  5 09:34:59 2018 GMTi�FOZsJan  5 09:34:60 2018 GMTi�FOZsJan  5 09:34:61 2018 GMTi�FOZsJan  5 09:34:62 2018 GMTsDec 31 23:59:59 9999 GMTg�� �MB(R-RxRR*R.(R R+ttst
newyear_ts((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_cert_time_to_seconds�s*







tLC_ALLR=cCsVd�}|�j�dkr.|jd�n|jdd�|j|�d�dS(NcSstjdd	�S(
Ns%biiiiiii(	iiiiiiiii(R*R6(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytlocal_february_name�stfebs>locale-specific month name needs to be different from C localesFeb  9 00:00:00 2007 GMTg`�r�As  9 00:00:00 2007 GMT(tlowertskipTestR-R.(R R4((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt test_cert_time_to_seconds_locale�s
	()R#R$RYRaR{R�R�R�Rtcpython_onlyR�R�R�R�R�R�R�R�R�R�R�RBt
skipUnlessRtCHANNEL_BINDING_TYPESR�R�RR@R
RRR$R)R-R.R0R/R2trun_with_localeR8(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRL�s>			(			
									�			$$	'					#tContextTestscBsmeZed��Zed��Zd�Zed��Zd�Zej	e
�d�d��Zd�Zd�Z
d	�Zd
�Zed��Zd�Zej	ejd
�d��Zed��Zed��Zd�Zd�Zd�Zejejdkd�d��Zej	ejdkd�d��Zd�Z d�Z!d�Z"d�Z#d�Z$RS(cCsaxtD]}tj|�qW|jttj�|jttjd�|jttjd�dS(Ni����i*(t	PROTOCOLSRR>R]R^R�(R tprotocol((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_constructor�s

cCs7x0tD](}tj|�}|j|j|�qWdS(N(R>RR>RxR?(R tprotoR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
test_protocol�s
cCsYtjtj�}|jd�|jd�|jtjd��|jd�WdQXdS(NtALLtDEFAULTsNo cipher can be selecteds^$:,;?*'dorothyx(RR>R�tset_ciphersR�R?(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_ciphers�s


cCs�tjtj�}|jtjtjBtjB|j�|jtjO_|jtjtjBtjBtjB|j�t	�r�|jtj@tjB|_|jtjtjBtjB|j�d|_|jd|j�n|j
t��d|_WdQXdS(Ni(RR>R�RxtOP_ALLtOP_NO_SSLv2tOP_NO_SSLv3toptionstOP_NO_TLSv1R&R]R�(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_options�s
!
	
	cCs�tjtj�}|j|jtj�tj|_|j|jtj�tj|_|j|jtj�tj|_|j|jtj�|jt	��d|_WdQX|jt��d|_WdQXdS(Ni*(RR>R�Rxtverify_modeRMRNROR]R^R�R�(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_verify_mode�ss!verify_flags need OpenSSL > 0.9.8cCs�tjtj�}ttdd�}|j|jtj|B�tj|_|j|jtj�tj|_|j|jtj�tj|_|j|jtj�tjtj	B|_|j|jtjtj	B�|j
t��d|_WdQXdS(NtVERIFY_X509_TRUSTED_FIRSTi(
RR>R�tgetattrRxtverify_flagstVERIFY_DEFAULTtVERIFY_CRL_CHECK_LEAFtVERIFY_CRL_CHECK_CHAINtVERIFY_X509_STRICTR]R^R�(R R�ttf((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_verify_flagsscCs�tjtj�}|jtdd�|jtdt�|jt|jdt�|jt��}|jt	�WdQX|j
|jjtj
�|jtjd��|jt�WdQX|jtjd��|jt�WdQXtjtj�}|jtt�|jdtdt�|jdtdt�|jtjd��|jt�WdQX|jtjd��|jt�WdQX|jtjd��|jdtdt�WdQXtjtj�}|jtjd��|jtt�WdQX|jtdt�|jtdtj��|jtdttj���|jttt�|jtttj��|jttttj���|jtd��|jtdt�WdQX|jtj��|jtdd�WdQX|jtd��|jtdd	d
�WdQXd�}d�}d
�}d�}d�}d�}d�}	ddd��Y}
|jtd|�|jtd|�|jtd|�|jtd|
��|jtd|
�j�|jtj��|jtd|�WdQX|jtd��|jtd|�WdQX|jtd��|jtd|�WdQX|jtd��|jtd|	�WdQX|jtd|	�dS(NR�sPEM libR�skey values mismatchtpasswordsshould be a stringtbadpassscannot be longertai�cSstS(N(tKEY_PASSWORD(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytgetpass_unicodeJscSs
tj�S(N(R[R�(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
getpass_bytesLscSsttj��S(N(R�R[R�(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytgetpass_bytearrayNscSsdS(NRY((((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytgetpass_badpassPscSsddS(NRZii((((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytgetpass_hugeRscSsdS(Ni	((((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytgetpass_bad_typeTscSstd��dS(Ns
getpass error(t	Exception(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytgetpass_exceptionVstGetPassCallablecBseZd�Zd�ZRS(cSstS(N(R[(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt__call__YscSstS(N(R[(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytgetpass[s(R#R$ReRf(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRdXs	smust return a strings
getpass error(( RR>R�tload_cert_chainRuR�R]R^RR�RxR�RR�R�R?tBADCERTt	EMPTYCERTtONLYCERTtONLYKEYtBYTES_ONLYCERTt
BYTES_ONLYKEYR�tCERTFILE_PROTECTEDR[R�R�tONLYKEY_PROTECTEDRWR�RfRb(R R�R�R\R]R^R_R`RaRcRd((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_load_cert_chainsz							
cCsjtjtj�}|jt�|jdtdd�|jt�|jdtdd�|jdtjd��|jt	|j�|jt	|jddd�|jt
��}|jt�WdQX|j|j
jtj�|jt
��|jd�WdQX|jtjd��|jt�WdQX|jtt�|jtdt�|jt	|jdt�dS(NR�Rsutf-8usPEM lib(RR>R�tload_verify_locationsRuR�tBYTES_CERTFILER�R]R^RR�RxR�RR�R�R?RhR�tBYTES_CAPATHRW(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_load_verify_locationsns$

c
Cstt��}|j�jd�}WdQXtj|�}tt��}|j�jd�}WdQXtj|�}tjtj�}|j	|j
�dd�|jd|�|j	|j
�dd�|jd|�|j	|j
�dd�|jd|�|j	|j
�dd�tjtj�}dj||f�}|jd|�|j	|j
�dd�tjtj�}d|d	|d
|dg}|jddj|��|j	|j
�dd�tjtj�}|jd|�|jd|�|j	|j
�dd�|jd|�|j	|j
�dd�tjtj�}dj||f�}|jd|�|j	|j
�dd�tjtj�}|j
t|jdt�|jtjd
��|jdd�WdQX|jtjd��|jdd�WdQXdS(NR�tx509_caitcadataiis
theadtothertagainttailR=s
no start lineubrokensnot enough datatbroken(R�R�R�R�RR�tCAFILE_NEURONIOR>R�Rxtcert_store_statsRqRR]R^tobjectR�R?(R RGt
cacert_pemt
cacert_dertneuronio_pemtneuronio_derR�tcombined((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_load_verify_cadata�sNcCs�tjtj�}|jt�tjdkr>|jt�n|jt	|j�|jt	|jd�|jt��}|jt�WdQX|j
|jjtj�|jtj��}|jt�WdQXdS(Ntnt(RR>R�tload_dh_paramstDHFILERR	tBYTES_DHFILER]R^R�RR�RxR�RR�R?Ru(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_load_dh_params�s
cCs�x�tD]x}tj|�}|j|j�idd6dd6dd6dd6dd6dd6dd6dd	6dd
6dd6dd6�qWdS(
NitnumberR�tconnect_goodtconnect_renegotiatetaccepttaccept_goodtaccept_renegotiatethitstmissesttimeoutst
cache_full(R>RR>Rxt
session_stats(R RAR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_session_stats�s
cCs tjtj�}|j�dS(N(RR>R�tset_default_verify_paths(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_set_default_verify_paths�ss#ECDH disabled on this OpenSSL buildcCs�tjtj�}|jd�|jd�|jt|j�|jt|jd�|jt|jd�|jt|jd�dS(Nt
prime256v1R[(RR>R�tset_ecdh_curveR]R^R�R�(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_set_ecdh_curve�s

cCs�tjtj�}|jt|j�|jt|jd�|jt|jd�|jt|j|�d�}|jd�|j|�dS(NiR=cSsdS(N((R�t
servernameR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
dummycallback�s(RR>R�R]R^tset_servername_callbackR�(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_sni_callback�s	
cCsatjtj�}|d�}|j|�tj|�}~~tj�|j|�d�dS(NcSsdS(N((R�R�R�tcycle((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR�s(
RR>R�R�R�R�tgctcollecttassertIsR�(R R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_sni_callback_refcycle�s

cCs�tjtj�}|j|j�idd6dd6dd6�|jt�|j|j�idd6dd6dd6�|jt�|j|j�idd6dd6dd6�|jt�|j|j�idd6dd6dd6�dS(NiRutcrltx509ii(	RR>R�RxR}RgRuRqR�(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_cert_store_stats	s


cCstjtj�}|j|j�g�|jt�|j|j�g�|jt�|j|j�iddddfd	6td
�d6td�d
6dd6dd6dd!d#d%fd6dd6g�t	t��}|j
�}WdQXtj|�}|j|jt�|g�dS(&NRfsRoot CAR�shttp://www.cacert.orgRgsCA Cert Signing AuthorityR�ssupport@cacert.orgRbsMar 29 12:29:49 2033 GMTRisMar 30 12:29:49 2003 GMTRjt00Rks!https://www.cacert.org/revoke.crlRrRmitversion(sorganizationNamesRoot CA((sorganizationNamesRoot CA(sorganizationalUnitNameshttp://www.cacert.org((sorganizationalUnitNameshttp://www.cacert.org(s
commonNamesCA Cert Signing Authority((s
commonNamesCA Cert Signing Authority(semailAddressssupport@cacert.org((semailAddressssupport@cacert.org(s!https://www.cacert.org/revoke.crl(sorganizationNamesRoot CA((sorganizationNamesRoot CA(sorganizationalUnitNameshttp://www.cacert.org((sorganizationalUnitNameshttp://www.cacert.org(s
commonNamesCA Cert Signing Authority((s
commonNamesCA Cert Signing Authority(semailAddressssupport@cacert.org((semailAddressssupport@cacert.org(
RR>R�Rxtget_ca_certsRqRuR�R:R�R�R�RW(R R�RGR�tder((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_get_ca_certss.





cCs�tjtj�}|j�tjtj�}|jtjj�|j�tjtj�}|jtjj�tjtj�}|jt|jd�|jt|jd�dS(NR"(
RR>R�tload_default_certsR!R"R#R]R^R�(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_load_default_certs3s

R�snot-Windows specificc	Csttjtj�}tj��P}t|d<t|d<|j�|j|j	�idd6dd6dd6�WdQXdS(NR�R�iR�iR�Ru(
RR>R�RR�R�RuR�RxR}(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_load_default_certs_envBs


sWindows specificcCs�tjtj�}|j�|j�}tjtj�}tj��K}t|d<t|d<|j�|dcd7<|j	|j�|�WdQXdS(NR�R�R�i(
RR>R�R�R}RR�R�RuRx(R R�tstatsR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt#test_load_default_certs_env_windowsKs



cCsCtj�}|j|jtj�|j|jtj�|j|j�|j|j	tj
@tj
�|j|j	ttdd�@ttdd��tt
��}|j�jd�}WdQXtjdt
dtd|�}|j|jtj�|j|jtj�|j|j	tj
@tj
�|j|j	ttdd�@ttdd��tjtjj�}|j|jtj�|j|jtj�|j|j	tj
@tj
�|j|j	ttdd�@ttdd��|j|j	ttdd�@ttdd��|j|j	ttdd�@ttdd��dS(	NRTiR�R�RRvRQRS(Rtcreate_default_contextRxR?R�RMROR�tcheck_hostnameRJRHRPR�t
SIGNING_CAR�R�R�R!R#RM(R R�RGRv((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_create_default_contextYs>	cCs�tj�}|j|jtj�|j|jtj�|j|j�|j|j	tj
@tj
�tjtj�}|j|jtj�|j|jtj�|j|j	tj
@tj
�tjtjdtjdt
�}|j|jtj�|j|jtj�|j|j�|j|j	tj
@tj
�tjdtjj�}|j|jtj�|j|jtj�|j|j	tj
@tj
�dS(NR%R�tpurpose(Rt_create_stdlib_contextRxR?R�RMRMtassertFalseR�RJRHR�RORWR�R!R#(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest__create_stdlib_context�s(		cCs�tjd�}|j|j|j�|jdt�|j|j|j�|jdt�|j|j|j�|jdt�|j�|j|j|j�dS(NRtenable(	Rtimport_fresh_moduleR�t_create_default_https_contextR�t_https_verify_certificatesRXt_create_unverified_contextRW(R t	local_ssl((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest__https_verify_certificates�s



cCsqd}d}i}td||�d|tj<td||�x+d	D]#}||tj<td||�qFWdS(
Nsimport ssl, sys;             status = "Error: _create_default_https_context does not verify certs"                        if ssl._create_default_https_context is                           ssl._create_unverified_context                      else None;             sys.exit(status)simport ssl, sys;             status = "Error: _create_default_https_context verifies certs"                        if ssl._create_default_https_context is                           ssl.create_default_context                      else None;             sys.exit(status)s-cR2R=t1tenabledR[(R=R�R�sfoo(RRt_https_verify_envvar(R thttps_is_verifiedthttps_is_not_verifiedt	extra_envtsetting((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest__https_verify_envvar�s


cCs�tjtj�}|j|j�|jt��t|_WdQXtj|_	|j|j�t|_|j
|j�tj|_	t|_|j
|j�|jt��tj|_	WdQXt
|_|j|j�dS(N(RR>R�R�R�R]R�RWRORMR�RNRMRX(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_check_hostname�s			(%R#R$RKR@RBRFRLRNRBR:R)RWRpRtR�R�R�R�RRRR�t	needs_sniR�R�R�R�R�tskipIfRR@R�R�R�R�R�R�R�(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR=�s4			S		:	
	

			$	$	(			t
SSLErrorTestscBs#eZd�Zd�Zd�ZRS(cCsztjdd�}|jt|�d�|j|jd�tjdd�}|jt|�d�|j|jd�dS(NiR[(RR?RxR�RtSSLZeroReturnError(R R!((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_str�scCs�tjtj�}|jtj��}|jt�WdQX|j|jj	d�|j|jj
d�t|j�}|j|j
d�|�dS(NtPEMt
NO_START_LINEs"[PEM: NO_START_LINE] no start line(RR>R�R]R?R�RuRxR�tlibrarytreasonR�R�R�(R R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_lib_reason�sc
Cstjtj�}ttj����}|jd�|jd�tj�}|j|j��|j	t
�t|j|t
dt
���m}|jtj
��}|j�WdQXt|j�}|j|jd�|�|j|jjtj�WdQXWdQXdS(Ns	127.0.0.1iitdo_handshake_on_connects%The operation did not complete (read)(s	127.0.0.1i(RR>R�RRtbindtlistenR�tgetsocknametsetblockingRXR�R]tSSLWantReadErrortdo_handshakeR�R�R�R�RxRtSSL_ERROR_WANT_READ(R R�R�tcR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
test_subclass�s


!(R#R$R�R�R�(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR��s	
	
tNetworkedTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	e
jej
dkd	�d
��Zd�Zd�Zd
�Zd�Zd�Zed��ZRS(c
Cs+tjt��tjtjtj�dtj�}z-|jtdf�|j	i|j
��Wd|j�Xtjtjtj�dtj�}|j
tjd|jtdf�|j�tjtjtj�dtjdt�}z*|jtdf�|j|j
��Wd|j�XWdQXdS(NR%i�scertificate verify failedtca_certs(Rttransient_internettREMOTE_HOSTRR�RRRMR�RxtgetpeercertR�ROR�R?tREMOTE_ROOT_CERTR�(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_connects&
		c
Cs�tjt��stjtjtj�dtjdt�}z6|j	d|j
tdf��|j|j��Wd|j
�XWdQXdS(NR%R�ii�(RR�R�RR�RRROR�Rxt
connect_exR�R�R�(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_connect_ex*s		cCsAtjt��,tjtjtj�dtjdtdt	�}z�|j
t	�|jtdf�}|j|dt
jt
jf�tjg|ggd�xutry|j�PWq�tjk
r�tj|gggd�q�tjk
rtjg|ggd�q�Xq�W|j|j��Wd|j�XWdQXdS(NR%R�R�i�ig@(RR�R�RR�RRROR�RXR�R�RURtEINPROGRESStEWOULDBLOCKtselectRWR�R�tSSLWantWriteErrorR�R�R�(R R�trc((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_non_blocking_connect_ex6s(		
	
!cCs�tjt���tjtjtj�dtjdtdt	�}z^|j
d�|jtdf�}|dkr�|jd�n|j
|tjtjf�Wd|j�XWdQXdS(NR%R�R�gH�����z>i�is!REMOTE_HOST responded too quickly(RR�R�RR�RRROR�RXR�R�R7RURtEAGAINR�R�(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_timeout_connect_exSs		
 c
Cs�tjt���tjtjtj�dtjdt�}zG|j	tdf�}t
jt
jt
j
t
jf}|j||�Wd|j�XWdQXdS(NR%R�i�(RR�R�RR�RRROR�R�RtECONNREFUSEDtEHOSTUNREACHt	ETIMEDOUTR�RUR�(R R�R�terrors((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_connect_ex_errords		c
Csytjt��dtjtj�}|jtjtj��}|j	tdf�z|j
i|j��Wd|j�X|jtjtj�dt�}|j	tdf�|j�tj
|_|jtjtj��}|jtjd|j	tdf�|j�|jt�|jtjtj��}|j	tdf�z|j�}|j|�Wd|j�XWdQXdS(Ni�R�scertificate verify failed(RR�R�RR>R�R�RRR�RxR�R�RORMR�R?RqR�R�(R R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_connect_with_contextus.	


cCs(tjt��tjtj�}tj|_|jdt	�|j
tjtj��}|j
tdf�z|j�}|j|�Wd|j�Xtjtj�}tj|_|jdt�|j
tjtj��}|j
tdf�z|j�}|j|�Wd|j�XWdQXdS(NRi�(RR�R�RR>R�RORMRqR�R�RRR�R�R�R�Rs(R R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_connect_capath�s&c
Cs[tt��}|j�jd�}WdQXtj|�}tjt��
tj	tj
�}tj|_|j
d|�t|jtjtj����3}|jtdf�|j�}|j|�WdQXtj	tj
�}tj|_|j
d|�t|jtjtj����3}|jtdf�|j�}|j|�WdQXWdQXdS(NR�Rvi�(R�R�R�R�RR�RR�R�R>R�RORMRqRR�RRR�R�R�(R RGR�R�R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_connect_cadata�s$$$R�s*Can't use a socket as a file under WindowscCs�tjt���tjtjtj��}|jtdf�|j�}|j	�}|j
�tj|d�|j
�t
j�|jt��}tj|d�WdQX|j|jjtj�WdQXdS(Ni�i(RR�R�RR�RRR�tfilenotmakefileR�RR�R�R�R]tOSErrorRxR�RtEBADF(R R�tfdRGR!((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_makefile_close�s


c
Cstjt��tjtj�}|jtdf�|jt�tj	|dtj
dt�}d}xytr�y|d7}|j�PWqitj
k
r�tj|ggg�qitjk
r�tjg|gg�qiXqiW|j�tjrtjjd|�nWdQXdS(Ni�R%R�iis9
Needed %d calls to do_handshake() to establish session.
(RR�R�RRR�R�RXRR�RMRWR�R�R�R�R�RRRR(R R�tcount((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_non_blocking_handshake�s(
			


	cs?d�fd�}|tdt�tjr;|dd�ndS(Nc	s%tj|��tj||f�}|sE�jd||f�nytj||fdt�}Wn6tjk
r�}tjr�tj	j
d|�q�nX�jd|||f�tj||fd|�}|s��jd||f�ntjrtj	j
d|||f�nWdQXdS(NsNo server certificate on %s:%s!R�s%s
s$Got server certificate %s for %s:%s!s&
Verified certificate for %s:%s is
%s
(RR�Rtget_server_certificateR�RuR?RRRR(thosttportR�R�R�(R (sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt_test_get_server_certificate�s"
			i�sipv6.google.com(R�R�R�RtIPV6_ENABLED(R R((R sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_get_server_certificate�s	cCstdf}tj|d���ttjtjtj�dtjdd���}|j	|�WdQXttjtjtj�dtjdd���}|j	|�WdQX|j
tjd��Qttjtj���2}tj|dtjdd�}|j	|�WdQXWdQXWdQXdS(	Ni�iR%tciphersRCRDsNo cipher can be selecteds^$:,;?*'dorothyx(R�RR�RRR�RRRMR�R�R?(R tremoteR�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRF
scCs:tjd
kr&|jdtj�ntjs?|jd�nd}tjjtjjt	�d	�}t
jd���tjtj
�}tj|_|j|�|jtjtj�d
d�}z`|j|�t
jr!tjjd||j�f�tjjdtj|j���nWd|j�XWdQXdS(Nii	iisSHA256 not available on %rsSNI needed for this testssha256.tbs-internet.comi�s
sha256.pemR�s
Cipher with %r is %r
sCertificate is:
%s
(ii	iii(ssha256.tbs-internet.comi�(RR'R7R�RVRRRRRRR�R>R�RORMRqR�RRR�RRRRtcipherRvRwR�R�(R Rtsha256_certR�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_algorithmss(	!
	
	cCs�tjt���tjtj�}tj|_|jdt	�|j
|j�g�|jt
j
t
j��}|jtdf�z|j�}|j|�Wd|j�X|j
t|j��d�WdQXdS(NRi�i(RR�R�RR>R�RORMRqR�RxR�R�RRR�R�R�R�R�(R R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_get_ca_certs_capath9scCs�tjt���tjtj�}tjtj�}tjtj�}t	|j
|���u}|jtdf�|j|j
|�|j|jj
|�||_
|j|j
|�|j|jj
|�WdQXWdQXdS(Ni�(RR�R�RR>R�R�RRRR�R�R�tcontextt_sslobj(R tctx1tctx2R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_context_setgetIs	(R#R$R�R�R�R�R�R�R�R�RBR�RR	R�R�RRFRR	R�R(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR�
s								$					(tmake_https_servertThreadedEchoServercBs{eZdejfd��YZddddeeeddddd�Zd�Z	d�Z
dd�Zd�Zd�Z
RS(	tConnectionHandlercBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s�A mildly complicated class, because we want it to work both
            with and without the SSL wrapper around the socket connection, so
            that we can test the STARTTLS functionality.cCsZ||_t|_||_||_|jjd�d|_tj	j
|�t|_dS(Ni(
tserverRXtrunningR�taddrR�R�tsslconnt	threadingtThreadt__init__RWtdaemon(R RtconnsockR((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRis					cCs$y]|jjj|jdt�|_|jjj|jj��|jj	j|jj
��Wn�tjk
r�}t
|tj�r�|jtjkr��n|jjj|�|jjr�tdt|j�d�nt|_|jj�|j�tSX|jjjtjkr�|jj�}tjr_|jjr_t j!j"dt#j$|�d�n|jjt�}tjr�|jjr�t j!j"dt%t&|��d�q�n|jj'�}tjr|jjrt j!j"dt%|�d�t j!j"d	t%|jj��d�ntSdS(
NR�s'
 server:  bad connection attempt from s:
s client cert is s
s cert binary is s bytes
s" server: connection cipher is now s" server: selected protocol is now ((RR
R�R�RWRtselected_npn_protocolstappendtselected_npn_protocoltselected_alpn_protocolstselected_alpn_protocolRR�RRR?Rt
ECONNRESETtconn_errorstchattyRtreprRRXRtstopR�RMROR�RRRRRRvRwR�R�R(R R!R�tcert_binaryR((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt	wrap_connss8 %	

$*	!cCs*|jr|jj�S|jjd�SdS(Ni(RR�R�R�(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR��s	
cCs-|jr|jj|�S|jj|�SdS(N(RRR�R�(R R((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR�s	cCs*|jr|jj�n
|jj�dS(N(RR�R�(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR��s	cCs�t|_|jjs(|j�s(dSnx�|jr�yE|j�}|j�}|skt|_|j�n
|dkr�t	j
r�|jjr�tj
jd�n|j�dS|jjr
|dkr
t	j
r�|jjr�tj
jd�n|jd�|j�sxdSnk|jjr�|jr�|dkr�t	j
rV|jjrVtj
jd�n|jd�|jj�|_d|_t	j
rx|jjrxtj
jd�qxn�|d	krt	j
r�|jjr�tj
jd
�n|jjd�}|jt|�jd�d
�nft	j
re|jjre|jr6dp9d}tj
jd|||j�|f�n|j|j��Wq+tjk
r�|jjr�td�n|j�t|_|jj�q+Xq+WdS(Ntovers" server: client closed connection
tSTARTTLSs2 server: read STARTTLS from client, sending OK...
sOK
tENDTLSs0 server: read ENDTLS from client, sending OK...
s* server: connection is now unencrypted...
s
CB tls-uniques@ server: read CB tls-unique from client, sending our CB data...
s
tls-uniquesus-asciis
t	encryptedtunencrypteds/ server: read %r (%s), sending back %r (%s)...
sTest server failure:
(RWRRtstarttls_serverR&R�tstripRXR�RRtconnectionchattyRRRRtunwrapR�R�R�R#R�R6RR?R"RR$(R tmsgtstrippedtdatatctype((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytrun�sb		



	#	

	(	R#R$t__doc__RR&R�RR�R4(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRcs	
	&			cCs`|r||_n�tj|dk	r*|ntj�|_|dk	rK|ntj|j_|rs|jj|�n|r�|jj|�n|r�|jj	|�n|	r�|jj
|	�n|
r�|jj|
�n||_||_
||_tj�|_tj|j�|_d|_t|_g|_g|_g|_tjj|�t|_dS(N(R
RR>R�R�RMRMRqRgtset_npn_protocolstset_alpn_protocolsRER"R.R,RR�Rt	bind_portRtflagRXtactiveRRR!RRRRWR(R tcertificateR�tcertreqstcacertsR"R.R,t
npn_protocolstalpn_protocolsRR
((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR�s:								cCs$|jtj��|jj�|S(N(tstartRtEventR9twait(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt	__enter__s
cGs|j�|j�dS(N(R$R(R RD((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt__exit__s
cCs||_tjj|�dS(N(R9RRR@(R R9((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR@s	cCs	|jjd�|jjd�t|_|jrB|jj�nx�|jr�yu|jj�\}}tj	r�|j
r�tjj
dt|�d�n|j|||�}|j�|j�WqEtjk
r�qEtk
r�|j�qEXqEW|jj�dS(Ng�������?is server:  new connection from s
(R�R�R�RWR:R9RR�RRR"RRRR#RR@RRR�tKeyboardInterruptR$R�(R tnewconntconnaddrthandler((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR4s&			

cCs
t|_dS(N(RXR:(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR$)sN(R#R$RRRR�RWRXRRCRDR@R4R$(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRas	 			tAsyncoreEchoServercBsceZdejfd��YZd�Zd�Zd�Zd�Zd	d�Z
d�Zd�ZRS(
t
EchoServercBs<eZdejfd��YZd�Zd�Zd�ZRS(RcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsQtj|dtd|dt�|_tjj||j�t|_|j	�dS(NR�R�R�(
RR�RWRXRtasyncoretdispatcher_with_sendRt_ssl_acceptingt_do_ssl_handshake(R tconnR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR2s	cCsBt|jtj�r>x&|jj�dkr:|j�qWntS(Ni(RRRt	SSLSockettpendingthandle_read_eventRW(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytreadable:scCs�y|jj�Wn�tjtjfk
r1dStjk
rK|j�Stjk
ra�n?tjk
r�}|j	dt
jkr�|j�Sn
Xt|_
dS(Ni(RR�RR�R�tSSLEOFErrorthandle_closeR?R�RDRtECONNABORTEDRXRM(R terr((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRN@s
cCsu|jr|j�n[|jd�}tjrKtjjdt|��n|s^|j	�n|j
|j��dS(Nis server:  read %s from client
(RMRNR�RRRRRR#R�R�R6(R R2((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pythandle_readOs	
	
cCs1|j�tjr-tjjd|j�ndS(Ns server:  closed connection %s
(R�RRRRRR(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRU[s
	cCs�dS(N((R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR`s(R#R$RRSRNRXRUR(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR0s					cCsZ||_tjtjtj�}tj|d�|_tjj	||�|j
d�dS(NR=i(R�RRtSOCK_STREAMRR8RRKt
dispatcherRR�(R R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRcs
	cCsI|j�\}}tjr2tjjd|�n|j||j�dS(Ns$ server:  new connection from %s:%s
(R�RRRRRRR�(R tsock_objR((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
handle_acceptjs	cCs�dS(N((R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRps(R#R$RKRLRRR\R(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRJ.s3		cCsPd|_t|_|j|�|_|jj|_tjj	|�t
|_dS(N(R�R9RXR:RJRRRRRRWR(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRss		cCsd|jj|jfS(Ns<%s %s>(t	__class__R#R(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt__str__{scCs$|jtj��|jj�|S(N(R@RRAR9RB(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRC~s
cGsltjrtjjd�n|j�tjrBtjjd�n|j�tjrhtjjd�ndS(Ns cleanup: stopping server.
s! cleanup: joining server thread.
s cleanup: successfully joined.
(RRRRRR$R(R RD((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRD�s	
	
	cCs||_tjj|�dS(N(R9RRR@(R R9((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR@�s	cCsQt|_|jr"|jj�nx(|jrLytjd�Wq%q%Xq%WdS(Ni(RWR:R9RRKtloop(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR4�s		cCst|_|jj�dS(N(RXR:RR�(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR$�s	N(
R#R$RKRZRJRR^RCRDR�R@R4R$(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRI,sE				
	
sFOO
cCs�i}td|d|dt�}|��t|jtj�d|����}|jt|jf�x�|t|�t	|�gD]�}	|r�t
jr�tj
jd|�q�n|j|	�|j�}
|r�t
jr�tj
jd|
�q�n|
|j�kr~td|
d t|
�|d j�t|�f��q~q~W|jd	�|rpt
jrptj
jd
�qpn|ji|j�d6|j�d6|j�d
6|j�d6|j�d6|j�d6�|j�WdQX|j|d<|j|d<WdQX|S(sc
        Launch a server, connect a client to it and try various reads
        and writes.
        R
R"R.R�s client:  sending %r...
s client:  read %r
s4bad data <<%r>> (%d) received; expected <<%r>> (%d)
isover
s client:  closing connection.
tcompressionRtpeercerttclient_alpn_protocoltclient_npn_protocolR�Ntserver_alpn_protocolstserver_npn_protocols(RRXRR�RR�R�RR�t
memoryviewRRRRRR�R6tAssertionErrorR�RR`RR�RRR�R�RR(tclient_contexttserver_contexttindataR"R.tsni_nameR�RR�targtoutdata((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytserver_params_test�sL	"		
	'
		





ic
Cs|dkrtj}nidtj6dtj6dtj6|}tjr�|rUdpXd}tjj	|tj
|�tj
|�|f�ntj|�}|j|O_tj|�}	|	j|O_|j
tjkr�|jd�nx7||	fD])}
||
_|
jt�|
jt�q�Wyt||	dtdt�}WnStjk
rf|r�qn�tjk
r�}|s�|jtjkr�qnkX|s�td	tj
|�tj
|�f��n9|tk	r||d
krtd||d
f��ndS(
sT
        Try to SSL-connect using *client_protocol* to *server_protocol*.
        If *expect_success* is true, assert that the connection succeeds,
        if it's false, assert that the connection fails.
        Also, if *expect_success* is a string, assert that it is the protocol
        version actually used by the connection.
        RMRNROs %s->%s %s
s
 {%s->%s} %s
RCR"R.s5Client protocol %s succeeded with server protocol %s!R�s%version mismatch: expected %r, got %rN(R�RRMRNRORRRRRtget_protocol_nameR>RJR?R�RERMRgRuRqRnRXR?RR�RR RgRW(
tserver_protocoltclient_protocoltexpect_successt	certsreqstserver_optionstclient_optionstcerttypet	formatstrRhRiR�R�R!((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttry_protocol_combo�sR	


		
	
t
ThreadedTestscBs�eZed��Zd�Zeje�d�d��Zd�Z	d�Z
d�Zeejee
d�d�d	���Zed
��Zeejee
d�d�d
���Zed��Zeejee
d�d�d���Zeejee
d�d�d���Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zeje
jd�d ��Zejd!e
j kd"�d#��Z!d$�Z"ejee
d%�d&�d'��Z#d(�Z$d)�Z%eje
j&d*�d+��Z'eje
j&d,�d-��Z(d.�Z)eje
j*d/�d0��Z+d1�Z,d2�Z-e.d3��Z/e.d4��Z0e.d5��Z1e.d6��Z2d7�Z3RS(8cCsftjrtjjd�nxCtD];}tj|�}|jt	�t
||dtdt�q#WdS(s2Basic test of an SSL client connecting to a servers
R"R.N(RRRRRR>RR>RgRuRnRW(R R?R
((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt	test_echos	

c	Cs�tjrtjjd�ntjtj�}tj|_	|j
t�|jt�t
d|dt�}|�x|jtj�dt�}|jt|jf�|jt��|j�WdQX|j�|j�}|j|d�|j�}tjr:tjjtj|�d�tjjdt|�d�nd|krc|jd	tj|��nd|dkr�|jd�n|jd
|�|jd|�tj|d
�}tj|d�}|j ||�|j!�WdQXdS(Ns
R
R"R�sCan't get peer certificate.sConnection cipher is s.
Rms$No subject field in certificate: %s.RfsPython Software FoundationskMissing or invalid 'organizationName' field in certificate subject; should be 'Python Software Foundation'.RjRi(sorganizationNamesPython Software Foundation((sorganizationNamesPython Software Foundation("RRRRRRR>R�RORMRqRuRgRRXR�RR�R�RR]R�R�R�R�RRvRwR�R�RUR*R�R�(R R
RR�R�Rtbeforetafter((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_getpeercertsB	

	
	!	

s!verify_flags need OpenSSL > 0.9.8cCstjrtjjd�ntjtj�}|jt	�tjtj�}tj
|_|jt
�ttdd�}|j|jtj|B�td|dt�}|�[t|jtj����9}|jt|jf�|j�}|j|d�WdQXWdQX|jtjO_td|dt�}|�[t|jtj����9}|jtjd��|jt|jf�WdQXWdQXWdQX|jt�td|dt�}|�[t|jtj����9}|jt|jf�|j�}|j|d�WdQXWdQXdS(Ns
ROiR
R"sCan't get peer certificate.scertificate verify failed( RRRRRRR>R�RgtSIGNED_CERTFILERORMRqR�RPRxRQRRRRWRR�RR�R�RR�R�RSR�R?tCRLFILE(R RiR
RVRR�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_crl_check<s:	


(
cCs�tjrtjjd�ntjtj�}|jt	�tjtj�}tj
|_t|_
|jt�td|dt�}|�at|jtj�dd���9}|jt|jf�|j�}|j|d�WdQXWdQXtd|dt�}|�at|jtj�dd���9}|jtjd��|jt|jf�WdQXWdQXWdQXtd|dt�}|�Fttj���-}|jtd	��|j|�WdQXWdQXWdQXdS(
Ns
R
R"R�RhsCan't get peer certificate.tinvalids.hostname 'invalid' doesn't match u?'localhost's'check_hostname requires server_hostname(RRRRRRR>R�RgR~RORMRWR�RqR�RRR�RR�R�RR�R�R�R�R�(R RiR
RR�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR�gs8	
	

(	
cCsWtjjtjjt�p!tjd�}ttdtj	dtdt
dt
�}|��ttj����}ttj
|d|dtj����}y|jt|jf�Wn�tjk
r�}tjrAtjjd|�qAn[tjk
r3}|jtjkr�ntjrAtjjd	|�qAnX|jd
�WdQXWdQXWdQXdS(s�Connecting when the server rejects the client's certificate

            Launch a server with CERT_REQUIRED, and check that trying to
            connect to it with a wrong client certificate fails.
            s
wrongcert.pemR<R=R"R.R�R�s
SSLError is %r
s
socket.error is %r
s'Use of invalid cert should have failed!N(RRRRRR�RRuRRORXRRR�R�R�R�RR?RRRRRR�RR R�(R R�RR�R�R!((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_wrong_cert�s,!						cs�tj��tj��tj��tj�t�����fd�}����fd�}tjd|�}|j�z|�Wd|j�XdS(s|A brutal shutdown of an SSL server should raise an OSError
            in the client when attempting handshake.
            csK�jd��j��j�\}}|j��j��j�dS(Ni(R�RR�R�(tnewsockR(t
listener_gonetlistener_readyR�(sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytlistener�s



c	s}�j�ttj���[}|jt�f��j�ytj|�}Wntjk
renX�jd�WdQXdS(Ns2connecting to closed SSL socket should have failed(	RBRRR�R�RR�R�R�(R�tssl_sock(R�R�RR (sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt	connector�s

ttargetN(	RRARRR8R�RR@R(R R�R�R�((R�R�RR�R sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_rude_shutdown�s
R;s)OpenSSL is compiled without SSLv2 supportcCstjrtjjd�nttjtjt�ttjtjttj	�ttjtjttj
�ttjtjt�ttjtj
t�ttjtjt�t�r�ttjtjtdtj�nttjtjtdtj�ttjtjtdtj�dS(s9Connecting to an SSLv2 server with various client optionss
RuN(RRRRRRxRR;RWRNROR�RXtPROTOCOL_SSLv3R�R(RHRIRK(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_protocol_sslv2�s		

cCs!tjrtjjd�nttd�r�yttjtj	t
�Wq�tjk
r�}tjr�tjjdt
|��q�q�Xnttd�r�ttjtjt�nttjtjt
�ttjtjd�ttd�r	ttjtjttj�nttjtjt
tj�ttjtjdtj�ttd�rottjtjttj�nttjtjt
tj�ttjtjdtj�ttd�r�ttjtjtdtj�nttjtjt
dtjtjB�ttjtjtdtj�dS(s:Connecting to an SSLv23 server with various client optionss
R;s; SSL2 client to SSL23 server test unexpectedly failed:
 %s
R�tTLSv1RtN(RRRRRRHRRxR�R;RWRR�R�R�RXR�RNRORIRHRK(R R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_protocol_sslv23�s:			
R�s)OpenSSL is compiled without SSLv3 supportcCs�tjrtjjd�nttjtjd�ttjtjdtj�ttjtjdtj	�t
td�r�ttjtjt�nttjtj
tdtj�ttjtjt�t�r�ttjtj
tdtj�ndS(s9Connecting to an SSLv3 server with various client optionss
tSSLv3R;RuN(RRRRRRxRR�RNRORHR;RXR�RIR�R(RH(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_protocol_sslv3	s	
	cCs�tjrtjjd�nttjtjd�ttjtjdtj�ttjtjdtj	�t
td�r�ttjtjt�nt
td�r�ttjtj
t�nttjtjtdtj�dS(s8Connecting to a TLSv1 server with various client optionss
R�R;R�RuN(RRRRRRxRR�RNRORHR;RXR�R�RK(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_protocol_tlsv1*	s	tPROTOCOL_TLSv1_1sTLS version 1.1 not supported.cCs�tjrtjjd�nttjtjd�ttd�rZttjtj	t
�nttd�r�ttjtjt
�nttjtjt
dtj
�ttjtjd�ttjtjt
�ttjtjt
�dS(snConnecting to a TLSv1.1 server with various client options.
               Testing against older TLS versions.s
sTLSv1.1R;R�RuN(RRRRRRxRR�RHR;RXR�R�t
OP_NO_TLSv1_1R�(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_protocol_tlsv1_19	s	
tPROTOCOL_TLSv1_2sTLS version 1.2 not supported.c	Cs3tjrtjjd�nttjtjddtjtj	Bdtjtj	B�t
td�rzttjtjt�nt
td�r�ttjtj
t�nttjtjtdtj�ttjtjd�ttjtjt�ttjtjt�ttjtjt�ttjtjt�dS(snConnecting to a TLSv1.2 server with various client options.
               Testing against older TLS versions.s
sTLSv1.2RtRuR;R�N(RRRRRRxRR�RIRHRHR;RXR�R�t
OP_NO_TLSv1_2R�R�(R ((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_protocol_tlsv1_2N	s 	
c	
Cs8d}ttd	tjd
tdtdt�}t}|��tj�}|jd
�|jt	|j
f�tjr�t
jjd�nxJ|D]B}tjr�t
jjd|�n|r�|j|�|j�}n|j|�|jd�}|j�j�}|dkr^|jd�r^tjr=t
jjd|�ntj|d	tj�}t}q�|dkr�|jd�r�tjr�t
jjd|�n|j�}t}q�tjr�t
jjd|�q�q�Wtjr�t
jjd�n|r|jd�n
|jd�|r$|j�n
|j�WdQXdS(s6Switching from clear text to encrypted and back again.smsg 1sMSG 2R(sMSG 3smsg 4R)smsg 5smsg 6R�R,R"R.is
s client:  sending %r...
iR�s/ client:  read %r from server, starting TLS...
s- client:  read %r from server, ending TLS...
s client:  read %r from server
s client:  closing connection.
sover
N(smsg 1sMSG 2sSTARTTLSsMSG 3smsg 4sENDTLSsmsg 5smsg 6(RRuRR�RWRXRR�R�R�RRRRRRR�R�R�R-R6R�R�R/R�(	R tmsgsRtwrappedR�RjRORmR0((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
test_starttlsf	s`			
	
		

									

cCs9t|dt�}tjr.tjjd�nttd��}|j�}WdQXd}d|j	t
jjt�df}t
jdt�}tj|d	|�}zu|j�jd
�}|rt|�dkr|jt|��}tjrtjjdt|�|f�qnWd|j�X|j||�dS(
s:Using a SocketServer to create and manage SSL connections.R�s
trbNR=shttps://localhost:%d/%siR�R
scontent-lengthis/ client: read %d bytes from remote server '%s'
(RRuRRRRRR�R�RRRtsplitRR�turllib2turlopentinfot	getheaderR�R�R�Rx(R RRGR�R�turlR
tdlen((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_socketserver�	s(	 		cCsdd}tjr"tjjd�nd}tt�}|�$tjt	j	��}|j
d|jf�tjr�tjjd|�n|j|�|j�}tjr�tjjd|�n||j
�kr|jd|d t|�|d j
�t|�f�n|jd	�tjr4tjjd
�n|j�tjrZtjjd�nWdQXdS(
s'Check the example asyncore integration.sTEST MESSAGE of mixed case
s
sFOO
s	127.0.0.1s client:  sending %r...
s client:  read %r
s4bad data <<%r>> (%d) received; expected <<%r>> (%d)
isover
s client:  closing connection.
s client:  connection closed.
N(RRRRRRIRuRR�RR�RR�R6R�R�R�(R RjRR�Rm((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_asyncore_server�	s4			
	!
	
	cstjrtjjd�nttdtjdtj	dtdt
dt�}|�'tjt
j
�dtdtd	td
tjdtj	���jt|jf��fd�}�fd�}d
�jt
gfd�jtdgfd�jt
gfg}d�jt
gfd�jtdgfd|t
gfd|tgfg}d}x|D]\}}}	}
||jd�}yw|||
��j�}||j�kr�|jdjd|d|d dt|�d|d dt|���nWqWtk
ra}
|	r'|jdjd|��nt|
�j|�sb|jdjd|d |
��qbqWXqWWx|D]\}}}	}
||jd�}yw�j|�||
�}||j�kr|jd!jd|d|d dt|�d|d dt|���nWqmtk
r�}
|	r=|jd"jd|��nt|
�j|�st|jdjd|d |
��n�j�qmXqmWd#}�j|�tt|��}|j �jd$|�t|��|j ||��j|�|j �jd%�d&�|j �jd%�d&�|j �j�|��jd'�|j!t�jd$�|j!t�jd$��j"�Wd(QXd(S()s Test recv(), send() and friends.s
R<R�R=R"R.R�R�R�R%cs'tdd�}�j|�}|| S(Ntid(R�R�(tbR�(R�(sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
_recv_into�	scs-tdd�}�j|�\}}|| S(NR�id(R�R�(R�R�R(R�(sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt_recvfrom_into�	sR�R�ssome.addresstsendallR�R�R�R�uPREFIX_R�spWhile sending with <<{name:s}>> bad data <<{outdata:r}>> ({nout:d}) received; expected <<{indata:r}>> ({nin:d})
R	RmitnoutRjtnins>Failed to send with method <<{name:s}>>; expected to succeed.
sFMethod <<{name:s}>> failed with unexpected exception message: {exp:s}
texpsrWhile receiving with <<{name:s}>> bad data <<{outdata:r}>> ({nout:d}) received; expected <<{indata:r}>> ({nin:d})
sAFailed to receive with method <<{name:s}>>; expected to succeed.
R2i����iR=sover
N(#RRRRRRRuRRMR�RWRXR�RR�R�RR�R�R�R�R�R�R�R6R�R�R�R�R�R�R�RxR]R�(R RR�R�tsend_methodstrecv_methodstdata_prefixt	meth_namet	send_methRrRDRjRmR!t	recv_methR2tbuffer((R�sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_recv_send�	s�						
	!	
	
	!	
	
"

cs\tjtj��d}tj��}tj��t����fd�}tjd|�}|j��j	�z�zRtjtj�}|j
d�|j||f�|jt
jdt
j|�Wd|j�XzTtjtj�}t
j|�}|j
d�|jt
jd|j||f�Wd|j�XWdt�|j��j�XdS(Ns	127.0.0.1cs��jd��j�g}xT�sstj�gggd�\}}}�|kr |j�j�d�q q Wx|D]}|j�q{WdS(Nig�������?i(R�RR�RR�R�(tconnsR�twR!R�(tfinishRtstarted(sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytserve^
s

	$
R�g�������?s	timed out(RRRR8RRARXRR@RBR�R�R�RR?R�R�RWR(R R�RR�R�R�((R�RR�sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_handshake_timeoutV
s6





cs_tjtj�}tj|_|jt�|jt�tjtj	��d}t
j��}|j�dt
��tj��dg�dg�����fd�}tjd|�}|j��j�|jtj��}|j||f�|j�}|j�|j��dj��j�|j�dtj�|j�d|�dS(Ns	127.0.0.1R�csF�jd��j��j�\�d<�d<�djd�dS(Niii(R�RR�R�((tevttpeerRR(sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR��
s

R�i(RR>R�RORMRqRuRgRRRR8R�RWRRAR�RR@RBR�R�R�RR�RPRx(R R
R�RR�R�tclienttclient_addr((R�R�RRsf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_server_accept�
s0

		




c	Csxtjtj�}t|jtj����E}|jtj��}|j�WdQX|j	|j
jtj�WdQXdS(N(
RR>R�RR�RR]R�R�RxR�RtENOTCONN(R R
R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_getpeercert_enotconn�
s
c	Csxtjtj�}t|jtj����E}|jtj��}|j�WdQX|j	|j
jtj�WdQXdS(N(
RR>R�RR�RR]R�R�RxR�RR�(R R
R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_do_handshake_enotconn�
s
cCs�tjtj�}y|jd�Wn!tjk
rF|jd�nXttdtjdt��Z}t	|j
tj����6}|jtj��|j
t|jf�WdQXWdQXWdQX|jdt|jd��dS(NtDESsno DES cipher availableR�R"sno shared cipheri(RR>R�RER?R7RRuRXRR�RR]R�R�RRUR�R!(R R
RR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_default_ciphers�
s		(cCs�tjtj�}ttdtjdt���}t|jtj����I}|j	|j
�d�|jt
|jf�|j|j
�d�WdQX|j	|j
�d�WdQXdS(s�
            Basic tests for SSLSocket.version().
            More tests are done in the test_protocol_*() methods.
            R�R"R�N(RR>R�RRuRXRR�RR�R�R�R�R�RRx(R R
RR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_version_basic�
s		s"test requires ECDH-enabled OpenSSLcCs�tjtj�}|jt�tjdkr>|jd�ntd|��[}t|j	t
j
����7}|jt|j
f�|jd|j�d�WdQXWdQXdS(Niis
ECCdraft:ECDHR
tECDH(iii(RR>R�RgRuR'RERRR�RR�R�RRUR(R R
RR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_default_ecdh_curve�
s
s
tls-uniques*'tls-unique' channel binding not availablecCsItjrtjjd�nttdtjdtj	dtdt
dt�}|��tjt
j
�dtdtd	td
tjdtj	�}|jt|jf�|jd�}tjr�tjjdj|��n|j|�|jt|�d
�|jd�|j�j�}|j|t|�jd��|j�tjt
j
�dtdtd	td
tjdtj	�}|jt|jf�|jd�}tjr�tjjdj|��n|j||�|j|�|jt|�d
�|jd�|j�j�}|j|t|�jd��|j�WdQXdS(s Test tls-unique channel binding.s
R<R�R=R"R.R�R�R�R%s
tls-uniques! got channel binding data: {0!r}
isCB tls-unique
sus-asciis) got another channel binding data: {0!r}
N(RRRRRRRuRRMR�RWRXR�RR�R�RR�R�tassertIsNotNoneRxR�R�R-R#R�R�tassertNotEqual(R RR�tcb_datatpeer_data_reprtnew_cb_data((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR��
s\							


	
		


	cCs�tjtj�}|jt�t||dtdt�}tjrct	j
jdj|d��n|j
|ddddh�dS(NR"R.s got compression: {!r}
R`tZLIBtRLE(RR>R�RgRuRnRWRRRRRR�RUR�(R R
R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_compression%s
	 RTs*ssl.OP_NO_COMPRESSION needed for this testcCsdtjtj�}|jt�|jtjO_t||dtdt�}|j	|dd�dS(NR"R.R`(RR>R�RgRuRJRTRnRWR�R�(R R
R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_compression_disabled.s
cCs�tjtj�}|jt�|jt�|jd�t||dt	dt	�}|dd}|j
d�}d|kr�d|kr�d	|kr�|jd
|d�ndS(NtkEDHR"R.Rit-tADHtEDHtDHEsNon-DH cipher: (RR>R�RgRuR�R�RERnRWR�R�(R R
R�Rtparts((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_dh_params8s


$cCsRtjtj�}|jt�t||dtdt�}|j|dd�dS(NR"R.Rb(	RR>R�RgRuRnRWR�R�(R R
R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_selected_alpn_protocolEs

sALPN support requiredcCs�tjtj�}|jt�tjtj�}|jt�|jddg�t||dtdt�}|j	|dd�dS(NR[tbarR"R.Rb(RR>R�RqRuRgR7RnRWR�R�(R RhRiR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt/test_selected_alpn_protocol_if_server_uses_alpnMs

s!ALPN support needed for this testcCsidddg}ddgdfddgdfdgdfddgdfg}x|D]\}}tjtj�}|jt�|j|�tjtj�}|jt�|j|�t||dtdt�}dt	|�t	|�t	|�f}|d	}	|j
|	|||	d
f�t|d�r>|ddnd
}
|j
|
|||
df�qUWdS(NR[R�t	milkshakeshttp/3.0shttp/4.0R"R.sKfailed trying %s (s) and %s (c).
was expecting %s, but got %%s from the %%sRbR�Rdi����tnothingR(R�RR>R�RgRuR7RnRWR�RxR�(R tserver_protocolstprotocol_teststclient_protocolsRRiRhR�R0t
client_resultt
server_result((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_alpn_protocolsYs*




$cCsRtjtj�}|jt�t||dtdt�}|j|dd�dS(NR"R.Rc(	RR>R�RgRuRnRWR�R�(R R
R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_selected_npn_protocolvs

s NPN support needed for this testcCsiddg}ddgdfddgdfddgdfddgdfg}x|D]\}}tjtj�}|jt�|j|�tjtj�}|jt�|j|�t||dtdt�}dt|�t|�t|�f}|d	}	|j	|	|||	d
f�t
|d�r>|ddnd
}
|j	|
|||
df�qUWdS(Nshttp/1.1sspdy/2ttesttabctdefR"R.sKfailed trying %s (s) and %s (c).
was expecting %s, but got %%s from the %%sRcR�Rei����R�R(RR>R�RgRuR6RnRWR�RxR�(R R�R�R�RRiRhR�R0R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_npn_protocols~s*




$cCsvtjtj�}|jt�tjtj�}|jt�tjtj�}tj|_|jt	�|||fS(N(
RR>R�RgR~tSIGNED_CERTFILE2RORMRqR�(R Rit
other_contextRh((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytsni_contexts�s


cCs+|d}|jd|ff|d�dS(NRaRgRm(RU(R R�R	R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytcheck_common_name�s
csg�|j�\}�}��fd�}|j|�t||dtdd�}|j�d|fg�|j|d�g�t||dtdd�}|j�d|fg�|j|d�g�|jd�t||dtdd�}|j|d�|j�g�dS(Ncs/�j||f�|dk	r+�|_ndS(N(RR�R
(R�tserver_nametinitial_context(tcallsR�(sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
servername_cb�sR"RktsupermessagetfakehostnameRhtnotfunny(R�R�RnRWRxR�R�(R RiRhR�R�((R�R�sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyR��s,
		
	cCs{|j�\}}}d�}|j|�|jtj��"}t||dtdd�}WdQX|j|jj	d�dS(NcSstjS(N(RtALERT_DESCRIPTION_ACCESS_DENIED(R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytcb_returning_alert�sR"RkR�tTLSV1_ALERT_ACCESS_DENIED(
R�R�R]RR?RnRXRxR�R�(R RiR�RhR�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_sni_callback_alert�s	
cCs�|j�\}}}d�}|j|�|jtj��7}tj��"}t||dtdd�}WdQXWdQX|j	|j
jd�|jd|j
��dS(NcSsdddS(Ng�?g((R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt
cb_raising�sR"RkR�tSSLV3_ALERT_HANDSHAKE_FAILUREtZeroDivisionError(R�R�R]RR?Rtcaptured_stderrRnRXRxR�R�RUtgetvalue(R RiR�RhR�R�tstderrR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyttest_sni_callback_raising�s	
cCs�|j�\}}}d�}|j|�|jtj��7}tj��"}t||dtdd�}WdQXWdQX|j	|j
jd�|jd|j
��dS(NcSsdS(NR[((R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pytcb_wrong_return_type�sR"RkR�tTLSV1_ALERT_INTERNAL_ERRORR^(R�R�R]RR?RR�RnRXRxR�R�RUR�(R RiR�RhR�R�R�R�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt#test_sni_callback_wrong_return_type�s	
cCs�tjtj�}tj|_|jt�|jt�td|dt	�}|�f|j
tj��}|jt
|jf�|j�|jt|jd�|jt|jd�WdQXdS(NR
R"ithello(RR>R�RORMRqRuRgRRXR�RR�R�RR�R]R�R�R(R R
RR�((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt,test_read_write_after_close_raises_valuerrors


(4R#R$RKRzR}RBR:R)R�R�R�R�RHRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RRR�R;R�R�R�R�R�tHAS_ALPNR�R�R�tHAS_NPNR�R�R�R�R�R�R�RR(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyRy	sd	&*	&	!	)(	:			}	1	%				;				
			
	'c
Cs�tjr�itjd6tjd6tjd6}xY|j�D]9\}}|�}|r:|dr:d||f}Pq:q:Wttj��}dtj	tj
fGHd|GHdtjGHd	tjGHyd
tj
GHWq�tk
r�q�Xnx]tttttttttttttg
D].}tjj|�stjd|��qqWt t!t"t#g}tj$d�rw|j%t&�nt'r�tj(�}|r�|j%t)�q�nztj*|�Wdt'r�tj+|�nXdS(
NtLinuxtMactWindowsis%s %rstest_ssl: testing with %r %rs          under %ss          HAS_SNI = %rs          OP_ALL = 0x%8xs          OP_NO_TLSv1_1 = 0x%8xsCan't read certificate file %rtnetwork(,RRR@RAtmac_vert	win32_vertitemsR#RR�R'RVRGR�tAttributeErrorRuR�RrRjRkRlRmR~R�R�RhtBADKEYRiRRtexistst
TestFailedR=RRLR�tis_resource_enabledRR�t
_have_threadstthreading_setupRytrun_unittesttthreading_cleanup(RtplatsR	RFtplattfilenametteststthread_info((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt	test_mainsL	


		
		t__main__(\RRBR�RRttest.script_helperRRKRR�R*R3R�RRRvttempfileR�RR�R@RIt
contextlibRt
import_moduleRtsortedt_PROTOCOL_NAMESR>R�R
RuR�tgetfilesystemencodingRrRjRkRlRmRnRoR[R�RsR|R�RR~R�R�R�R�RiRhR�R
RyR�R�R�RtTestCaseRR&R(R)R0R:RKR:RVR�RLR=R�R�RtImportErrorRXRRWttest.ssl_serversRRRRIR�RnRxRyRR#(((sf/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_ssl.pyt<module>s�									��8��)�L

�s.;����
0