/usr/lib/python2.6/site-packages/ndg/httpsclient
NameSizeModeActions
test/-0755rm
https.py48340644editdlrm
https.pyc50620644editdlrm
ssl_context_util.py34580644editdlrm
ssl_context_util.pyc40410644editdlrm
ssl_peer_verification.py96610644editdlrm
ssl_peer_verification.pyc91640644editdlrm
ssl_socket.py93440644editdlrm
ssl_socket.pyc123320644editdlrm
subj_alt_name.py61310644editdlrm
subj_alt_name.pyc68580644editdlrm
urllib2_build_opener.py26890644editdlrm
urllib2_build_opener.pyc26280644editdlrm
utils.py157360644editdlrm
utils.pyc132160644editdlrm
__init__.py3900644editdlrm
__init__.pyc6250644editdlrm
Edit: /usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyc (9164B)
Ńņ ˜KVc @sŅdZdZdZdZdZdZdZddkZddkZei e ƒZ y*dd k l Z dd klZeZWn:ej o.ZeZd ZddkZeieƒnXd efd „ƒYZdS(sAndg_httpsclient - module containing SSL peer verification class. 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$i’’’’N(tSubjectAltName(tdecodersPSubjectAltName support is disabled - check pyasn1 package installation to enabletServerSSLCertVerificationcBs1eZdZh dd6dd6dd6dd6d d 6d d 6d d6dd6dd6dd6ZdZddieeiƒƒeeiƒƒƒZ e i e ƒZ d(Z d)d)ed„Zd„Zd„Zed„ƒZd„Zd „Zed!ed"ed#d$ƒZd%„Zd&„Zed!ed"ed#d'ƒZRS(*syCheck server identity. If hostname doesn't match, allow match of host's Distinguished Name against server DN settingtCNt commonNametOUtorganisationalUnitNametOt organisationtCt countryNamet EMAILADDRESSt emailAddresstLt localityNametSTtstateOrProvinceNametSTREETt streetAddresstDCtdomainComponenttUIDtuseridtsubjectAltNames/(%s)=t|t __hostnamet__certDNt__subj_alt_name_matchcCs•d|_d|_|dj o ||_n|dj o ||_n|o.tptidƒt|_ q‘t |_ nti dƒt|_ dS(s¼Override parent class __init__ to enable setting of certDN setting @type certDN: string @param certDN: Set the expected Distinguished Name of the server to avoid errors matching hostnames. This is useful where the hostname is not fully qualified @type hostname: string @param hostname: hostname to match against peer certificate subjectAltNames or subject common name @type subj_alt_name_match: bool @param subj_alt_name_match: flag to enable/disable matching of hostname against peer certificate subjectAltNames. Nb. A setting of True will be ignored if the pyasn1 package is not installed sdOverriding "subj_alt_name_match" keyword setting: peer verification with subjectAltNames is disableds9Disabling peer verification with subject subjectAltNames!N( tNonet"_ServerSSLCertVerification__certDNt$_ServerSSLCertVerification__hostnametcertDNthostnametSUBJ_ALT_NAME_SUPPORTtlogtwarningtFalset/_ServerSSLCertVerification__subj_alt_name_matchtTruetdebug(tselfRR tsubj_alt_name_match((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyt__init__1s          c Cs/|iƒotid|iƒƒtS|djoņ|iƒ}|iƒ}|iƒ|idjo|i djotidƒtS|i o(|i |ƒ}|i |jo|Sn|i |i jo|Stid|i |i ƒtSq+||ijo|Stid||iƒtSn|SdS(s Verify server certificate @type connection: OpenSSL.SSL.Connection @param connection: SSL connection object @type peerCert: basestring @param peerCert: server host certificate as OpenSSL.crypto.X509 instance @type errorStatus: int @param errorStatus: error status passed from caller. This is the value returned by the OpenSSL C function X509_STORE_CTX_get_error(). Look-up x509_vfy.h in the OpenSSL source to get the meanings of the different codes. PyOpenSSL doesn't help you! @type errorDepth: int @param errorDepth: a non-negative integer representing where in the certificate chain the error occurred. If it is zero it occured in the end entity certificate, one if it is the certificate which signed the end entity certificate and so on. @type preverifyOK: int @param preverifyOK: the error status - 0 = Error, 1 = OK of the current SSL context irrespective of any verification checks done here. If this function yields an OK status, it should enforce the preverifyOK value so that any error set upstream overrides and is honoured. @rtype: int @return: status code - 0/False = Error, 1/True = OK s4Certificate %r in peer certificate chain has expiredis?No "hostname" or "certDN" set to check peer certificate againsts7Peer certificate CN %r doesn't match the expected CN %rs7Peer certificate DN %r doesn't match the expected DN %rN( t has_expiredR"terrort get_subjectR$tget_componentstsortRRR R%t_get_subj_alt_nameR( R(t connectiontpeerCertt errorStatust errorDeptht preverifyOKt peerCertSubjt peerCertDNt dns_names((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyt__call__Vs8              cs‡fd†}|S(Ncsˆi|||||ƒS(N(R9(R1R2R3R4R5(R((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pytverify_server_cert s((R(R:((R(sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pytget_verify_server_cert_funcŸsc Csźg}tƒ}xŌt|iƒƒD]Ą}|i|ƒ}|iƒ}||ijo|iƒ}ti|d|ƒ}xk|D]_} t | tƒoIxFtt | ƒƒD].} | i | ƒ} |i t | iƒƒƒq¤Wq{q{Wq"q"W|S(sExtract subjectAltName DNS name settings from certificate extensions @param peer_cert: peer certificate in SSL connection. subjectAltName settings if any will be extracted from this @type peer_cert: OpenSSL.crypto.X509 tasn1Spec(Rtrangetget_extension_countt get_extensiontget_short_nametSUBJ_ALT_NAME_EXT_NAMEtget_datat der_decodertdecodet isinstancetlentgetComponentByPositiontappendtstrt getComponent( tclst peer_certtdns_namet general_namestitexttext_nametext_datt decoded_dattnametentryt component((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyR0§s$      -cCs|iS(N(R(R(((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyt _getCertDNĆscCs’t|tƒoŽ|idƒ}|iii|ƒ}t|ƒdjotd|ƒ‚ntt |ddd…|ddd…ƒƒ|_ |i i ƒn^t|tƒpAx1|D])}t|ƒdjptdƒ‚qµqµW||_ n tdƒ‚dS(Nt"isError parsing DN string: "%s"isSExpecting list of two element DN field, DN field value pairs for "certDN" attributes4Expecting list or string type for "certDN" attribute( RERItstript __class__t PARSER_REtsplitRFt TypeErrortlisttzipRR/(R(tvalRtdnFieldsRO((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyt _setCertDNĘs2 tfgettfsettdocs)Distinguished Name for Server CertificatecCs|iS(N(R(R(((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyt _getHostnameāscCs-t|tƒptdƒ‚n||_dS(Ns,Expecting string type for hostname attribute(RERIR]R(R(R`((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyt _setHostnameåsshostname of server(s __hostnames__certDNs__subj_alt_name_matchN(t__name__t __module__t__doc__tDN_LUTRAtjoinR^tkeystvaluest PARSER_RE_STRtretcompileR[t __slots__RR&R*R9R;t classmethodR0RWRbtpropertyRRfRgR (((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyRs< /% I        (Rjt __author__t__date__t __copyright__t __license__t __contact__t __revision__Rptloggingt getLoggerRhR"tndg.httpsclient.subj_alt_nameRtpyasn1.codec.derRRCR&R!t ImportErrorteR$tSUBJ_ALT_NAME_SUPPORT_MSGtwarningstwarntobjectR(((sI/usr/lib/python2.6/site-packages/ndg/httpsclient/ssl_peer_verification.pyts&