• File: ssl_context_util.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/lib/python2.7/site-packages/ndg/httpsclient/ssl_context_util.pyc
  • Date Modified: 10/31/2014 10:04 AM
  • File size: 3.4 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

aVOc@sdZdZdZdZdZdZdZddlZdd	lm	Z	dd
l
mZdefdYZ
edd
Zddddede	jdZedZdS(sundg_httpsclient SSL Context utilities module containing convenience routines
for setting SSL context configuration.

sP J Kershaw (STFC)s09/12/11s2(C) 2012 Science and Technology Facilities Councils-BSD - see LICENSE file in top-level directorysPhilip.Kershaw@stfc.ac.uks$Id$iN(tSSL(tServerSSLCertVerificationtSSlContextConfigcBs&eZdZddddedZRS(s
    Holds configuration options for creating a SSL context. This is used as a
    template to create the contexts with specific verification callbacks.
    cCs1||_||_||_||_||_dS(N(tkey_filet	cert_filetpem_filetca_dirtverify_peer(tselfRRRRR((sD/usr/lib/python2.7/site-packages/ndg/httpsclient/ssl_context_util.pyt__init__s
				N(t__name__t
__module__t__doc__tNonetFalseR	(((sD/usr/lib/python2.7/site-packages/ndg/httpsclient/ssl_context_util.pyRscCs(t|j|j|j|j|j|S(N(tmake_ssl_contextRRRRR(t
ssl_configturl((sD/usr/lib/python2.7/site-packages/ndg/httpsclient/ssl_context_util.pytmake_ssl_context_from_config sc
Cstj|}|r%|j|n|r;|j|n|rQ|j|n|s]|rp|j||nd}|}	|r|jd|rt||q|jtj|	n|jtj	|	|S(sL
    Creates SSL context containing certificate and key file locations.
    cSs|S(srDefault certification verification callback.
        Performs no checks and returns the status passed in.
        ((tconntx509terrnumterrdepthtpreverify_ok((sD/usr/lib/python2.7/site-packages/ndg/httpsclient/ssl_context_util.pyt	_callback9si	(
RtContexttuse_certificate_filetuse_privatekey_filetload_verify_locationstset_verify_deptht&set_peer_verification_for_url_hostnamet
set_verifytVERIFY_PEERtVERIFY_NONE(
RRRRRRtmethodtssl_contextRtverify_callback((sD/usr/lib/python2.7/site-packages/ndg/httpsclient/ssl_context_util.pyR&s$	
cCs[|s|jtj@rWtj|}|j}td|}|jtj|ndS(sbConvenience routine to set peer verification callback based on
    ServerSSLCertVerification classthostnameN(tget_verify_modeRR turlparseR%RR(R#Rtif_verify_enabledturlObjR%R$((sD/usr/lib/python2.7/site-packages/ndg/httpsclient/ssl_context_util.pyRLs
	(Rt
__author__t__date__t
__copyright__t__license__t__contact__t__revision__R'tOpenSSLRt%ndg.httpsclient.ssl_peer_verificationRtobjectRRR
Rt
SSLv23_METHODRR(((sD/usr/lib/python2.7/site-packages/ndg/httpsclient/ssl_context_util.pyt<module>s&