403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/OpenSSL/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSdZTd„ZUd„ZVd„ZWdfd„ƒYZXd e0eXfd!„ƒYZYd"e0eXfd#„ƒYZZd$e0fd%„ƒYZ[d&e0eXfd'„ƒYZ\d(e0eXfd)„ƒYZ]d*e0eXfd+„ƒYZ^d,e0fd-„ƒYZ_d.e0fd/„ƒYZ`d0e0eXfd1„ƒYZad2e0fd3„ƒYZbecd4kr8eƒnd5S(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>scCsÿtƒ}|jdƒ|jdƒtƒ}|jtƒ|jd|jƒdfƒ|jtƒ|jƒd}|j	t
dƒƒ|jdƒt
dƒks§t‚|j	t
dƒƒ|jdƒt
dƒksÛt‚|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|jƒWntk
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 eZdZd„Zd„ZRS(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.
    cCs°tƒ\}}ttƒ}|jtttƒƒ|jttt	ƒƒt
||ƒ}|jƒt
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




cCs¿t}x²|rºt}xŸ||f||fgD]…\}}y|jdƒ}Wntk
r`nX||fSxEtr²y|jdƒ}Wntk
r›PqnXt}|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_interactInMemory‚s"		

	
(t__name__t
__module__t__doc__RkRt(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRdks	tContextTestscBs|eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zedkrn	d„Zd„Zd„Z d„Z!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ƒ|jttdƒdS(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_method¶scCs'|jttƒ|jtdtƒdS(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_typeÁscCsLtƒ}|jtdƒttƒ}|j|ƒ|jt|jdƒdS(sU
        L{Context.use_privatekey} takes an L{OpenSSL.crypto.PKey} instance.
        i€RNN(Rtgenerate_keyR	R#RReRyRz(RitkeyRj((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_use_privatekeyÊs
	
cCs<ttƒ}|jt|jƒ|jt|jddƒdS(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_argsÕscCs&ttƒ}|jt|jdƒdS(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_argsßs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#RR„R~Rˆ(Ritapp_dataR†((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_app_dataès	
cCsRttƒ}|jt|jƒ|jt|jdƒ|jt|jddƒdS(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_argsóscCsRttƒ}|jt|jƒ|jt|jdƒ|jt|jddƒdS(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_argsþscCs&ttƒ}|jt|jdƒdS(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|jƒdƒdS(sµ
        L{Context.set_timeout} sets the session timeout for all connections
        created using the context object.  L{Context.get_timeout} retrieves this
        value.
        iÒN(R#RRtassertEqualsR‘(RiR†((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_timeouts
cCsRttƒ}|jt|jƒ|jt|jdƒ|jt|jddƒdS(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|jdƒdS(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|jƒdƒdS(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#RR•R“R—(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.
        i€twtblowfishtascii(
RRR	tmktemptopenRR
Rrtdecodetclose(Rit
passphraseR‚tpemFiletfObjtpem((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_write_encrypted_pem:s	
cCsXttƒ}|jt|jƒ|jt|jdƒ|jt|jd„ddƒdS(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csÇtdƒ‰|jˆƒ}g‰‡‡fd†}ttƒ}|j|ƒ|j|ƒ|jtˆƒdƒ|jtˆddt	ƒƒ|jtˆddt	ƒƒ|j
ˆdddƒdS(s
        L{Context.set_passwd_cb} accepts a callable which will be invoked when
        a private key is loaded from an encrypted PEM.
        tfoobarcsˆj|||fƒˆS(N(tappend(tmaxlentverifytextra(t
calledWithR¡(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytpassphraseCallback\siiiN(R)R¥R#RR§tuse_privatekey_filet
assertTruetlent
isinstancetinttassertEqualR…(RiR¢R¯R†((R®R¡s9/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 nicecSstdƒ‚dS(NsSorry, I am a fail.(tRuntimeError(R«R¬R­((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR¯nsN(R¥R)R#RR§RyR·R°(RiR¢R¯R†((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…(R«R¬R­((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR¯|sN(R¥R)R#RR§RyRR°(RiR¢R¯R†((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
((R«R¬R­((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR¯ŠsN(R¥R)R#RR§RyRR°(RiR¢R¯R†((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_passwd_callback_non_string„s
	
csXtdƒd‰|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 |dkst‚ˆtdƒS(NiRP(R[R)(R«R¬R­(R¡(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR¯šsN(R)R¥R#RR§R°(RiR¢R¯R†((R¡s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_passwd_callback_too_long’s
csøtƒ\}}tttƒ|ƒ}|jƒg‰‡fd†}ttƒ}|j|ƒ|jttt	ƒƒ|j
tttƒƒt||ƒ}|j
ƒxCˆsæx6||fD](}y|jƒWq·tk
rÞq·Xq·Wq¤W|jˆƒdS(sž
        L{Context.set_info_callback} accepts a callable which will be invoked
        when certain information about an SSL connection is available.
        csˆj|||fƒdS(N(Rª(RHtwheretret(tcalled(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytinfo°sN(R_R%R#RRhtset_info_callbackRfRR
R*ReRR+RgR`R!R±(RiR^R]t	clientSSLR¿R†t	serverSSLtssl((R¾s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_info_callback¥s(


	
c	GsÛtƒ\}}ttƒ}|j|Œ|jtd„ƒt||ƒ}|jƒttƒ}|jt	t
tƒƒ|jt
t
tƒƒt||ƒ}|jƒt||ƒ|jƒ}|j|jƒjdƒdS(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.pyR¦ÕssTesting Root CAN(R_R#Rtload_verify_locationst
set_verifyRR%RhRfRR
R*ReRR+RgRctget_peer_certificateRµtget_subjecttCN(	RitargsR^R]t
clientContextRÁt
serverContextRÂRI((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_load_verify_locations_testÇs$




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.
        RšRœN(RRžRrR*RŸR RÏ(RitcafileR£((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_verify_fileís

cCs,ttƒ}|jt|j|jƒƒdS(sm
        L{Context.load_verify_locations} raises L{Error} when passed a
        non-existent cafile.
        N(R#RRyRRÇR(RiRÍ((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_verify_invalid_fileúscCs|jƒ}t|ƒxRddgD]D}t||ƒ}t|dƒ}|jtjdƒƒ|jƒq#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.0RšRœN(
RRRRžRrR*RŸR RÏR…(RitcapathtnameRÐR£((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_verify_directorys
cCswttƒ}|jt|jƒ|jt|jtƒƒ|jt|jtƒtƒƒ|jt|jdddƒdS(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#RRyRzRÇRŠR…(RiR†((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt%test_load_verify_locations_wrong_argss
twin32cCs‰ttƒ}|jƒ|jtd„ƒtƒ}|jdƒt||ƒ}|jƒ|j	ƒ|j
dƒ|j|jdƒƒdS(s¥
            L{Context.set_default_verify_paths} causes the platform-specific CA
            certificate locations to be used for verification purposes.
            cSs|S(N((RHRIRÅRKRÆ((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR¦9ssverisign.comi»sGET / HTTP/1.0

iN(sverisign.comi»(
R#Rtset_default_verify_pathsRÈRRtconnectR%RhR`RYR±RZ(RiR†R]RÁ((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_default_verify_paths's

	



cCsRttƒ}|jt|jdƒ|jt|jdƒ|jt|jdƒdS(sv
        L{Context.set_default_verify_paths} takes no arguments and raises
        L{TypeError} if given any.
        iRNN(R#RRyRzRØR…(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|jtƒtƒƒdS(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cCsAttdƒttdƒƒ}tƒ}|jtdƒtƒ}d|jƒ_|j	|jƒƒ|j
|ƒ|jtdƒƒ|jtdƒƒ|j
|gƒ|jdƒ|j|dƒtƒ}|jtdƒtƒ}d	|jƒ_|j	|jƒƒ|j
|ƒ|jtdƒƒ|jtdƒƒ|j
|gƒ|jdƒ|j|dƒtƒ}|jtdƒtƒ}d
|jƒ_|j	|jƒƒ|j
|ƒ|jtdƒƒ|jtdƒƒ|j
ttdƒttdƒƒgƒ|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
RÊt
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	Cs•tƒ\}}t||ƒ}|jƒt||ƒ}|jƒxMtdƒD]?}x6||gD](}y|jƒWqatk
rˆqaXqaWqNWdS(s…
        Verify that a client and server created with the given contexts can
        successfully handshake and communicate.
        iN(R_R%RgRhtrangeR`R!(	RiRÎRÍt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ƒƒ|
jƒqOWxg|df|df|dfgD]D\}}	t|	dƒ}
|
jtt|ƒjdƒƒ|
jƒq¹Wtt	ƒ}|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.pemRšRœsca.keysi.keyss.keyN(RñRžRrRR
RŸR RR#RReRfRÜRÈRRRMRÇR÷(RitchainRëRìRíRîRïRðRIRÔR£R‚RÎRÍ((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_add_extra_chain_cert§s&!..



cCsN|jƒ}|\\}}\}}\}}|jƒ}t|dƒ}	|	jtt|ƒjdƒƒ|	jtt|ƒjdƒƒ|	jtt|ƒjdƒƒ|	jƒtt	ƒ}
|
j
|ƒ|
j|ƒtddƒ}	|	jtt|ƒjdƒƒ|	jƒtt	ƒ}|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.
        RšRœsca.pemN(RñRRžRrRR
RŸR R#Rtuse_certificate_chain_fileReRÈRRRMRÇR÷(RiRøRëRìRíRîRïRðt	chainFileR£RÎRÍ((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_use_certificate_chain_fileÓs&	!




cCs&ttƒ}|jt|jdƒdS(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_argsúscCsWttƒ}|j|jƒdƒ|jttBd„ƒ|j|jƒttBƒdS(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.pyR¦sN(R#RR“RýRÈRR(RiR†((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_verify_modescCsUttƒ}|jt|jƒ|jt|jddƒ|jt|jtƒƒdS(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_dhR…RŠ(RiR†((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_tmp_dh_wrong_argsscCs&ttƒ}|jt|jdƒdS(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.
        RšN(R#RRRžRrtdhparamR R(RiR†t
dhfilenametdhfile((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_load_tmp_dh$s

cCsEttƒ}|jdƒt|dƒ}|j|jƒdgƒdS(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%R…R“tget_cipher_list(RiR†RH((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_cipher_list2s
(+RuRvRwR}R€RƒR‡R‰RŒRŽRR’R”R–R˜R™R¥R¨R¶R¸R¹RºR»RÄRÏRÑRÒRÕRÖRRÚRÛRÝRñR÷RùRüRþRÿRRRR(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRx²sT					
																		"	&	
	
						5		,	'			
				tConnectionTestscBs¶eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
ed	krcn	d
„Zd„Z
d„Zd
„Zd„Zd„Zd„Zd„Zd„ZRS(s3
    Unit tests for L{OpenSSL.SSL.Connection}.
    cCs6|jttƒttƒ}|jtd|dƒdS(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.pyR€Ts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%R…R~tget_context(RiR†t
connection((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_context^scCs/tttƒdƒ}|jt|jdƒdS(se
        L{Connection.get_context} raises L{TypeError} if called with any
        arguments.
        N(R%R#RR…RyRzR
(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_get_context_wrong_argshscCs/tttƒdƒ}|j|jƒdƒdS(si
        L{Connection.pending} returns the number of bytes available for
        immediate read.
        iN(R%R#RR…R“tpending(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_pendingqscCs/tttƒdƒ}|jt|jdƒdS(sY
        L{Connection.pending} raises L{TypeError} if called with any arguments.
        N(R%R#RR…RyRzR(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_pending_wrong_argszscCs^tttƒtƒƒ}|jt|jdƒ|jt|jƒ|jt|jddƒdS(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#RRRyRzRÙR…(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_connect_wrong_args‚scCsWtƒ}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%RyRRÙR“RÌR(RiR]R†RÁtexc((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_connect_refuseds
	cCs\tƒ}|jdƒ|jdƒtttƒtƒƒ}|jd|jƒdfƒdS(sZ
        L{Connection.connect} establishes a connection to the specified address.
        RNiis	127.0.0.1iN(RNi(RRQRRR%R#RRÙRV(RiR\RÁ((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_connect™s
	

tdarwincCstƒ}|jdƒ|jdƒtttƒtƒƒ}|jtƒ|j|j	ƒƒ}t
tf}|j||kd||fƒdS(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\RÁtresulttexpected((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_connect_ex©s	


cCs2tttƒtƒƒ}|jt|jdƒdS(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_argsºscCs÷ttƒ}|jtttƒƒ|jtttƒƒt	ƒ}t
||ƒ}|jdƒ|jdƒt
ttƒt	ƒƒ}|j
d|jƒdfƒ|jƒ\}}|jt|t
ƒƒ|j|jƒ|ƒ|j||jƒƒdS(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%RQRRRÙRVRXR±R³R~R
R“(RiRjR\tportSSLRÁRÂtaddress((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_acceptÂs	

cCs‡tttƒdƒ}|jt|jdƒ|jt|jdƒ|jt|jƒ|jt|jdƒ|jt|jddƒdS(s˜
        L{Connection.shutdown} raises L{TypeError} if called with the wrong
        number of arguments or with arguments other than integers.
        iiN(	R%R#RR…RyRztshutdowntget_shutdowntset_shutdown(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_shutdown_wrong_argsÝscCs¿|jƒ\}}|j|jƒƒ|j|jƒtƒ|jt|jdƒ|j|jƒt	ƒ|jƒ|j|jƒtt	Bƒ|jt|jdƒ|j|jƒtt	BƒdS(sS
        L{Connection.shutdown} performs an SSL-level connection shutdown.
        iN(
RktassertFalseR R“R!RRyR"RZR(RiR^R]((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_shutdownês
cCs?tttƒtƒƒ}|jtƒ|j|jƒtƒdS(sk
        L{Connection.set_shutdown} sets the state of the SSL connection shutdown
        process.
        N(R%R#RRR"RR“R!(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_shutdownùs
cCs[tttƒdƒ}|jt|jdƒ|jt|jƒ|jt|jddƒdS(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#RR…RyRzRˆR„(RiRH((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_app_data_wrong_argsscCsEtttƒdƒ}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#RR…RŠR„R~Rˆ(RiRHR‹((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRŒs	
cCs,tttƒdƒ}|jt|jƒdS(sz
        L{Connection.makefile} is not implemented and calling that method raises
        L{NotImplementedError}.
        N(R%R#RR…RytNotImplementedErrortmakefile(RiRH((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_makefiles(RuRvRwR€RRRRRRRRRRRR#R%R&R'RŒR*(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR>s(	
	
								
				
		
		tConnectionGetCipherListTestscBs eZdZd„Zd„ZRS(s2
    Tests for L{Connection.get_cipher_list}.
    cCs/tttƒdƒ}|jt|jdƒdS(si
        L{Connection.get_cipher_list} raises L{TypeError} if called with any
        arguments.
        N(R%R#RR…RyRzR
(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_wrong_args)scCsbtttƒdƒ}|jƒ}|jt|tƒƒx$|D]}|jt|tƒƒq>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#RR…R
R±R³tlisttstr(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		tConnectionSendTestscBsEeZdZd„Zd„ZyeWnek
r9n
Xd„ZRS(s&
    Tests for L{Connection.send}
    cCs^tttƒdƒ}|jt|jƒ|jt|jtƒƒ|jt|jddƒdS(sx
        When called with arguments other than a single string,
        L{Connection.send} raises L{TypeError}.
        RtbarN(R%R#RR…RyRzRYRŠ(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR,CscCsZ|jƒ\}}|jtdƒƒ}|j|dƒ|j|jdƒtdƒƒdS(s‡
        When passed a short byte string, L{Connection.send} transmits all of it
        and returns the number of bytes sent.
        txyiN(RkRYR)R“RZ(RiR^R]tcount((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_short_bytesNscCs`|jƒ\}}|jttdƒƒƒ}|j|dƒ|j|jdƒtdƒƒdS(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)R“RZ(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		

tConnectionSendallTestscBsWeZdZd„Zd„ZyeWnek
r9n
Xd„Zd„Zd„Z	RS(s*
    Tests for L{Connection.sendall}.
    cCs^tttƒdƒ}|jt|jƒ|jt|jtƒƒ|jt|jddƒdS(s{
        When called with arguments other than a single string,
        L{Connection.sendall} raises L{TypeError}.
        RR3N(R%R#RR…RyRztsendallRŠ(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR,nscCsH|jƒ\}}|jtdƒƒ|j|jdƒtdƒƒdS(sf
        L{Connection.sendall} transmits all of the bytes in the string passed to
        it.
        ROiN(RkR;R)R“RZ(RiR^R]((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_shortyscCsN|jƒ\}}|jttdƒƒƒ|j|jdƒtdƒƒdS(s‰
            When passed a memoryview onto a small number of bytes,
            L{Connection.sendall} transmits all of them.
            ROiN(RkR;R7R)R“RZ(RiR^R]((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR8ˆscCs­|jƒ\}}tdƒd
tdƒ}|j|ƒg}d}xB|t|ƒkr‰|jdƒ}|j|ƒ|t|ƒ7}qHW|j|tdƒj|ƒƒ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 iRPiRNNi€iÿ(RkR)R;R²RZRªR“R(RiR^R]tmessagetaccumtreceivedtdata((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt	test_long’s

cCs9|jƒ\}}|jdƒ|jt|jdƒdS(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_closed¦s
(
RuRvRwR,R<R7R9R8RARC(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR:js		

	
	tConnectionRenegotiateTestscBs)eZdZd„Zd„Zd„ZRS(s+
    Tests for SSL renegotiation APIs.
    cCs/tttƒdƒ}|jt|jdƒdS(se
        L{Connection.renegotiate} raises L{TypeError} if called with any
        arguments.
        N(R%R#RR…RyRztrenegotiate(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_renegotiate_wrong_argsµscCs/tttƒdƒ}|jt|jdƒdS(sn
        L{Connection.total_renegotiations} raises L{TypeError} if called with
        any arguments.
        N(R%R#RR…RyRzttotal_renegotiations(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt$test_total_renegotiations_wrong_args¾scCs/tttƒdƒ}|j|jƒdƒdS(sr
        L{Connection.total_renegotiations} returns C{0} before any
        renegotiations have happened.
        iN(R%R#RR…R“RG(RiR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_total_renegotiationsÇs(RuRvRwRFRHRI(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRD±s				t
ErrorTestscBseZdZd„ZRS(s.
    Unit tests for L{OpenSSL.SSL.Error}.
    cCs-|jtttƒƒ|jtjdƒdS(s0
        L{Error} is an exception type.
        RN(R±t
issubclassRt	ExceptionRµRu(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR€ês(RuRvRwR€(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRJæstConstantsTestscBsVeZdZedk	r$d„Znedk	r<d„Znedk	rTd„Z	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|jtdƒdS(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(RµR1(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_op_no_query_mtuýscCs|jtdƒdS(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(RµR2(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_op_cookie_exchangescCs|jtdƒdS(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(RµR3(Ri((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_op_no_ticketsN(
RuRvRwR1R…RNR2ROR3RP(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRMós

tMemoryBIOTestscBs¹eZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(sA
    Tests for L{OpenSSL.SSL.Connection} using a memory BIO.
    cCs®ttƒ}|jttBtBƒ|jttBt	Bt
ƒ|jƒ}|jt
ttƒƒ|jtttƒƒ|jƒ|jtttƒƒt||ƒ}|jƒ|S(sc
        Create a new server-side SSL L{Connection} object wrapped around
        C{sock}.
        (R#RRRRRRÈRRRRMtget_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

cCs®ttƒ}|jttBtBƒ|jttBt	Bt
ƒ|jƒ}|jt
ttƒƒ|jtttƒƒ|jƒ|jtttƒƒt||ƒ}|jƒ|S(sc
        Create a new client-side SSL L{Connection} object wrapped around
        C{sock}.
        (R#RRRRRRÈRRRRMRRReRR
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|jƒdƒ|j|jƒdƒ|j|jƒdƒ|j|j||ƒdƒ|j|jƒdƒ|j|jƒdƒ|j|jƒdƒ|j	|jƒ|jƒƒ|j	|jƒ|jƒƒ|j
|jƒ|jƒƒ|j
|jƒ|jƒƒtdƒ}|j|ƒ|j	|j||ƒ||fƒ|j|ddd…ƒ|j	|j||ƒ||ddd…fƒdS(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ÿÿÿÿ(
RXR…R[R~t
master_keyt
client_randomt
server_randomRttassertNotIdenticalR“tassertNotEqualsR)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|jƒdS(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(RiR†R]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€(	RXR…R[RtRYR±R~R“R²(RiR^R]tsizetsenttreceiverR?((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_outgoingOverflowscCsH|jdƒ}|jƒ|jt|jdƒ}|j|jtƒdS(s{
        L{Connection.bio_shutdown} signals the end of the data stream from
        which the L{Connection} reads.
        iN(RXR…ReRyRRZR“t	__class__(RiR^te((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR%¸s
cCsÎ|jdƒ}|jdƒ}|j|jƒgƒ|j|jƒgƒ|jƒ}||ƒ}|j|jƒgƒ|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(RXR…R[Rµtget_client_ca_listR
Rt(RitfuncR^R]RjR((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt_check_client_ca_listÅscCsXttƒ}|jt|jdƒ|jt|jdgƒ|j|jgƒdƒdS(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_errorsÝs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|jgƒgS(N(Rq(Rj((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytno_caïs
N(Ro(RiRs((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_empty_ca_listès	cs;tttƒ}|jƒ‰‡fd†}|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|jˆgƒˆgS(N(Rq(Rj(tcadesc(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt	single_caÿsN(RR
R0RÊRo(RiRìRv((Rus9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_one_ca_listõscsYtttƒ}tttƒ}|jƒ‰|jƒ‰‡‡fd†}|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.
        csˆˆg}|j|ƒ|S(N(Rq(RjtL(tcldesctsedesc(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytmultiple_cas
N(RR
R.RÊRo(RitsecerttclcertR{((RzRys9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_multiple_ca_listscswtttƒ}tttƒ}tttƒ}|jƒ‰|jƒ‰|jƒ‰‡‡‡fd†}|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*|jˆˆgƒ|jˆgƒˆgS(N(Rq(Rj(RyRzRu(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
changed_ca(sN(RR
R0R.RÊRo(RiRìR|R}R((RuRzRys9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_reset_ca_listscsYtttƒ}tttƒ}|jƒ‰|jƒ‰‡‡fd†}|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}|jˆgƒ|jˆƒˆgS(N(RqRª(RjRx(RzRu(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
mutated_ca;s	
N(RR
R0R.RÊRo(RiRìR|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>tttƒ‰ˆjƒ‰‡‡fd†}|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|jˆƒˆgS(N(Rƒ(Rj(RìRu(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRvVs
N(RR
R0RÊRo(RiRv((RuRìs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_one_add_client_caOscs_tttƒ‰tttƒ‰ˆjƒ‰ˆjƒ‰‡‡‡‡fd†}|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ˆƒ|jˆƒˆˆgS(N(Rƒ(Rj(RìR|RuRz(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR{gs

N(RR
R0R.RÊRo(RiR{((RzR|RuRìs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_multiple_add_client_ca\scsztttƒ}tttƒ}tttƒ‰|jƒ‰|jƒ‰ˆjƒ‰‡‡‡‡fd†}|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-|jˆˆgƒ|jˆƒˆˆˆgS(N(RqRƒ(Rj(RyRzRuR}(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytmixed_set_add_ca|s
N(RR
R0R.RÊRo(RiRìR|R‡((R}RuRzRys9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_and_add_client_canscsntttƒ}tttƒ‰tttƒ‰|jƒ‰ˆjƒ‰‡‡‡‡fd†}|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ˆƒ|jˆgƒ|jˆƒˆˆgS(N(RƒRq(Rj(R}R|RuRz(s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pytset_replaces_add_cas

N(RR
R0R.RÊRo(RiRìR‰((R}R|RuRzs9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyttest_set_after_add_client_caƒs(RuRvRwRXR[RbRdRfRjR%RoRrRtRwR~R€R‚R„R…R†RˆRŠ(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyRQs(			,		
		
			
						
		tInfoConstantTestscBseZdZd„ZRS(sI
    Tests for assorted constants exposed for use in info callbacks.
    cCsgx`tttttttttt	t
ttt
ttttttgD]}|jt|tƒƒqCWdS(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@RARBRCRDRERFRGR±R³R´(Ritconst((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt
test_integersœs			(RuRvRwR(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyR‹˜st__main__N(dRwRÅRRRtsysRRRtosRtos.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/R0R1tImportErrorR…R2R3R4R5R6R7R8R9R:R;R<R=R>R?R@RARBRCRDRERFRGRRMR_RcRdRxRR+R2R:RDRJRMRQR‹Ru(((s9/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.pyt<module>sj"""





‚			GÿÿŽç+G5
+ÿ{

Youez - 2016 - github.com/yon3zu
LinuXploit