ok

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/M2Crypto/SSL/
Upload File :
Current File : //usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyo

�
z\Vc@s�dZddgZddlmZddlZddlmZmZmZm	Z	m
Z
mZddd��YZd	�Z
ddd
��YZdS(
sISSL Context

Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved.tmaptContexti����(tWeakValueDictionaryN(tutiltBIOtErrtRSAtm2tX509t_ctxmapcBs2eZdZd�Zd�Zd�Zd�ZRS(cCst�|_dS(N(RR(tself((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt__init__scCs|j|S(N(R(R
tkey((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt__getitem__scCs||j|<dS(N(R(R
Rtvalue((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt__setitem__scCs|j|=dS(N(R(R
R((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt__delitem__sN(t__name__t
__module__tNonet	singletonRR
RR(((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyR	
s
			cCs%tjdkrt�t_ntjS(N(R	RR(((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyRscBsJeZdZejZdddd�Zd�Zd�Z	de
jd�Zde
jd�Z
d�ZeZZddd�ZeZd	�Zd
�Zd�Zdd�Zd
�Zd�Zd�Zdd�Zd�Zdd�Zejd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(RS(s'Context' for SSL connections.tsslv23cCs�tt|dd�}|dkr2td|�ntj|��|_d|_||_|t�t	|j�<tj
|jd�|dkr�|dkr�|jtjtj
B�n|jd�ndS(Nt_methodsno such protocol '%s'il�Rs!ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH(tgetattrRRt
ValueErrortssl_ctx_newtctxtallow_unknown_catpost_connection_checkRtlongtssl_ctx_set_cache_sizetset_optionst
SSL_OP_ALLtSSL_OP_NO_SSLv2tset_cipher_list(R
tprotocoltweak_cryptoRtproto((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyR's		cCs)t|dd�r%|j|j�ndS(NR(RRtm2_ssl_ctx_freeR(R
((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt__del__6scCst�t|j�=dS(N(RRR(R
((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytclose:scCsjtj|j|�tj|j|�|s5|}ntj|j|�tj|j�sftd�ndS(swLoad certificate and private key into the context.
        
        @param certfile: File that contains the PEM-encoded certificate.
        @type certfile:  str
        @param keyfile:  File that contains the PEM-encoded private key.
                         Default value of None indicates that the private key
                         is to be found in 'certfile'.
        @type keyfile:   str

        @param callback: Callable object to be invoked if the private key is
                         passphrase-protected. Default callback provides a
                         simple terminal-style input for the passphrase.
        spublic/private key mismatchN(Rtssl_ctx_passphrase_callbackRtssl_ctx_use_certtssl_ctx_use_privkeytssl_ctx_check_privkeyR(R
tcertfiletkeyfiletcallback((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt	load_cert=s	cCsjtj|j|�tj|j|�|s5|}ntj|j|�tj|j�sftd�ndS(s�Load certificate chain and private key into the context.
        
        @param certchainfile: File object containing the PEM-encoded
                              certificate chain.
        @type  certchainfile: str
        @param keyfile:       File object containing the PEM-encoded private
                              key. Default value of None indicates that the
                              private key is to be found in 'certchainfile'.
        @type keyfile:        str  

        @param callback:      Callable object to be invoked if the private key
                              is passphrase-protected. Default callback 
                              provides a simple terminal-style input for the
                              passphrase.
        spublic/private key mismatchN(RR)Rtssl_ctx_use_cert_chainR+R,R(R
t
certchainfileR.R/((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytload_cert_chainSs	cCstj|j|�dS(s Load CA certs into the context. These CA certs are sent to the
        peer during *SSLv3 certificate request*.
        
        @param cafile: File object containing one or more PEM-encoded CA
                       certificates concatenated together.
        @type cafile:  str
        N(Rt$ssl_ctx_set_client_CA_list_from_fileR(R
tcafile((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_client_CA_list_from_filekscCs=|dkr'|dkr'td��ntj|j||�S(s�Load CA certs into the context. These CA certs are used during
        verification of the peer's certificate.

        @param cafile: File containing one or more PEM-encoded CA certificates
                       concatenated together.
        @type cafile:  str
        @param capath: Directory containing PEM-encoded CA certificates
                       (one certificate per file).
        @type capath:  str
        s'cafile and capath can not both be None.N(RRRtssl_ctx_load_verify_locationsR(R
R5tcapath((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytload_verify_locationsxscCs:tj|j|�}|s6tjtj�d��ndS(Nt(Rtssl_ctx_set_session_id_contextRRtSSLErrortget_error_code(R
tidtret((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_session_id_ctx�scCs
||_dS(s�Set the context to accept/reject a peer certificate if the 
        certificate's CA is unknown.

        @param ok:       True to accept, False to reject.
        @type ok:        boolean
        N(R(R
tok((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_allow_unknown_ca�scCs|jS(svGet the context's setting that accepts/rejects a peer
        certificate if the certificate's CA is unknown.
        (R(R
((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytget_allow_unknown_ca�scCsO|dkr"tj|j|�ntj|j||�tj|j|�dS(s�
        Set verify options. Most applications will need to call this
        method with the right options to make a secure SSL connection.
        
        @param mode:     The verification mode to use. Typically at least
                         SSL.verify_peer is used. Clients would also typically
                         add SSL.verify_fail_if_no_peer_cert.
        @type mode:      int                 
        @param depth:    The maximum allowed depth of the certificate chain
                         returned by the peer.
        @type depth:     int
        @param callback: Callable that can be used to specify custom
                         verification checks.
        N(RRtssl_ctx_set_verify_defaultRtssl_ctx_set_verifytssl_ctx_set_verify_depth(R
tmodetdepthR/((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt
set_verify�scCstj|j�S(N(Rtssl_ctx_get_verify_modeR(R
((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytget_verify_mode�scCstj|j�S(N(Rtssl_ctx_get_verify_depthR(R
((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytget_verify_depth�scCs7tj|�}tj|j��}tj|j|�S(s�Load ephemeral DH parameters into the context.

        @param dhpfile: File object containing the PEM-encoded DH 
                        parameters.
        @type dhpfile:  str
        (RtopenfileRtdh_read_parameterstbio_ptrtssl_ctx_set_tmp_dhR(R
tdhpfiletftdhp((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt
set_tmp_dh�scCs&|dk	r"tj|j|�ndS(N(RRtssl_ctx_set_tmp_dh_callbackR(R
R/((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_tmp_dh_callback�scCs<t|tj�r(tj|j|j�Std|f�dS(saLoad ephemeral RSA key into the context.

        @param rsa: M2Crypto.RSA.RSA instance.
        s(Expected an instance of RSA.RSA, got %s.N(t
isinstanceRRtssl_ctx_set_tmp_rsaRtrsat	TypeError(R
RZ((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_tmp_rsa�scCs&|dk	r"tj|j|�ndS(N(RRtssl_ctx_set_tmp_rsa_callbackR(R
R/((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_tmp_rsa_callback�scCstj|j|�dS(s
        Set a callback function that can be used to get state information
        about the SSL connections that are created from this context.
        
        @param callback: Callback function. The default prints information to
                         stderr.
        N(Rtssl_ctx_set_info_callbackR(R
R/((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_info_callback�scCstj|j|�S(N(Rtssl_ctx_set_cipher_listR(R
tcipher_list((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyR"�scCstj|j|j��S(N(Rtssl_ctx_add_sessionRt_ptr(R
tsession((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytadd_session�scCstj|j|j��S(N(Rtssl_ctx_remove_sessionRRd(R
Re((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytremove_session�scCstj|j�S(N(Rtssl_ctx_get_session_timeoutR(R
((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytget_session_timeout�scCstj|j|�S(N(Rtssl_ctx_set_session_timeoutR(R
ttimeout((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_session_timeout�scCstj|j|�S(N(Rtssl_ctx_set_session_cache_modeR(R
RG((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytset_session_cache_mode�scCstj|j�S(N(Rtssl_ctx_get_session_cache_modeR(R
((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytget_session_cache_mode�scCstj|j|�S(N(Rtssl_ctx_set_optionsR(R
top((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyR�scCstjtj|j��S(s�
        Get the certificate store associated with this context.
        
        @warning: The store is NOT refcounted, and as such can not be relied
        to be valid once the context goes away or is changed.
        (Rt
X509_StoreRtssl_ctx_get_cert_storeR(R
((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pytget_cert_store�sN()RRt__doc__Rtssl_ctx_freeR&RRR'R(Rtpassphrase_callbackR0R3R6tload_client_CAtload_client_caR9tload_verify_infoR@RBRCRIRKRMRURWR\R^tcbtssl_info_callbackR`R"RfRhRjRmRoRqRRv(((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyR!s@				
								

								(((Rwt__all__tweakrefRR}tM2CryptoRRRRRRR	RR(((s:/usr/lib64/python2.7/site-packages/M2Crypto/SSL/Context.pyt<module>s.	

Zerion Mini Shell 1.0