Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/OpenSSL/test/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyc


T@Rc@s<dZddlmZmZmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZddlmZmZmZdd	lmZmZmZdd
lmZmZddlmZmZddlmZmZdd
lmZmZmZm Z ddlm!Z!m"Z"m#Z#ddlm$Z$m%Z%m&Z&ddlm'Z'm(Z(m)Z)m*Z*ddlm+Z+m,Z,m-Z-m.Z.ddl/m0Z0m1Z1m2Z2ddl3m4Z4m5Z5ddl3m6Z6m7Z7ddl3m8Z8m9Z9m:Z:yddlm;Z;Wne<k
r!e=Z;nXyddlm>Z>Wne<k
rOe=Z>nXyddlm?Z?Wne<k
r}e=Z?nXddlm@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSdZTdZUdZVdZWdfdYZXd e0eXfd!YZYd"e0eXfd#YZZd$e0fd%YZ[d&e0eXfd'YZ\d(e0eXfd)YZ]d*e0eXfd+YZ^d,e0fd-YZ_d.e0fd/YZ`d0e0eXfd1YZad2e0fd3YZbecd4kr8end5S(6s 
Unit tests for L{OpenSSL.SSL}.
i(tECONNREFUSEDtEINPROGRESStEWOULDBLOCK(tplatform(terrortsocket(tmakedirs(tjoin(tmain(tTYPE_RSAtFILETYPE_PEMt
FILETYPE_ASN1(tPKeytX509t
X509Extension(tdump_privatekeytload_privatekey(tdump_certificatetload_certificate(t
SENT_SHUTDOWNtRECEIVED_SHUTDOWN(tSSLv2_METHODtSSLv3_METHODt
SSLv23_METHODtTLSv1_METHOD(tOP_NO_SSLv2tOP_NO_SSLv3tOP_SINGLE_DH_USE(tVERIFY_PEERtVERIFY_FAIL_IF_NO_PEER_CERTtVERIFY_CLIENT_ONCE(tErrortSysCallErrort
WantReadErrortZeroReturnError(tContexttContextTypet
ConnectiontConnectionType(tTestCasetbytestb(tcleartextCertificatePEMtcleartextPrivateKeyPEM(tclient_cert_pemtclient_key_pem(tserver_cert_pemtserver_key_pemt
root_cert_pem(tOP_NO_QUERY_MTU(tOP_COOKIE_EXCHANGE(tOP_NO_TICKET(tSSL_ST_CONNECTt
SSL_ST_ACCEPTtSSL_ST_MASKtSSL_ST_INITt
SSL_ST_BEFOREt	SSL_ST_OKtSSL_ST_RENEGOTIATEtSSL_CB_LOOPtSSL_CB_EXITtSSL_CB_READtSSL_CB_WRITEtSSL_CB_ALERTtSSL_CB_READ_ALERTtSSL_CB_WRITE_ALERTtSSL_CB_ACCEPT_LOOPtSSL_CB_ACCEPT_EXITtSSL_CB_CONNECT_LOOPtSSL_CB_CONNECT_EXITtSSL_CB_HANDSHAKE_STARTtSSL_CB_HANDSHAKE_DONEs[-----BEGIN DH PARAMETERS-----
MBYCEQCobsg29c9WZP/54oAPcwiDAgEC
-----END DH PARAMETERS-----
cCs|S(N((tconntcertterrnumtdepthtok((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt	verify_cb>scCst}|jd|jdt}|jt|jd|jdf|jt|jd}|j	t
d|jdt
dkst|j	t
d|jdt
dkst|jt|jt||fS(	sQ
    Establish and return a pair of network sockets connected to each other.
    tiis	127.0.0.1txity(RNi(
RtbindtlistentsetblockingtFalset
connect_extgetsocknametTruetaccepttsendR)trecvtAssertionError(tporttclienttserver((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytsocket_pairAs	

	

!!

cCs]||g}xJ|rXx=|D]5}y|jWntk
rCqX|j|qWqWdS(N(tdo_handshakeR!tremove(R]R^tconnsRH((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt	handshake_s	

t_LoopbackMixincBs eZdZdZdZRS(s
    Helper mixin which defines methods for creating a connected socket pair and
    for forcing two connected SSL sockets to talk to each other via memory BIOs.
    cCst\}}tt}|jttt|jttt	t
||}|jt
tt|}|jt
|||jt|jt||fS(N(R_R#Rtuse_privatekeyRR
R/tuse_certificateRR.R%tset_accept_statetset_connect_stateRcRSRW(tselfR^R]tctx((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt	_loopbackps




cCst}x|rt}x||f||fgD]\}}y|jd}Wntk
r`nX||fSxEtry|jd}Wntk
rPqnXt}|j|qnWq.Wq	WdS(s
        Try to read application bytes from each of the two L{Connection}
        objects.  Copy bytes back and forth between their send/receive buffers
        for as long as there is anything to copy.  When there is nothing more
        to copy, return C{None}.  If one of them actually manages to deliver
        some application bytes, return a two-tuple of the connection from which
        the bytes were read and the bytes themselves.
        iiiNi(RWRTRZR!tbio_readt	bio_write(Ritclient_conntserver_conntwrotetreadtwriteR(tdirty((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_interactInMemorys"		

	
(t__name__t
__module__t__doc__RkRt(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRdks	tContextTestscBs|eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZedkrn	dZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*RS()s0
    Unit tests for L{OpenSSL.SSL.Context}.
    cCsNx!tttgD]}t|qW|jttd|jttddS(s
        L{Context} can be instantiated with one of L{SSLv2_METHOD},
        L{SSLv3_METHOD}, L{SSLv23_METHOD}, or L{TLSv1_METHOD}.
        RNi
N(RRRR#tassertRaisest	TypeErrort
ValueError(Ritmeth((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_methodscCs'|jtt|jtdtdS(s
        L{Context} and L{ContextType} refer to the same type object and can be
        used to create instances of that type.
        R#N(tassertIdenticalR#R$tassertConsistentTypeR(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt	test_typescCsLt}|jtdtt}|j||jt|jddS(sU
        L{Context.use_privatekey} takes an L{OpenSSL.crypto.PKey} instance.
        iRNN(Rtgenerate_keyR	R#RReRyRz(RitkeyRj((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_use_privatekeys
	
cCs<tt}|jt|j|jt|jdddS(sm
        L{Context.set_app_data} raises L{TypeError} if called with other than
        one argument.
        N(R#RRyRztset_app_datatNone(Ritcontext((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_app_data_wrong_argsscCs&tt}|jt|jddS(sc
        L{Context.get_app_data} raises L{TypeError} if called with any
        arguments.
        N(R#RRyRztget_app_dataR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_app_data_wrong_argsscCs<t}tt}|j||j|j|dS(su
        L{Context.set_app_data} stores an object for later retrieval using
        L{Context.get_app_data}.
        N(tobjectR#RRR~R(Ritapp_dataR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_app_datas	
cCsRtt}|jt|j|jt|jd|jt|jdddS(s
        L{Context.set_options} raises L{TypeError} if called with the wrong
        number of arguments or a non-C{int} argument.
        iN(R#RRyRztset_optionsR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_options_wrong_argsscCsRtt}|jt|j|jt|jd|jt|jdddS(s
        L{Context.set_timeout} raises L{TypeError} if called with the wrong
        number of arguments or a non-C{int} argument.
        iN(R#RRyRztset_timeoutR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_timeout_wrong_argsscCs&tt}|jt|jddS(sZ
        L{Context.get_timeout} raises L{TypeError} if called with any arguments.
        N(R#RRyRztget_timeoutR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_timeout_wrong_args	scCs3tt}|jd|j|jddS(s
        L{Context.set_timeout} sets the session timeout for all connections
        created using the context object.  L{Context.get_timeout} retrieves this
        value.
        iN(R#RRtassertEqualsR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_timeouts
cCsRtt}|jt|j|jt|jd|jt|jdddS(s
        L{Context.set_verify_depth} raises L{TypeError} if called with the wrong
        number of arguments or a non-C{int} argument.
        iN(R#RRyRztset_verify_depthR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt test_set_verify_depth_wrong_argsscCs&tt}|jt|jddS(s_
        L{Context.get_verify_depth} raises L{TypeError} if called with any arguments.
        N(R#RRyRztget_verify_depthR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt test_get_verify_depth_wrong_args'scCs3tt}|jd|j|jddS(s
        L{Context.set_verify_depth} sets the number of certificates in a chain
        to follow before giving up.  The value can be retrieved with
        L{Context.get_verify_depth}.
        iN(R#RRRR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_verify_depth/s
cCsmt}|jtd|j}t|d}tt|d|}|j|jd|j	|S(s
        Write a new private key out to a new file, encrypted using the given
        passphrase.  Return the path to the new file.
        itwtblowfishtascii(
RRR	tmktemptopenRR
Rrtdecodetclose(Rit
passphraseRtpemFiletfObjtpem((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_write_encrypted_pem:s	
cCsXtt}|jt|j|jt|jd|jt|jddddS(s
        L{Context.set_passwd_cb} raises L{TypeError} if called with the
        wrong arguments or with a non-callable first argument.
        cSsdS(N(R(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt<lambda>QsN(R#RRyRzt
set_passwd_cbR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_passwd_cb_wrong_argsIscstd|j}gfd}tt}|j||j||jtd|jtddt	|jtddt	|j
ddddS(s
        L{Context.set_passwd_cb} accepts a callable which will be invoked when
        a private key is loaded from an encrypted PEM.
        tfoobarcsj|||fS(N(tappend(tmaxlentverifytextra(t
calledWithR(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytpassphraseCallback\siiiN(R)RR#RRtuse_privatekey_filet
assertTruetlent
isinstancetinttassertEqualR(RiRRR((RRs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_passwd_cbTs

cCsQ|jtd}d}tt}|j||jt|j|dS(st
        L{Context.use_privatekey_file} propagates any exception raised by the
        passphrase callback.
        smonkeys are nicecSstddS(NsSorry, I am a fail.(tRuntimeError(RRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRnsN(RR)R#RRRyRR(RiRRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_passwd_callback_exceptionhs
	
cCsQ|jtd}d}tt}|j||jt|j|dS(s
        L{Context.use_privatekey_file} raises L{OpenSSL.SSL.Error} if the
        passphrase callback returns a false value.
        smonkeys are nicecSsdS(N(R(RRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR|sN(RR)R#RRRyRR(RiRRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_passwd_callback_falsevs
	
cCsQ|jtd}d}tt}|j||jt|j|dS(s
        L{Context.use_privatekey_file} raises L{OpenSSL.SSL.Error} if the
        passphrase callback returns a true non-string value.
        smonkeys are nicecSsdS(Ni
((RRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRsN(RR)R#RRRyRR(RiRRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_passwd_callback_non_strings
	
csXtdd|j}fd}tt}|j||j|dS(s
        If the passphrase returned by the passphrase callback returns a string
        longer than the indicated maximum length, it is truncated.
        ROics |dksttdS(NiRP(R[R)(RRR(R(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRsN(R)RR#RRR(RiRRR((Rs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_passwd_callback_too_longs
cst\}}ttt|}|jgfd}tt}|j||jttt	|j
tttt||}|j
xCsx6||fD](}y|jWqtk
rqXqWqW|jdS(s
        L{Context.set_info_callback} accepts a callable which will be invoked
        when certain information about an SSL connection is available.
        csj|||fdS(N(R(RHtwheretret(tcalled(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytinfosN(R_R%R#RRhtset_info_callbackRfRR
R*ReRR+RgR`R!R(RiR^R]t	clientSSLRRt	serverSSLtssl((Rs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_info_callbacks(


	
c	Gst\}}tt}|j||jtdt||}|jtt}|jt	t
t|jt
t
tt||}|jt|||j}|j|jjddS(s
        Create a client context which will verify the peer certificate and call
        its C{load_verify_locations} method with C{*args}.  Then connect it to a
        server and ensure that the handshake succeeds.
        cSs|S(N((RHRIterrnoRKtpreverify_ok((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRssTesting Root CAN(R_R#Rtload_verify_locationst
set_verifyRR%RhRfRR
R*ReRR+RgRctget_peer_certificateRtget_subjecttCN(	RitargsR^R]t
clientContextRt
serverContextRRI((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_load_verify_locations_tests$




cCsL|j}t|d}|jtjd|j|j|dS(s
        L{Context.load_verify_locations} accepts a file name and uses the
        certificates within for verification purposes.
        RRN(RRRrR*RRR(RitcafileR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_verify_files

cCs,tt}|jt|j|jdS(sm
        L{Context.load_verify_locations} raises L{Error} when passed a
        non-existent cafile.
        N(R#RRyRRR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_verify_invalid_filescCs|j}t|xRddgD]D}t||}t|d}|jtjd|jq#W|jd|dS(s
        L{Context.load_verify_locations} accepts a directory name and uses
        the certificates within for verification purposes.
        s
c7adac82.0s
c3705638.0RRN(
RRRRRrR*RRRR(RitcapathtnameRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_verify_directorys
cCswtt}|jt|j|jt|jt|jt|jtt|jt|jddddS(s
        L{Context.load_verify_locations} raises L{TypeError} if called with
        the wrong number of arguments or with non-C{str} arguments.
        N(R#RRyRzRRR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt%test_load_verify_locations_wrong_argss
twin32cCstt}|j|jtdt}|jdt||}|j|j	|j
d|j|jddS(s
            L{Context.set_default_verify_paths} causes the platform-specific CA
            certificate locations to be used for verification purposes.
            cSs|S(N((RHRIRRKR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR9ssverisign.comisGET / HTTP/1.0

iN(sverisign.comi(
R#Rtset_default_verify_pathsRRRtconnectR%RhR`RYRRZ(RiRR]R((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_default_verify_paths's

	



cCsRtt}|jt|jd|jt|jd|jt|jddS(sv
        L{Context.set_default_verify_paths} takes no arguments and raises
        L{TypeError} if given any.
        iRNN(R#RRyRzRR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt'test_set_default_verify_paths_signatureDscCs[tt}|jt|j|jt|jt|jt|jttdS(s
        L{Context.add_extra_chain_cert} raises L{TypeError} if called with
        other than one argument or if called with an object which is not an
        instance of L{X509}.
        N(R#RRyRztadd_extra_chain_certR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt&test_add_extra_chain_cert_invalid_certOscCsAttdttd}t}|jtdt}d|j_|j	|j|j
||jtd|jtd|j
|g|jd|j|dt}|jtdt}d	|j_|j	|j|j
||jtd|jtd|j
|g|jd|j|dt}|jtdt}d
|j_|j	|j|j
||jtd|jtd|j
ttdttdg|jd|j|d||f||f||fgS(s
        Construct and return a chain of certificates.

            1. A new self-signed certificate authority certificate (cacert)
            2. A new intermediate certificate signed by cacert (icert)
            3. A new server certificate signed by icert (scert)
        tbasicConstraintssCA:trueisAuthority Certificatet20000101000000Zt20200101000000Zitsha1sIntermediate CertificatesServer CertificatesCA:false(RR)RTRRR	R
Rt
commonNamet
set_issuert
set_pubkeyt
set_notBeforetset_notAftertadd_extensionstset_serial_numbertsignRW(Ritcaexttcakeytcacerttikeyticerttskeytscert((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_create_certificate_chain[sH		

		

		
"
c	Cst\}}t||}|jt||}|jxMtdD]?}x6||gD](}y|jWqatk
rqaXqaWqNWdS(s
        Verify that a client and server created with the given contexts can
        successfully handshake and communicate.
        iN(R_R%RgRhtrangeR`R!(	RiRRtserverSockettclientSocketR^R]tits((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_handshake_tests


cCsu|j}|\\}}\}}\}}xg|df|df|dfgD]D\}}	t|	d}
|
jtt|jd|
jqOWxg|df|df|dfgD]D\}}	t|	d}
|
jtt|jd|
jqWtt	}|j
||j||j|tt	}
|
j
ttBt|
jd|j||
d	S(
s
        L{Context.add_extra_chain_cert} accepts an L{X509} instance to add to
        the certificate chain.

        See L{_create_certificate_chain} for the details of the certificate
        chain tested.

        The chain is tested by starting a server with scert and connecting
        to it with a client which trusts cacert and requires verification to
        succeed.
        sca.pemsi.pemss.pemRRsca.keysi.keyss.keyN(RRRrRR
RRRR#RReRfRRRRRMRR(RitchainRRRRRRRIRRRRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_add_extra_chain_certs&!..



cCsN|j}|\\}}\}}\}}|j}t|d}	|	jtt|jd|	jtt|jd|	jtt|jd|	jtt	}
|
j
||
j|tdd}	|	jtt|jd|	jtt	}|jt
tBt|jd|j|
|dS(s
        L{Context.use_certificate_chain_file} reads a certificate chain from
        the specified file.

        The chain is tested by starting a server with scert and connecting
        to it with a client which trusts cacert and requires verification to
        succeed.
        RRsca.pemN(RRRRrRR
RRR#Rtuse_certificate_chain_fileReRRRRMRR(RiRRRRRRRt	chainFileRRR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_use_certificate_chain_files&	!




cCs&tt}|jt|jddS(sf
        L{Context.get_verify_mode} raises L{TypeError} if called with any
        arguments.
        N(R#RRyRztget_verify_modeR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_verify_mode_wrong_argsscCsWtt}|j|jd|jttBd|j|jttBdS(s~
        L{Context.get_verify_mode} returns the verify mode flags previously
        passed to L{Context.set_verify}.
        icWsdS(N(R(R((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRsN(R#RRRRRR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_verify_modescCsUtt}|jt|j|jt|jdd|jt|jtdS(s
        L{Context.load_tmp_dh} raises L{TypeError} if called with the wrong
        number of arguments or with a non-C{str} argument.
        tfooN(R#RRyRztload_tmp_dhRR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_tmp_dh_wrong_argsscCs&tt}|jt|jddS(sr
        L{Context.load_tmp_dh} raises L{OpenSSL.SSL.Error} if the specified file
        does not exist.
        thelloN(R#RRyRR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_tmp_dh_missing_filescCsOtt}|j}t|d}|jt|j|j|dS(si
        L{Context.load_tmp_dh} loads Diffie-Hellman parameters from the
        specified file.
        RN(R#RRRRrtdhparamRR(RiRt
dhfilenametdhfile((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_tmp_dh$s

cCsEtt}|jdt|d}|j|jdgdS(s
        L{Context.set_cipher_list} accepts a C{str} naming the ciphers which
        connections created with the context object will be able to choose from.
        shello world:EXP-RC4-MD5sEXP-RC4-MD5N(R#Rtset_cipher_listR%RRtget_cipher_list(RiRRH((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_cipher_list2s
(+RuRvRwR}RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRxsT					
																		"	&	
	
						5		,	'			
				tConnectionTestscBseZdZdZdZdZdZdZdZdZ	dZ
ed	krcn	d
ZdZ
dZd
ZdZdZdZdZdZRS(s3
    Unit tests for L{OpenSSL.SSL.Connection}.
    cCs6|jtttt}|jtd|ddS(s
        L{Connection} and L{ConnectionType} refer to the same type object and
        can be used to create instances of that type.
        R%N(R~R%R&R#RRR(RiRj((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRTscCs5tt}t|d}|j|j|dS(s
        L{Connection.get_context} returns the L{Context} instance used to
        construct the L{Connection} instance.
        N(R#RR%RR~tget_context(RiRt
connection((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_context^scCs/tttd}|jt|jddS(se
        L{Connection.get_context} raises L{TypeError} if called with any
        arguments.
        N(R%R#RRRyRzR
(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_context_wrong_argshscCs/tttd}|j|jddS(si
        L{Connection.pending} returns the number of bytes available for
        immediate read.
        iN(R%R#RRRtpending(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_pendingqscCs/tttd}|jt|jddS(sY
        L{Connection.pending} raises L{TypeError} if called with any arguments.
        N(R%R#RRRyRzR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_pending_wrong_argszscCs^tttt}|jt|jd|jt|j|jt|jdddS(s
        L{Connection.connect} raises L{TypeError} if called with a non-address
        argument or with the wrong number of arguments.
        s	127.0.0.1iN(s	127.0.0.1i(R%R#RRRyRzRR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_connect_wrong_argsscCsWt}tt}t||}|jt|jd}|j|jdt	dS(sy
        L{Connection.connect} raises L{socket.error} if the underlying socket
        connect method raises it.
        s	127.0.0.1iiN(s	127.0.0.1i(
RR#RR%RyRRRRR(RiR]RRtexc((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_connect_refuseds
	cCs\t}|jd|jdtttt}|jd|jdfdS(sZ
        L{Connection.connect} establishes a connection to the specified address.
        RNiis	127.0.0.1iN(RNi(RRQRRR%R#RRRV(RiR\R((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_connects
	

tdarwincCst}|jd|jdtttt}|jt|j|j	}t
tf}|j||kd||fdS(s
            If there is a connection error, L{Connection.connect_ex} returns the
            errno instead of raising an exception.
            RNiis%r not in %rN(RNi(
RRQRRR%R#RRSRTRURVRRR(RiR\Rtresulttexpected((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_connect_exs	


cCs2tttt}|jt|jddS(sX
        L{Connection.accept} raises L{TypeError} if called with any arguments.
        N(R%R#RRRyRzRXR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_accept_wrong_argsscCstt}|jttt|jtttt	}t
||}|jd|jdt
ttt	}|j
d|jdf|j\}}|jt|t
|j|j||j||jdS(s
        L{Connection.accept} accepts a pending connection attempt and returns a
        tuple of a new L{Connection} (the accepted client) and the address the
        connection originated from.
        RNiis	127.0.0.1iN(RNi(R#RReRR
R/RfRR.RR%RQRRRRVRXRRR~R
R(RiRjR\tportSSLRRtaddress((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_accepts	

cCstttd}|jt|jd|jt|jd|jt|j|jt|jd|jt|jdddS(s
        L{Connection.shutdown} raises L{TypeError} if called with the wrong
        number of arguments or with arguments other than integers.
        iiN(	R%R#RRRyRztshutdowntget_shutdowntset_shutdown(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_shutdown_wrong_argsscCs|j\}}|j|j|j|jt|jt|jd|j|jt	|j|j|jtt	B|jt|jd|j|jtt	BdS(sS
        L{Connection.shutdown} performs an SSL-level connection shutdown.
        iN(
RktassertFalseR RR!RRyR"RZR(RiR^R]((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_shutdowns
cCs?tttt}|jt|j|jtdS(sk
        L{Connection.set_shutdown} sets the state of the SSL connection shutdown
        process.
        N(R%R#RRR"RRR!(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_shutdowns
cCs[tttd}|jt|jd|jt|j|jt|jdddS(s
        L{Connection.set_app_data} raises L{TypeError} if called with other than
        one argument.  L{Connection.get_app_data} raises L{TypeError} if called
        with any arguments.
        N(R%R#RRRyRzRR(RiRH((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_app_data_wrong_argsscCsEtttd}t}|j||j|j|dS(s
        Any object can be set as app data by passing it to
        L{Connection.set_app_data} and later retrieved with
        L{Connection.get_app_data}.
        N(R%R#RRRRR~R(RiRHR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRs	
cCs,tttd}|jt|jdS(sz
        L{Connection.makefile} is not implemented and calling that method raises
        L{NotImplementedError}.
        N(R%R#RRRytNotImplementedErrortmakefile(RiRH((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_makefiles(RuRvRwRRRRRRRRRRRRR#R%R&R'RR*(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR>s(	
	
								
				
		
		tConnectionGetCipherListTestscBs eZdZdZdZRS(s2
    Tests for L{Connection.get_cipher_list}.
    cCs/tttd}|jt|jddS(si
        L{Connection.get_cipher_list} raises L{TypeError} if called with any
        arguments.
        N(R%R#RRRyRzR
(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_wrong_args)scCsbtttd}|j}|jt|tx$|D]}|jt|tq>WdS(s
        L{Connection.get_cipher_list} returns a C{list} of C{str} giving the
        names of the ciphers which might be used.
        N(	R%R#RRR
RRtlisttstr(RiRtcipherstcipher((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_result2s

(RuRvRwR,R1(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR+%s		tConnectionSendTestscBsEeZdZdZdZyeWnek
r9n
XdZRS(s&
    Tests for L{Connection.send}
    cCs^tttd}|jt|j|jt|jt|jt|jdddS(sx
        When called with arguments other than a single string,
        L{Connection.send} raises L{TypeError}.
        RtbarN(R%R#RRRyRzRYR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR,CscCsZ|j\}}|jtd}|j|d|j|jdtddS(s
        When passed a short byte string, L{Connection.send} transmits all of it
        and returns the number of bytes sent.
        txyiN(RkRYR)RRZ(RiR^R]tcount((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_short_bytesNscCs`|j\}}|jttd}|j|d|j|jdtddS(s
            When passed a memoryview onto a small number of bytes,
            L{Connection.send} transmits all of them and returns the number of
            bytes sent.
            R4iN(RkRYt
memoryviewR)RRZ(RiR^R]R5((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_short_memoryview]s(RuRvRwR,R6R7t	NameErrorR8(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR2?s		

tConnectionSendallTestscBsWeZdZdZdZyeWnek
r9n
XdZdZdZ	RS(s*
    Tests for L{Connection.sendall}.
    cCs^tttd}|jt|j|jt|jt|jt|jdddS(s{
        When called with arguments other than a single string,
        L{Connection.sendall} raises L{TypeError}.
        RR3N(R%R#RRRyRztsendallR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR,nscCsH|j\}}|jtd|j|jdtddS(sf
        L{Connection.sendall} transmits all of the bytes in the string passed to
        it.
        ROiN(RkR;R)RRZ(RiR^R]((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_shortyscCsN|j\}}|jttd|j|jdtddS(s
            When passed a memoryview onto a small number of bytes,
            L{Connection.sendall} transmits all of them.
            ROiN(RkR;R7R)RRZ(RiR^R]((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR8scCs|j\}}tdd
td}|j|g}d}xB|t|kr|jd}|j||t|7}qHW|j|tdj|dS(s
        L{Connection.sendall} transmits all of the bytes in the string passed to
        it even if this requires multiple calls of an underlying write function.
        ROii iRPiRNNii(RkR)R;RRZRRR(RiR^R]tmessagetaccumtreceivedtdata((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt	test_longs

cCs9|j\}}|jd|jt|jddS(s
        If the underlying socket is closed, L{Connection.sendall} propagates the
        write error from the low level write call.
        ishello, worldN(Rkt
sock_shutdownRyR R;(RiR^R]((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_closeds
(
RuRvRwR,R<R7R9R8RARC(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR:js		

	
	tConnectionRenegotiateTestscBs)eZdZdZdZdZRS(s+
    Tests for SSL renegotiation APIs.
    cCs/tttd}|jt|jddS(se
        L{Connection.renegotiate} raises L{TypeError} if called with any
        arguments.
        N(R%R#RRRyRztrenegotiate(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_renegotiate_wrong_argsscCs/tttd}|jt|jddS(sn
        L{Connection.total_renegotiations} raises L{TypeError} if called with
        any arguments.
        N(R%R#RRRyRzttotal_renegotiations(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt$test_total_renegotiations_wrong_argsscCs/tttd}|j|jddS(sr
        L{Connection.total_renegotiations} returns C{0} before any
        renegotiations have happened.
        iN(R%R#RRRRG(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_total_renegotiationss(RuRvRwRFRHRI(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRDs				t
ErrorTestscBseZdZdZRS(s.
    Unit tests for L{OpenSSL.SSL.Error}.
    cCs-|jttt|jtjddS(s0
        L{Error} is an exception type.
        RN(Rt
issubclassRt	ExceptionRRu(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRs(RuRvRwR(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRJstConstantsTestscBsVeZdZedk	r$dZnedk	r<dZnedk	rTdZ	nRS(s
    Tests for the values of constants exposed in L{OpenSSL.SSL}.

    These are values defined by OpenSSL intended only to be used as flags to
    OpenSSL APIs.  The only assertions it seems can be made about them is
    their values.
    cCs|jtddS(s
            The value of L{OpenSSL.SSL.OP_NO_QUERY_MTU} is 0x1000, the value of
            I{SSL_OP_NO_QUERY_MTU} defined by I{openssl/ssl.h}.
            iN(RR1(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_op_no_query_mtuscCs|jtddS(s
            The value of L{OpenSSL.SSL.OP_COOKIE_EXCHANGE} is 0x2000, the value
            of I{SSL_OP_COOKIE_EXCHANGE} defined by I{openssl/ssl.h}.
            i N(RR2(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_op_cookie_exchangescCs|jtddS(s
            The value of L{OpenSSL.SSL.OP_NO_TICKET} is 0x4000, the value of
            I{SSL_OP_NO_TICKET} defined by I{openssl/ssl.h}.
            i@N(RR3(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_op_no_ticketsN(
RuRvRwR1RRNR2ROR3RP(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRMs

tMemoryBIOTestscBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZRS(sA
    Tests for L{OpenSSL.SSL.Connection} using a memory BIO.
    cCstt}|jttBtB|jttBt	Bt
|j}|jt
tt|jttt|j|jtttt||}|j|S(sc
        Create a new server-side SSL L{Connection} object wrapped around
        C{sock}.
        (R#RRRRRRRRRRMtget_cert_storeReRR
R/RfRR.tcheck_privatekeytadd_certR0R%Rg(Ritsockt
server_ctxtserver_storeRo((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_server"s

cCstt}|jttBtB|jttBt	Bt
|j}|jt
tt|jttt|j|jtttt||}|j|S(sc
        Create a new client-side SSL L{Connection} object wrapped around
        C{sock}.
        (R#RRRRRRRRRRMRRReRR
R-RfRR,RSRTR0R%Rh(RiRUt
client_ctxtclient_storeRn((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_client8s

cCs|jd}|jd}|j|jd|j|jd|j|jd|j|j||d|j|jd|j|jd|j|jd|j	|j|j|j	|j|j|j
|j|j|j
|j|jtd}|j||j	|j||||f|j|ddd|j	|j||||dddfdS(s
        Two L{Connection}s which use memory BIOs can be manually connected by
        reading from the output of each and writing those bytes to the input of
        the other and in this way establish a connection and exchange
        application-level bytes with each other.
        sOne if by land, two if by sea.Ni(
RXRR[R~t
master_keyt
client_randomt
server_randomRttassertNotIdenticalRtassertNotEqualsR)Rr(RiRoRntimportant_message((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_memoryConnectLs.

cCs|j\}}td}|j||jd}|j|||ddd}|j||jd}|j||dS(s
        Just like L{test_memoryConnect} but with an actual socket.

        This is primarily to rule out the memory BIO code as the source of
        any problems encountered while passing data over a L{Connection} (if
        this test fails, there must be a problem outside the memory BIO
        code, as no memory BIO is involved here).  Even though this isn't a
        memory BIO test, it's convenient to have it here.
        s,Help me Obi Wan Kenobi, you're my only hope.iNi(RkR)RYRZR(RiRoRnRatmsg((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_socketConnectxs


cCsgtt}t}t||}|jt|jd|jt|jd|jt|jdS(s
        Test that L{OpenSSL.SSL.bio_read} and L{OpenSSL.SSL.bio_write} don't
        work on L{OpenSSL.SSL.Connection}() that use sockets.
        idRN(	R#RRR%RyRzRlRmtbio_shutdown(RiRR]R((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_socketOverridesMemorys	cCs|jd}|jd}|j||d}|jd|}|j||k|j||\}}|j|||jt||dS(s 
        If more bytes than can be written to the memory BIO are passed to
        L{Connection.send} at once, the number of bytes which were written is
        returned and that many bytes from the beginning of the input can be
        read from the other end of the connection.
        iiRONi(	RXRR[RtRYRR~RR(RiR^R]tsizetsenttreceiverR?((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_outgoingOverflowscCsH|jd}|j|jt|jd}|j|jtdS(s{
        L{Connection.bio_shutdown} signals the end of the data stream from
        which the L{Connection} reads.
        iN(RXRReRyRRZRt	__class__(RiR^te((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR%s
cCs|jd}|jd}|j|jg|j|jg|j}||}|j|jg|j|j||j|||j|j||j|j|dS(s
        Verify the return value of the C{get_client_ca_list} method for server and client connections.

        @param func: A function which will be called with the server context
            before the client and server are connected to each other.  This
            function should specify a list of CAs for the server to send to the
            client and return that same list.  The list will be used to verify
            that C{get_client_ca_list} returns the proper value at various
            times.
        N(RXRR[Rtget_client_ca_listR
Rt(RitfuncR^R]RjR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_check_client_ca_listscCsXtt}|jt|jd|jt|jdg|j|jgddS(s
        L{Context.set_client_ca_list} raises a L{TypeError} if called with a
        non-list or a list that contains objects other than X509Names.
        tspamN(R#RRyRztset_client_ca_listR~R(RiRj((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_client_ca_list_errorsscCsd}|j|dS(s
        If passed an empty list, L{Context.set_client_ca_list} configures the
        context to send no CA names to the client and, on both the server and
        client sides, L{Connection.get_client_ca_list} returns an empty list
        after the connection is set up.
        cSs|jggS(N(Rq(Rj((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytno_cas
N(Ro(RiRs((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_empty_ca_lists	cs;ttt}|jfd}|j|dS(sK
        If passed a list containing a single X509Name,
        L{Context.set_client_ca_list} configures the context to send that CA
        name to the client and, on both the server and client sides,
        L{Connection.get_client_ca_list} returns a list containing that
        X509Name after the connection is set up.
        cs|jggS(N(Rq(Rj(tcadesc(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt	single_casN(RR
R0RRo(RiRRv((Rus9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_one_ca_listscsYttt}ttt}|j|jfd}|j|dS(sW
        If passed a list containing multiple X509Name objects,
        L{Context.set_client_ca_list} configures the context to send those CA
        names to the client and, on both the server and client sides,
        L{Connection.get_client_ca_list} returns a list containing those
        X509Names after the connection is set up.
        csg}|j||S(N(Rq(RjtL(tcldesctsedesc(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytmultiple_cas
N(RR
R.RRo(RitsecerttclcertR{((RzRys9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_multiple_ca_listscswttt}ttt}ttt}|j|j|jfd}|j|dS(s
        If called multiple times, only the X509Names passed to the final call
        of L{Context.set_client_ca_list} are used to configure the CA names
        sent to the client.
        cs*|jg|jggS(N(Rq(Rj(RyRzRu(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
changed_ca(sN(RR
R0R.RRo(RiRR|R}R((RuRzRys9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_reset_ca_listscsYttt}ttt}|j|jfd}|j|dS(s
        If the list passed to L{Context.set_client_ca_list} is mutated
        afterwards, this does not affect the list of CA names sent to the
        client.
        cs-g}|jg|jgS(N(RqR(RjRx(RzRu(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
mutated_ca;s	
N(RR
R0R.RRo(RiRR|R((RzRus9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_mutated_ca_list/scCsatt}ttt}|jt|j|jt|jd|jt|j||dS(s
        L{Context.add_client_ca} raises L{TypeError} if called with a non-X509
        object or with a number of arguments other than one.
        RpN(R#RRR
R0RyRzt
add_client_ca(RiRjR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_add_client_ca_errorsCs
cs>tttjfd}|j|dS(s~
        A certificate's subject can be added as a CA to be sent to the client
        with L{Context.add_client_ca}.
        cs|jgS(N(R(Rj(RRu(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRvVs
N(RR
R0RRo(RiRv((RuRs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_one_add_client_caOscs_ttttttjjfd}|j|dS(s
        Multiple CA names can be sent to the client by calling
        L{Context.add_client_ca} with multiple X509 objects.
        cs$|j|jgS(N(R(Rj(RR|RuRz(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR{gs

N(RR
R0R.RRo(RiR{((RzR|RuRs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_multiple_add_client_ca\scszttt}ttt}ttt|j|jjfd}|j|dS(s
        A call to L{Context.set_client_ca_list} followed by a call to
        L{Context.add_client_ca} results in using the CA names from the first
        call and the CA name from the second call.
        cs-|jg|jgS(N(RqR(Rj(RyRzRuR}(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytmixed_set_add_ca|s
N(RR
R0R.RRo(RiRR|R((R}RuRzRys9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_and_add_client_canscsnttt}tttttt|jjfd}|j|dS(s
        A call to L{Context.set_client_ca_list} after a call to
        L{Context.add_client_ca} replaces the CA name specified by the former
        call with the names specified by the latter cal.
        cs4|j|jg|jgS(N(RRq(Rj(R}R|RuRz(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytset_replaces_add_cas

N(RR
R0R.RRo(RiRR((R}R|RuRzs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_after_add_client_cas(RuRvRwRXR[RbRdRfRjR%RoRrRtRwR~RRRRRRR(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRQs(			,		
		
			
						
		tInfoConstantTestscBseZdZdZRS(sI
    Tests for assorted constants exposed for use in info callbacks.
    cCsgx`tttttttttt	t
ttt
ttttttgD]}|jt|tqCWdS(s 
        All of the info constants are integers.

        This is a very weak test.  It would be nice to have one that actually
        verifies that as certain info events happen, the value passed to the
        info callback matches up with the constant exposed by OpenSSL.SSL.
        N(R4R5R6R7R8R9R:R;R<R=R>R?R@RARBRCRDRERFRGRRR(Ritconst((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_integerss			(RuRvRwR(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRst__main__N(dRwRRRRtsysRRRtosRtos.pathRtunittestRtOpenSSL.cryptoR	R
RRR
RRRRRtOpenSSL.SSLRRRRRRRRRRRRRR R!R"R#R$R%R&tOpenSSL.test.utilR'R(R)tOpenSSL.test.test_cryptoR*R+R,R-R.R/R0R1tImportErrorRR2R3R4R5R6R7R8R9R:R;R<R=R>R?R@RARBRCRDRERFRGRRMR_RcRdRxRR+R2R:RDRJRMRQRRu(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt<module>sj"""





			G+G5
+{