/opt/alt/python34/lib64/python3.4/__pycache__
NameSizeModeActions
abc.cpython-34.pyc78770644editdlrm
abc.cpython-34.pyo78270644editdlrm
aifc.cpython-34.pyc279120644editdlrm
aifc.cpython-34.pyo279120644editdlrm
antigravity.cpython-34.pyc8470644editdlrm
antigravity.cpython-34.pyo8470644editdlrm
argparse.cpython-34.pyc658740644editdlrm
argparse.cpython-34.pyo657150644editdlrm
ast.cpython-34.pyc123600644editdlrm
ast.cpython-34.pyo123600644editdlrm
asynchat.cpython-34.pyc83590644editdlrm
asynchat.cpython-34.pyo83590644editdlrm
asyncore.cpython-34.pyc179630644editdlrm
asyncore.cpython-34.pyo179630644editdlrm
base64.cpython-34.pyc182970644editdlrm
base64.cpython-34.pyo180990644editdlrm
bdb.cpython-34.pyc186940644editdlrm
bdb.cpython-34.pyo186940644editdlrm
binhex.cpython-34.pyc135410644editdlrm
binhex.cpython-34.pyo135410644editdlrm
bisect.cpython-34.pyc28580644editdlrm
bisect.cpython-34.pyo28580644editdlrm
bz2.cpython-34.pyc151560644editdlrm
bz2.cpython-34.pyo151560644editdlrm
calendar.cpython-34.pyc275670644editdlrm
calendar.cpython-34.pyo275670644editdlrm
cgi.cpython-34.pyc298270644editdlrm
cgi.cpython-34.pyo298270644editdlrm
cgitb.cpython-34.pyc110640644editdlrm
cgitb.cpython-34.pyo110640644editdlrm
chunk.cpython-34.pyc52700644editdlrm
chunk.cpython-34.pyo52700644editdlrm
cmd.cpython-34.pyc134560644editdlrm
cmd.cpython-34.pyo134560644editdlrm
code.cpython-34.pyc97020644editdlrm
code.cpython-34.pyo97020644editdlrm
codecs.cpython-34.pyc351320644editdlrm
codecs.cpython-34.pyo351320644editdlrm
codeop.cpython-34.pyc64660644editdlrm
codeop.cpython-34.pyo64660644editdlrm
colorsys.cpython-34.pyc36590644editdlrm
colorsys.cpython-34.pyo36590644editdlrm
compileall.cpython-34.pyc73780644editdlrm
compileall.cpython-34.pyo73780644editdlrm
configparser.cpython-34.pyc448820644editdlrm
configparser.cpython-34.pyo448820644editdlrm
contextlib.cpython-34.pyc103700644editdlrm
contextlib.cpython-34.pyo103700644editdlrm
copy.cpython-34.pyc80610644editdlrm
copy.cpython-34.pyo79750644editdlrm
copyreg.cpython-34.pyc46070644editdlrm
copyreg.cpython-34.pyo45660644editdlrm
cProfile.cpython-34.pyc46220644editdlrm
cProfile.cpython-34.pyo46220644editdlrm
crypt.cpython-34.pyc24370644editdlrm
crypt.cpython-34.pyo24370644editdlrm
csv.cpython-34.pyc129970644editdlrm
csv.cpython-34.pyo129970644editdlrm
datetime.cpython-34.pyc562640644editdlrm
datetime.cpython-34.pyo542960644editdlrm
decimal.cpython-34.pyc1725260644editdlrm
decimal.cpython-34.pyo1725260644editdlrm
difflib.cpython-34.pyc605150644editdlrm
difflib.cpython-34.pyo604670644editdlrm
dis.cpython-34.pyc145870644editdlrm
dis.cpython-34.pyo145870644editdlrm
doctest.cpython-34.pyc801100644editdlrm
doctest.cpython-34.pyo798370644editdlrm
dummy_threading.cpython-34.pyc12140644editdlrm
dummy_threading.cpython-34.pyo12140644editdlrm
enum.cpython-34.pyc163390644editdlrm
enum.cpython-34.pyo163390644editdlrm
filecmp.cpython-34.pyc91200644editdlrm
filecmp.cpython-34.pyo91200644editdlrm
fileinput.cpython-34.pyc142970644editdlrm
fileinput.cpython-34.pyo142970644editdlrm
fnmatch.cpython-34.pyc31460644editdlrm
fnmatch.cpython-34.pyo31460644editdlrm
formatter.cpython-34.pyc189160644editdlrm
formatter.cpython-34.pyo189160644editdlrm
fractions.cpython-34.pyc192700644editdlrm
fractions.cpython-34.pyo192700644editdlrm
ftplib.cpython-34.pyc333220644editdlrm
ftplib.cpython-34.pyo333220644editdlrm
functools.cpython-34.pyc236140644editdlrm
functools.cpython-34.pyo236140644editdlrm
genericpath.cpython-34.pyc34930644editdlrm
genericpath.cpython-34.pyo34930644editdlrm
getopt.cpython-34.pyc67330644editdlrm
getopt.cpython-34.pyo66910644editdlrm
getpass.cpython-34.pyc46240644editdlrm
getpass.cpython-34.pyo46240644editdlrm
gettext.cpython-34.pyc151740644editdlrm
gettext.cpython-34.pyo151740644editdlrm
glob.cpython-34.pyc28800644editdlrm
glob.cpython-34.pyo28800644editdlrm
gzip.cpython-34.pyc194460644editdlrm
gzip.cpython-34.pyo193920644editdlrm
hashlib.cpython-34.pyc79440644editdlrm
hashlib.cpython-34.pyo79440644editdlrm
heapq.cpython-34.pyc139100644editdlrm
heapq.cpython-34.pyo139100644editdlrm
hmac.cpython-34.pyc51460644editdlrm
hmac.cpython-34.pyo51460644editdlrm
imaplib.cpython-34.pyc434790644editdlrm
imaplib.cpython-34.pyo409550644editdlrm
imghdr.cpython-34.pyc41430644editdlrm
imghdr.cpython-34.pyo41430644editdlrm
imp.cpython-34.pyc98670644editdlrm
imp.cpython-34.pyo98670644editdlrm
inspect.cpython-34.pyc763270644editdlrm
inspect.cpython-34.pyo760060644editdlrm
io.cpython-34.pyc34580644editdlrm
io.cpython-34.pyo34580644editdlrm
ipaddress.cpython-34.pyc629840644editdlrm
ipaddress.cpython-34.pyo629840644editdlrm
keyword.cpython-34.pyc19460644editdlrm
keyword.cpython-34.pyo19460644editdlrm
linecache.cpython-34.pyc31120644editdlrm
linecache.cpython-34.pyo31120644editdlrm
locale.cpython-34.pyc372760644editdlrm
locale.cpython-34.pyo372760644editdlrm
lzma.cpython-34.pyc159170644editdlrm
lzma.cpython-34.pyo159170644editdlrm
macpath.cpython-34.pyc60060644editdlrm
macpath.cpython-34.pyo60060644editdlrm
macurl2path.cpython-34.pyc21020644editdlrm
macurl2path.cpython-34.pyo21020644editdlrm
mailbox.cpython-34.pyc702880644editdlrm
mailbox.cpython-34.pyo701890644editdlrm
mailcap.cpython-34.pyc65440644editdlrm
mailcap.cpython-34.pyo65440644editdlrm
mimetypes.cpython-34.pyc168070644editdlrm
mimetypes.cpython-34.pyo168070644editdlrm
modulefinder.cpython-34.pyc173760644editdlrm
modulefinder.cpython-34.pyo172970644editdlrm
netrc.cpython-34.pyc42770644editdlrm
netrc.cpython-34.pyo42770644editdlrm
nntplib.cpython-34.pyc363100644editdlrm
nntplib.cpython-34.pyo363100644editdlrm
ntpath.cpython-34.pyc133050644editdlrm
ntpath.cpython-34.pyo133050644editdlrm
nturl2path.cpython-34.pyc17160644editdlrm
nturl2path.cpython-34.pyo17160644editdlrm
numbers.cpython-34.pyc126670644editdlrm
numbers.cpython-34.pyo126670644editdlrm
opcode.cpython-34.pyc51740644editdlrm
opcode.cpython-34.pyo51740644editdlrm
operator.cpython-34.pyc127780644editdlrm
operator.cpython-34.pyo127780644editdlrm
optparse.cpython-34.pyc515370644editdlrm
optparse.cpython-34.pyo514600644editdlrm
os.cpython-34.pyc295990644editdlrm
os.cpython-34.pyo295990644editdlrm
pathlib.cpython-34.pyc404830644editdlrm
pathlib.cpython-34.pyo404830644editdlrm
pdb.cpython-34.pyc494720644editdlrm
pdb.cpython-34.pyo494060644editdlrm
pickle.cpython-34.pyc469840644editdlrm
pickle.cpython-34.pyo468380644editdlrm
pickletools.cpython-34.pyc702540644editdlrm
pickletools.cpython-34.pyo691670644editdlrm
pipes.cpython-34.pyc84310644editdlrm
pipes.cpython-34.pyo84310644editdlrm
pkgutil.cpython-34.pyc176000644editdlrm
pkgutil.cpython-34.pyo176000644editdlrm
platform.cpython-34.pyc311720644editdlrm
platform.cpython-34.pyo311720644editdlrm
plistlib.cpython-34.pyc301510644editdlrm
plistlib.cpython-34.pyo300680644editdlrm
poplib.cpython-34.pyc137540644editdlrm
poplib.cpython-34.pyo137540644editdlrm
posixpath.cpython-34.pyc98090644editdlrm
posixpath.cpython-34.pyo98090644editdlrm
pprint.cpython-34.pyc114600644editdlrm
pprint.cpython-34.pyo112950644editdlrm
profile.cpython-34.pyc151510644editdlrm
profile.cpython-34.pyo148980644editdlrm
pstats.cpython-34.pyc236750644editdlrm
pstats.cpython-34.pyo236750644editdlrm
pty.cpython-34.pyc42250644editdlrm
pty.cpython-34.pyo42250644editdlrm
pyclbr.cpython-34.pyc91920644editdlrm
pyclbr.cpython-34.pyo91920644editdlrm
pydoc.cpython-34.pyc909150644editdlrm
pydoc.cpython-34.pyo908540644editdlrm
py_compile.cpython-34.pyc68570644editdlrm
py_compile.cpython-34.pyo68570644editdlrm
queue.cpython-34.pyc92620644editdlrm
queue.cpython-34.pyo92620644editdlrm
quopri.cpython-34.pyc64460644editdlrm
quopri.cpython-34.pyo62360644editdlrm
random.cpython-34.pyc190590644editdlrm
random.cpython-34.pyo190590644editdlrm
re.cpython-34.pyc145500644editdlrm
re.cpython-34.pyo145500644editdlrm
reprlib.cpython-34.pyc58720644editdlrm
reprlib.cpython-34.pyo58720644editdlrm
rlcompleter.cpython-34.pyc56950644editdlrm
rlcompleter.cpython-34.pyo56950644editdlrm
runpy.cpython-34.pyc77530644editdlrm
runpy.cpython-34.pyo77530644editdlrm
sched.cpython-34.pyc65730644editdlrm
sched.cpython-34.pyo65730644editdlrm
selectors.cpython-34.pyc167440644editdlrm
selectors.cpython-34.pyo167440644editdlrm
shelve.cpython-34.pyc99550644editdlrm
shelve.cpython-34.pyo99550644editdlrm
shlex.cpython-34.pyc75180644editdlrm
shlex.cpython-34.pyo75180644editdlrm
shutil.cpython-34.pyc330150644editdlrm
shutil.cpython-34.pyo330150644editdlrm
site.cpython-34.pyc179710644editdlrm
site.cpython-34.pyo179710644editdlrm
smtpd.cpython-34.pyc256690644editdlrm
smtpd.cpython-34.pyo256690644editdlrm
smtplib.cpython-34.pyc331290644editdlrm
smtplib.cpython-34.pyo330550644editdlrm
sndhdr.cpython-34.pyc67690644editdlrm
sndhdr.cpython-34.pyo67690644editdlrm
socket.cpython-34.pyc181110644editdlrm
socket.cpython-34.pyo180610644editdlrm
socketserver.cpython-34.pyc232550644editdlrm
socketserver.cpython-34.pyo232550644editdlrm
sre_compile.cpython-34.pyc119350644editdlrm
sre_compile.cpython-34.pyo117780644editdlrm
sre_constants.cpython-34.pyc55810644editdlrm
sre_constants.cpython-34.pyo55810644editdlrm
sre_parse.cpython-34.pyc202380644editdlrm
sre_parse.cpython-34.pyo202380644editdlrm
ssl.cpython-34.pyc276080644editdlrm
ssl.cpython-34.pyo276080644editdlrm
stat.cpython-34.pyc35780644editdlrm
stat.cpython-34.pyo35780644editdlrm
statistics.cpython-34.pyc171580644editdlrm
statistics.cpython-34.pyo168560644editdlrm
string.cpython-34.pyc83760644editdlrm
string.cpython-34.pyo83760644editdlrm
stringprep.cpython-34.pyc136360644editdlrm
stringprep.cpython-34.pyo135730644editdlrm
struct.cpython-34.pyc3470644editdlrm
struct.cpython-34.pyo3470644editdlrm
subprocess.cpython-34.pyc433590644editdlrm
subprocess.cpython-34.pyo432460644editdlrm
sunau.cpython-34.pyc183090644editdlrm
sunau.cpython-34.pyo183090644editdlrm
symbol.cpython-34.pyc26620644editdlrm
symbol.cpython-34.pyo26620644editdlrm
symtable.cpython-34.pyc113050644editdlrm
symtable.cpython-34.pyo111830644editdlrm
sysconfig.cpython-34.pyc172870644editdlrm
sysconfig.cpython-34.pyo172870644editdlrm
tabnanny.cpython-34.pyc77490644editdlrm
tabnanny.cpython-34.pyo77490644editdlrm
tarfile.cpython-34.pyc680400644editdlrm
tarfile.cpython-34.pyo680400644editdlrm
telnetlib.cpython-34.pyc193940644editdlrm
telnetlib.cpython-34.pyo193940644editdlrm
tempfile.cpython-34.pyc215760644editdlrm
tempfile.cpython-34.pyo215760644editdlrm
textwrap.cpython-34.pyc138000644editdlrm
textwrap.cpython-34.pyo137140644editdlrm
this.cpython-34.pyc13160644editdlrm
this.cpython-34.pyo13160644editdlrm
threading.cpython-34.pyc389650644editdlrm
threading.cpython-34.pyo382520644editdlrm
timeit.cpython-34.pyc110620644editdlrm
timeit.cpython-34.pyo110620644editdlrm
token.cpython-34.pyc36150644editdlrm
token.cpython-34.pyo36150644editdlrm
tokenize.cpython-34.pyc199510644editdlrm
tokenize.cpython-34.pyo199010644editdlrm
trace.cpython-34.pyc241840644editdlrm
trace.cpython-34.pyo241270644editdlrm
traceback.cpython-34.pyc110910644editdlrm
traceback.cpython-34.pyo110910644editdlrm
tracemalloc.cpython-34.pyc171300644editdlrm
tracemalloc.cpython-34.pyo171300644editdlrm
tty.cpython-34.pyc11460644editdlrm
tty.cpython-34.pyo11460644editdlrm
types.cpython-34.pyc55600644editdlrm
types.cpython-34.pyo55600644editdlrm
uu.cpython-34.pyc40210644editdlrm
uu.cpython-34.pyo40210644editdlrm
uuid.cpython-34.pyc218640644editdlrm
uuid.cpython-34.pyo218020644editdlrm
warnings.cpython-34.pyc122680644editdlrm
warnings.cpython-34.pyo115360644editdlrm
wave.cpython-34.pyc191350644editdlrm
wave.cpython-34.pyo190740644editdlrm
weakref.cpython-34.pyc203450644editdlrm
weakref.cpython-34.pyo203080644editdlrm
webbrowser.cpython-34.pyc171320644editdlrm
webbrowser.cpython-34.pyo170930644editdlrm
xdrlib.cpython-34.pyc90020644editdlrm
xdrlib.cpython-34.pyo90020644editdlrm
zipfile.cpython-34.pyc458200644editdlrm
zipfile.cpython-34.pyo457710644editdlrm
_bootlocale.cpython-34.pyc10470644editdlrm
_bootlocale.cpython-34.pyo10160644editdlrm
_collections_abc.cpython-34.pyc239490644editdlrm
_collections_abc.cpython-34.pyo239490644editdlrm
_compat_pickle.cpython-34.pyc75010644editdlrm
_compat_pickle.cpython-34.pyo74270644editdlrm
_dummy_thread.cpython-34.pyc48250644editdlrm
_dummy_thread.cpython-34.pyo48250644editdlrm
_markupbase.cpython-34.pyc89320644editdlrm
_markupbase.cpython-34.pyo87450644editdlrm
_osx_support.cpython-34.pyc106300644editdlrm
_osx_support.cpython-34.pyo106300644editdlrm
_pyio.cpython-34.pyc649330644editdlrm
_pyio.cpython-34.pyo649070644editdlrm
_sitebuiltins.cpython-34.pyc36770644editdlrm
_sitebuiltins.cpython-34.pyo36770644editdlrm
_strptime.cpython-34.pyc157790644editdlrm
_strptime.cpython-34.pyo157790644editdlrm
_sysconfigdata.cpython-34.pyc227000644editdlrm
_sysconfigdata.cpython-34.pyo227000644editdlrm
_threading_local.cpython-34.pyc69460644editdlrm
_threading_local.cpython-34.pyo69460644editdlrm
_weakrefset.cpython-34.pyc84650644editdlrm
_weakrefset.cpython-34.pyo84650644editdlrm
__future__.cpython-34.pyc41680644editdlrm
__future__.cpython-34.pyo41680644editdlrm
__phello__.foo.cpython-34.pyc1340644editdlrm
__phello__.foo.cpython-34.pyo1340644editdlrm
Edit: /opt/alt/python34/lib64/python3.4/__pycache__/ssl.cpython-34.pyo (27608B)
f+@sdZddlZddlZddlZddlZddlmZddlmZ ddl Z ddl m Z m Z m Z ddl mZddl mZmZmZmZmZmZddl mZmZmZdd l mZmZdd l mZmZmZmZydd l m Z Wne!k r8YnXd d Z"e"de"de"de"de"dddl m#Z#m$Z$m%Z%ddl m&Z&e'e de(dd$Z?Gd%d&d&e@ZAd'd(d)ZBd*d+ZCed,d-ZDd.d/ZEGd0d1d1ed1d2ZFGd3d4d4eFe ZGGd5d6d6eZHeGjId7dd8dd9dd:d;ZJeKd<dd=d>d?eGjId@ddAdd7dd8dd9ddBdCZLeJZMeLZNGdDdEdEe2ZOddd>eeKddFdFddGdH ZPdIdJZQdKZRdLZSdMdNZTdOdPZUeKddQdRZVdSdTZWdS)Ua This module provides some more Pythonic support for SSL. Object types: SSLSocket -- subtype of socket.socket which does SSL over the socket Exceptions: SSLError -- exception raised for I/O errors Functions: cert_time_to_seconds -- convert time string used for certificate notBefore and notAfter functions to integer seconds past the Epoch (the time values returned from time.time()) fetch_server_certificate (HOST, PORT) -- fetch the certificate provided by the server running on HOST at port PORT. No validation of the certificate is performed. Integer constants: SSL_ERROR_ZERO_RETURN SSL_ERROR_WANT_READ SSL_ERROR_WANT_WRITE SSL_ERROR_WANT_X509_LOOKUP SSL_ERROR_SYSCALL SSL_ERROR_SSL SSL_ERROR_WANT_CONNECT SSL_ERROR_EOF SSL_ERROR_INVALID_ERROR_CODE The following group define certificate requirements that one side is allowing/requiring from the other side: CERT_NONE - no certificates from the other side are required (or will be looked at if provided) CERT_OPTIONAL - certificates are not required, but if provided will be validated, and if validation fails, the connection will also fail CERT_REQUIRED - certificates are required, and will be validated, and if validation fails, the connection will also fail The following constants identify various SSL protocol variants: PROTOCOL_SSLv2 PROTOCOL_SSLv3 PROTOCOL_SSLv23 PROTOCOL_TLS PROTOCOL_TLSv1 PROTOCOL_TLSv1_1 PROTOCOL_TLSv1_2 The following constants identify various SSL alert message descriptions as per http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6 ALERT_DESCRIPTION_CLOSE_NOTIFY ALERT_DESCRIPTION_UNEXPECTED_MESSAGE ALERT_DESCRIPTION_BAD_RECORD_MAC ALERT_DESCRIPTION_RECORD_OVERFLOW ALERT_DESCRIPTION_DECOMPRESSION_FAILURE ALERT_DESCRIPTION_HANDSHAKE_FAILURE ALERT_DESCRIPTION_BAD_CERTIFICATE ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE ALERT_DESCRIPTION_CERTIFICATE_REVOKED ALERT_DESCRIPTION_CERTIFICATE_EXPIRED ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN ALERT_DESCRIPTION_ILLEGAL_PARAMETER ALERT_DESCRIPTION_UNKNOWN_CA ALERT_DESCRIPTION_ACCESS_DENIED ALERT_DESCRIPTION_DECODE_ERROR ALERT_DESCRIPTION_DECRYPT_ERROR ALERT_DESCRIPTION_PROTOCOL_VERSION ALERT_DESCRIPTION_INSUFFICIENT_SECURITY ALERT_DESCRIPTION_INTERNAL_ERROR ALERT_DESCRIPTION_USER_CANCELLED ALERT_DESCRIPTION_NO_RENEGOTIATION ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE ALERT_DESCRIPTION_UNRECOGNIZED_NAME ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY N) namedtuple)Enum)OPENSSL_VERSION_NUMBEROPENSSL_VERSION_INFOOPENSSL_VERSION) _SSLContext)SSLErrorSSLZeroReturnErrorSSLWantReadErrorSSLWantWriteErrorSSLSyscallError SSLEOFError) CERT_NONE CERT_OPTIONAL CERT_REQUIRED)txt2objnid2obj) RAND_statusRAND_add RAND_bytesRAND_pseudo_bytes)RAND_egdcCsCx<ttD].}|j|r tt|t|s r+)PROTOCOL_SSLv2ZSSLv2)PROTOCOL_TLSv1_1PROTOCOL_TLSv1_2zTLSv1.1zTLSv1.2win32)enum_certificates enum_crls)socketAF_INET SOCK_STREAMcreate_connection) SOL_SOCKETSO_TYPEz tls-uniquezECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:!aNULL:!eNULL:!MD5:!3DESzECDH+AESGCM:ECDH+CHACHA20:DH+AESGCM:DH+CHACHA20:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+HIGH:DH+HIGH:RSA+AESGCM:RSA+AES:RSA+HIGH:!aNULL:!eNULL:!MD5:!DSS:!RC4:!3DESc@seZdZdS)CertificateErrorN)__name__ __module__ __qualname__rrrr r8s r8c CsDg}|sdS|jd^}}|jd}||krYtdt|n|su|j|jkS|dkr|jdnY|jds|jdr|jtj|n"|jtj|j ddx$|D]}|jtj|qWtj d d j |d tj }|j |S) zhMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 F.*z,too many wildcards in certificate DNS name: z[^.]+zxn--z\*z[^.]*z\Az\.z\Z)splitcountr8reprlowerappendrreescapereplacecompilejoin IGNORECASEmatch) ZdnhostnameZ max_wildcardsZpatsZleftmostZ remainderZ wildcardsZfragZpatrrr _dnsname_matchs&  " &rLcCs[|stdng}|jdf}xC|D];\}}|dkr4t||r_dS|j|q4q4W|sxc|jdfD]L}xC|D];\}}|dkrt||rdS|j|qqWqWnt|dkrtd|d jtt|fn;t|dkrKtd ||d fn td dS) a)Verify that *cert* (in decoded format as returned by SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 rules are followed, but IP addresses are not accepted for *hostname*. CertificateError is raised on failure. On success, the function returns nothing. ztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDZsubjectAltNameZDNSNZsubjectZ commonNamer<z&hostname %r doesn't match either of %sz, zhostname %r doesn't match %rrz=no appropriate commonName or subjectAltName fields were found) ValueErrorgetrLrClenr8rHmaprA)certrKZdnsnamesZsankeyr*subrrr match_hostnames.  %rTDefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcCstj}tjj|d|d}tjj|d|d}ttjj|ra|ndtjj|r||nd|S)z/Return paths to default cafile and capath. rr<N) rget_default_verify_pathsosenvironrNrUpathisfileisdir)partscafilecapathrrr rX0s  rXcs^eZdZdZfZfddZefddZefddZS) _ASN1Objectz#ASN.1 object identifier lookup cstj|t|ddS)Nr)F)super__new___txt2obj)clsoid) __class__rr rcCsz_ASN1Object.__new__cstj|t|S)z3Create _ASN1Object from OpenSSL numeric ID )rbrc_nid2obj)reZnid)rgrr fromnidFsz_ASN1Object.fromnidcstj|t|ddS)z=Create _ASN1Object from short name, long name or OID r)T)rbrcrd)rer))rgrr fromnameLsz_ASN1Object.fromname) r9r:r;__doc__ __slots__rc classmethodrirjrr)rgr ra>s raznid shortname longname oidc@s"eZdZdZdZdZdS)PurposezDSSLContext purpose flags with X509v3 Extended Key Usage objects z1.3.6.1.5.5.7.3.1z1.3.6.1.5.5.7.3.2N)r9r:r;rk SERVER_AUTH CLIENT_AUTHrrrr rnSs rnc@seZdZdZdZdZeddZedd Zd d d d d dZ ddZ ddZ e j ddZd S) SSLContextz|An SSLContext holds various SSL-related configuration options and data, such as certificates and possibly a private key.protocol __weakref__CAROOTcOs2tj||}|tkr.|jtn|S)N)rrc_SSLv2_IF_EXISTS set_ciphers_DEFAULT_CIPHERS)rerrargskwargsselfrrr rcas zSSLContext.__new__cCs ||_dS)N)rr)r{rrrrr __init__gszSSLContext.__init__FTNc Cs+td|d|d|d|d|d|S)Nsock server_sidedo_handshake_on_connectsuppress_ragged_eofsserver_hostname_context) SSLSocket)r{r}r~rrrrrr wrap_socketjs zSSLContext.wrap_socketcCst}xp|D]h}t|d}t|dksIt|dkrXtdn|jt||j|qW|j|dS)Nasciirz(NPN protocols must be 1 to 255 in length) bytearraybytesrOrrCextendZ_set_npn_protocols)r{ npn_protocolsZprotosrrbrrr set_npn_protocolsts  $zSSLContext.set_npn_protocolscCswt}xWt|D]I\}}}|dkr|dksL|j|kr_|j|q_qqW|jd||S)NZx509_asnTcadata)rr0rfrload_verify_locations)r{ storenamepurposeZcertsrQencodingZtrustrrr _load_windows_store_certss  z$SSLContext._load_windows_store_certscCsbt|tst|ntjdkrTx$|jD]}|j||q7Wn|jdS)Nr/) isinstancera TypeErrorsysplatform_windows_cert_storesrZset_default_verify_paths)r{rrrrr load_default_certss zSSLContext.load_default_certs)zprotocolz __weakref__)rtru)r9r:r;rkrlrr'rcr|rrrrnrorrrrr rqZs  rqr_r`rcCsBt|tst|ntt}|jtO_|jtO_|jtt ddO_|t j krt |_ d|_np|t jkr|jtt ddO_|jtt ddO_|jtt ddO_|jtn|s |s |r|j|||n|j tkr>|j|n|S)zCreate a SSLContext object with default settings. NOTE: The protocol and settings may change anytime without prior deprecation. The values represent a fair balance between maximum compatibility and security. ZOP_NO_COMPRESSIONrTZOP_CIPHER_SERVER_PREFERENCEZOP_SINGLE_DH_USEZOP_SINGLE_ECDH_USE)rrarrqr'options OP_NO_SSLv2 OP_NO_SSLv3rrrnror verify_modecheck_hostnamerprw_RESTRICTED_SERVER_CIPHERSrrr)rr_r`rcontextrrr create_default_contexts&   r cert_reqsrFrcertfilekeyfilec Cst|tst|nt|} | jtO_| jtO_|dk r`|| _n|| _|r| rt dn|s|r| j ||n|s|s|r| j |||n| jt kr| j |n| S)a/Create a SSLContext object for Python stdlib modules All Python stdlib modules shall use this function to create SSLContext objects in order to keep common settings in one place. The configuration is less restrict than create_default_context()'s to increase backward compatibility. Nzcertfile must be specified)rrarrqrrrrrrMload_cert_chainrrr) rrrrrrrr_r`rrrrr _create_unverified_contexts"       rc@s eZdZdZddddeeddeedddddddddZe dd Z e j d d Z d d Z dd dZ ddZddddZddZdddZddZddZddZdddZddd Zd!d"Zdd#d$Zd%dd&d'Zddd(d)Zd%dd*d+Zddd,d-Zd.d/Zd0d1Zd2d3Zd4d5Z d6d7Z!d8d9Z"dd:d;Z#d<d=Z$d>d?Z%d@dAZ&dBdCZ'dDdEdFZ(dS)GrzThis class implements a subtype of socket.socket that wraps the underlying OS socket in an SSL context when necessary, and provides read and write methods over that channel.NFTrcCsD|r||_n|r.| r.tdn|rJ| rJtdn|r`| r`|}nt||_||j_|r|jj|n|r|jj||n|r|jj|n|r|jj|n||_||_ ||_ ||_ ||_ ||_ |jtttkr?tdn|rZ|rZtdn|jjr|| r|tdn||_||_||_| |_|dk rtj|d|jd|jd|jd |j|j|j|j nA| dk r"tj|d | ntj|d| d| d| y|j!WnCt"k r}z#|j#t#j$kr|nd }WYdd}~XnXd }d |_%d|_&||_'|r@yY|jj(||||_&|r|j}|d krtd n|j)nWq@t"tfk r<|j*Yq@XndS)Nz5certfile must be specified for server-side operationszcertfile must be specifiedz!only stream sockets are supportedz4server_hostname can only be specified in client modez'check_hostname requires server_hostnamefamilytypeprotofilenoFTgzHdo_handshake_on_connect should not be specified for non-blocking sockets)+rrMrqrrrrrwrrr ssl_versionca_certsciphersZ getsockoptr6r7r4NotImplementedErrorrr~rrrr2r|rrrr settimeout gettimeoutdetach getpeernameOSErrorerrnoZENOTCONNZ_closed_sslobj _connected _wrap_socket do_handshakeclose)r{r}rrr~rrrrrrrrrrrrreZ connectedtimeoutrrr r|s                                 zSSLSocket.__init__cCs|jS)N)r)r{rrr rRszSSLSocket.contextcCs||_||j_dS)N)rrr)r{Zctxrrr rVs cCstd|jjdS)NzCan't dup() %s instances)NotImplementedrgr9)r{rrr dup[sz SSLSocket.dupcCsdS)Nr)r{msgrrr _checkClosed_szSSLSocket._checkClosedcCs|js|jndS)N)rr)r{rrr _check_connectedcs zSSLSocket._check_connectedcCs|j|js"tdnyD|dk rI|jj||}n|jj|p[d}|SWn[tk r}z;|jdtkr|jr|dk rdSdSnWYdd}~XnXdS)zORead up to LEN bytes and return them. Return zero-length string on EOF.z'Read on closed or unwrapped SSL socket.Nir)rrrMreadrryZ SSL_ERROR_EOFr)r{rObuffervxrrr rks    zSSLSocket.readcCs2|j|js"tdn|jj|S)zhWrite DATA to the underlying SSL channel. Returns number of bytes of DATA actually transmitted.z(Write on closed or unwrapped SSL socket.)rrrMwrite)r{datarrr rs  zSSLSocket.writecCs$|j|j|jj|S)zReturns a formatted version of the data in the certificate provided by the other end of the SSL channel. Return None if no certificate was provided, {} if a certificate was provided, but not validated.)rrrZpeer_certificate)r{Z binary_formrrr getpeercerts  zSSLSocket.getpeercertcCs3|j|j stj r"dS|jjSdS)N)rrrr%selected_npn_protocol)r{rrr rs zSSLSocket.selected_npn_protocolcCs(|j|jsdS|jjSdS)N)rrcipher)r{rrr rs  zSSLSocket.ciphercCs(|j|jsdS|jjSdS)N)rr compression)r{rrr rs  zSSLSocket.compressioncCs|j|jr|dkr5td|jny|jj|}WnVtk r}z6|jdtkrwdS|jdtkrdSWYdd}~XqX|Snt j |||SdS)Nrz3non-zero flags not allowed in calls to send() on %s) rrrMrgrrryZSSL_ERROR_WANT_READZSSL_ERROR_WANT_WRITEr2send)r{rflagsrrrrr rs    zSSLSocket.sendcCsb|j|jr)td|jn5|dkrHtj|||Stj||||SdS)Nz%sendto not allowed on instances of %s)rrrMrgr2sendto)r{rZ flags_or_addraddrrrr rs   zSSLSocket.sendtocOstd|jdS)Nz&sendmsg not allowed on instances of %s)rrg)r{ryrzrrr sendmsgszSSLSocket.sendmsgcCs|j|jr|dkr5td|jnt|}d}x3||kr||j||d}||7}qJW|Stj|||SdS)Nrz6non-zero flags not allowed in calls to sendall() on %s)rrrMrgrOrr2sendall)r{rrZamountr@rrrr rs    zSSLSocket.sendallicCsY|j|jrB|dkr5td|jn|j|Stj|||SdS)Nrz3non-zero flags not allowed in calls to recv() on %s)rrrMrgrr2recv)r{buflenrrrr rs    zSSLSocket.recvcCs|j|r+|dkr+t|}n|dkr@d}n|jr{|dkrktd|jn|j||Stj||||SdS)Nirz8non-zero flags not allowed in calls to recv_into() on %s)rrOrrMrgrr2 recv_into)r{rnbytesrrrr rs     zSSLSocket.recv_intocCs@|j|jr)td|jntj|||SdS)Nz'recvfrom not allowed on instances of %s)rrrMrgr2recvfrom)r{rrrrr rs   zSSLSocket.recvfromcCsC|j|jr)td|jntj||||SdS)Nz,recvfrom_into not allowed on instances of %s)rrrMrgr2 recvfrom_into)r{rrrrrr rs   zSSLSocket.recvfrom_intocOstd|jdS)Nz&recvmsg not allowed on instances of %s)rrg)r{ryrzrrr recvmsgszSSLSocket.recvmsgcOstd|jdS)Nz+recvmsg_into not allowed on instances of %s)rrg)r{ryrzrrr recvmsg_into szSSLSocket.recvmsg_intocCs(|j|jr |jjSdSdS)Nr)rrpending)r{rrr rs   zSSLSocket.pendingcCs'|jd|_tj||dS)N)rrr2shutdown)r{Zhowrrr rs  zSSLSocket.shutdowncCs?|jr%|jj}d|_|Stdt|dS)NzNo SSL wrapper around )rrrMstr)r{srrr unwraps   zSSLSocket.unwrapcCsd|_tj|dS)N)rr2 _real_close)r{rrr r$s zSSLSocket._real_closec Cs|j|j}z3|dkr;|r;|jdn|jjWd|j|X|jjr|js~tdnt |j |jndS)zPerform a TLS/SSL handshake.gNz-check_hostname needs server_hostname argument) rrrrrrrrrMrTr)r{blockrrrr r(s    zSSLSocket.do_handshakec Cs|jrtdn|jr0tdn|jj|d|j|_ya|rltj||}nd}tj |||sd|_|j r|j qn|SWn$t tfk rd|_YnXdS)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!FT) r~rMrrrrrr2 connect_exconnectrrr)r{rrrcrrr _real_connect9s$     zSSLSocket._real_connectcCs|j|ddS)zQConnects to remote ADDR, and then wraps the connection in an SSL channel.FN)r)r{rrrr rPszSSLSocket.connectcCs|j|dS)zQConnects to remote ADDR, and then wraps the connection in an SSL channel.T)r)r{rrrr rUszSSLSocket.connect_excCsItj|\}}|jj|d|jd|jdd}||fS)zAccepts a new connection from a remote client, and returns a tuple containing that new connection wrapped with a server-side SSL channel, and the address of the remote client.rrr~T)r2acceptrrrr)r{Znewsockrrrr rZs    zSSLSocket.acceptz tls-uniquecCs_|tkrtdn|dkr?tdj|n|jdkrRdS|jjS)zGet channel binding data for current connection. Raise ValueError if the requested `cb_type` is not supported. Return bytes of the data or None if the data is not available (e.g. before the handshake). z Unsupported channel binding typez tls-uniquez({0} channel binding type not implementedN)CHANNEL_BINDING_TYPESrMrformatrZ tls_unique_cb)r{Zcb_typerrr get_channel_bindingfs  zSSLSocket.get_channel_binding))r9r:r;rkrr'r3r4r|propertyrsetterrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rsP    S                  rTc CsCtd|d|d|d|d|d|d|d|d |d | S) Nr}rrr~rrrrrr)r) r}rrr~rrrrrrrrr rvs   rcCs%ddl}|j|j|dS)zTakes a date-time string in standard ASN1_print form ("MON DAY 24HOUR:MINUTE:SEC YEAR TIMEZONE") and return a Python time value in seconds past the epoch.rNz%b %d %H:%M:%S %Y GMT)timeZmktimeZstrptime)Z cert_timerrrr cert_time_to_secondss rz-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----cCs?ttj|dd}tdtj|ddtdS)z[Takes a certificate in binary DER format and returns the PEM version of it as a string.ASCIIstrict @)rbase64Zstandard_b64encode PEM_HEADERtextwrapZfill PEM_FOOTER)Zder_cert_bytesfrrr DER_cert_to_PEM_certsrcCs|jts"tdtn|jjtsJtdtn|jtttt }tj|j ddS)zhTakes a certificate in ASCII PEM format and returns the DER-encoded version of it as a byte sequencez(Invalid PEM encoding; must start with %sz&Invalid PEM encoding; must end with %srr) rrrMstripendswithrrOrZ decodebytesencode)Zpem_cert_stringdrrr PEM_cert_to_DER_certs  #rc Cs|\}}|dk r!t}nt}t|d|d|}t|.}|j|}|jd} WdQXWdQXt| S)zRetrieve the certificate from the server at the specified address, and return it as a PEM-encoded string. If 'ca_certs' is specified, validate the server cert against it. If 'ssl_version' is specified, use it in the connection attempt.Nrr_T)rr_create_stdlib_contextr5rrr) rrrhostZportrrr}ZsslsockZdercertrrr get_server_certificates     rcCstj|dS)Nz )_PROTOCOL_NAMESrN)Z protocol_coderrr get_protocol_namesr)XrkrrDrrY collectionsrZenumrZ_Enumrrrrrrr r r r r rrrrrdrrhrrrrr ImportErrorr!r#r$r%r&rritemsrr,rvr-r.rr0r1r2r3r4r5r6r7rrrZ socket_errorZHAS_TLS_UNIQUErrxrrMr8rLrTrUrXrarnrqrorr'rZ_create_default_https_contextrrrrrrrrrrrrrr Ys     ."              "    1 +  8/  '