/snap/core24/1643/usr/lib/python3.12/__pycache__
NameSizeModeActions
abc.cpython-312.pyc80550644editdlrm
aifc.cpython-312.pyc428630644editdlrm
antigravity.cpython-312.pyc10030644editdlrm
argparse.cpython-312.pyc1016820644editdlrm
ast.cpython-312.pyc1002790644editdlrm
base64.cpython-312.pyc244080644editdlrm
bdb.cpython-312.pyc373590644editdlrm
bisect.cpython-312.pyc36410644editdlrm
bz2.cpython-312.pyc151330644editdlrm
calendar.cpython-312.pyc396210644editdlrm
cgi.cpython-312.pyc402280644editdlrm
cgitb.cpython-312.pyc173320644editdlrm
chunk.cpython-312.pyc73100644editdlrm
cmd.cpython-312.pyc186190644editdlrm
code.cpython-312.pyc130510644editdlrm
codecs.cpython-312.pyc422740644editdlrm
codeop.cpython-312.pyc69160644editdlrm
colorsys.cpython-312.pyc46420644editdlrm
compileall.cpython-312.pyc204970644editdlrm
configparser.cpython-312.pyc635820644editdlrm
contextlib.cpython-312.pyc303760644editdlrm
contextvars.cpython-312.pyc2610644editdlrm
copy.cpython-312.pyc98000644editdlrm
copyreg.cpython-312.pyc74140644editdlrm
cProfile.cpython-312.pyc85930644editdlrm
crypt.cpython-312.pyc53610644editdlrm
csv.cpython-312.pyc177880644editdlrm
dataclasses.cpython-312.pyc446780644editdlrm
datetime.cpython-312.pyc4090644editdlrm
decimal.cpython-312.pyc4060644editdlrm
difflib.cpython-312.pyc754990644editdlrm
dis.cpython-312.pyc345600644editdlrm
doctest.cpython-312.pyc1056860644editdlrm
enum.cpython-312.pyc807080644editdlrm
filecmp.cpython-312.pyc146610644editdlrm
fileinput.cpython-312.pyc202800644editdlrm
fnmatch.cpython-312.pyc64950644editdlrm
fractions.cpython-312.pyc366670644editdlrm
ftplib.cpython-312.pyc426360644editdlrm
functools.cpython-312.pyc405060644editdlrm
genericpath.cpython-312.pyc68220644editdlrm
getopt.cpython-312.pyc83630644editdlrm
getpass.cpython-312.pyc68500644editdlrm
gettext.cpython-312.pyc221510644editdlrm
glob.cpython-312.pyc98410644editdlrm
graphlib.cpython-312.pyc103270644editdlrm
gzip.cpython-312.pyc320150644editdlrm
hashlib.cpython-312.pyc80870644editdlrm
heapq.cpython-312.pyc179560644editdlrm
hmac.cpython-312.pyc106980644editdlrm
imaplib.cpython-312.pyc628890644editdlrm
imghdr.cpython-312.pyc69440644editdlrm
inspect.cpython-312.pyc1334460644editdlrm
io.cpython-312.pyc41390644editdlrm
ipaddress.cpython-312.pyc907620644editdlrm
keyword.cpython-312.pyc10410644editdlrm
linecache.cpython-312.pyc64010644editdlrm
locale.cpython-312.pyc595360644editdlrm
lzma.cpython-312.pyc158550644editdlrm
mailbox.cpython-312.pyc1116180644editdlrm
mailcap.cpython-312.pyc111550644editdlrm
mimetypes.cpython-312.pyc241850644editdlrm
modulefinder.cpython-312.pyc279440644editdlrm
netrc.cpython-312.pyc89030644editdlrm
nntplib.cpython-312.pyc449390644editdlrm
ntpath.cpython-312.pyc260330644editdlrm
nturl2path.cpython-312.pyc30340644editdlrm
numbers.cpython-312.pyc139670644editdlrm
opcode.cpython-312.pyc147160644editdlrm
operator.cpython-312.pyc173640644editdlrm
optparse.cpython-312.pyc675460644editdlrm
os.cpython-312.pyc434740644editdlrm
pathlib.cpython-312.pyc620980644editdlrm
pdb.cpython-312.pyc849190644editdlrm
pickle.cpython-312.pyc761760644editdlrm
pickletools.cpython-312.pyc811280644editdlrm
pipes.cpython-312.pyc109140644editdlrm
pkgutil.cpython-312.pyc199590644editdlrm
platform.cpython-312.pyc416000644editdlrm
plistlib.cpython-312.pyc412860644editdlrm
poplib.cpython-312.pyc184460644editdlrm
posixpath.cpython-312.pyc182360644editdlrm
pprint.cpython-312.pyc294740644editdlrm
profile.cpython-312.pyc225400644editdlrm
pstats.cpython-312.pyc379220644editdlrm
pty.cpython-312.pyc73630644editdlrm
pyclbr.cpython-312.pyc148870644editdlrm
pydoc.cpython-312.pyc1429550644editdlrm
py_compile.cpython-312.pyc100780644editdlrm
queue.cpython-312.pyc147320644editdlrm
quopri.cpython-312.pyc93230644editdlrm
random.cpython-312.pyc331530644editdlrm
reprlib.cpython-312.pyc99090644editdlrm
rlcompleter.cpython-312.pyc82820644editdlrm
runpy.cpython-312.pyc143850644editdlrm
sched.cpython-312.pyc77350644editdlrm
secrets.cpython-312.pyc25560644editdlrm
selectors.cpython-312.pyc261280644editdlrm
shelve.cpython-312.pyc129130644editdlrm
shlex.cpython-312.pyc141620644editdlrm
shutil.cpython-312.pyc681130644editdlrm
signal.cpython-312.pyc44480644editdlrm
site.cpython-312.pyc290630644editdlrm
sitecustomize.cpython-312.pyc3000644editdlrm
smtplib.cpython-312.pyc482210644editdlrm
sndhdr.cpython-312.pyc107120644editdlrm
socket.cpython-312.pyc418170644editdlrm
socketserver.cpython-312.pyc342580644editdlrm
sre_compile.cpython-312.pyc6250644editdlrm
sre_constants.cpython-312.pyc6280644editdlrm
sre_parse.cpython-312.pyc6210644editdlrm
ssl.cpython-312.pyc630110644editdlrm
stat.cpython-312.pyc52310644editdlrm
statistics.cpython-312.pyc554230644editdlrm
string.cpython-312.pyc114820644editdlrm
stringprep.cpython-312.pyc251600644editdlrm
struct.cpython-312.pyc3250644editdlrm
subprocess.cpython-312.pyc791870644editdlrm
sunau.cpython-312.pyc254230644editdlrm
symtable.cpython-312.pyc187810644editdlrm
sysconfig.cpython-312.pyc300010644editdlrm
tabnanny.cpython-312.pyc121560644editdlrm
tarfile.cpython-312.pyc1233880644editdlrm
telnetlib.cpython-312.pyc284230644editdlrm
tempfile.cpython-312.pyc473390644editdlrm
textwrap.cpython-312.pyc182930644editdlrm
this.cpython-312.pyc14080644editdlrm
threading.cpython-312.pyc653460644editdlrm
timeit.cpython-312.pyc148640644editdlrm
token.cpython-312.pyc35570644editdlrm
tokenize.cpython-312.pyc247750644editdlrm
trace.cpython-312.pyc330240644editdlrm
traceback.cpython-312.pyc515230644editdlrm
tracemalloc.cpython-312.pyc269070644editdlrm
tty.cpython-312.pyc26680644editdlrm
turtle.cpython-312.pyc1846320644editdlrm
types.cpython-312.pyc149390644editdlrm
typing.cpython-312.pyc1418600644editdlrm
uu.cpython-312.pyc78160644editdlrm
uuid.cpython-312.pyc330070644editdlrm
warnings.cpython-312.pyc237920644editdlrm
wave.cpython-312.pyc320840644editdlrm
weakref.cpython-312.pyc313480644editdlrm
webbrowser.cpython-312.pyc263530644editdlrm
xdrlib.cpython-312.pyc118410644editdlrm
zipapp.cpython-312.pyc99770644editdlrm
zipimport.cpython-312.pyc244750644editdlrm
_aix_support.cpython-312.pyc47590644editdlrm
_collections_abc.cpython-312.pyc459120644editdlrm
_compat_pickle.cpython-312.pyc72210644editdlrm
_compression.cpython-312.pyc74970644editdlrm
_distutils_system_mod.cpython-312.pyc78180644editdlrm
_markupbase.cpython-312.pyc122790644editdlrm
_osx_support.cpython-312.pyc177310644editdlrm
_pydatetime.cpython-312.pyc941930644editdlrm
_pydecimal.cpython-312.pyc2278070644editdlrm
_pyio.cpython-312.pyc1102690644editdlrm
_pylong.cpython-312.pyc99830644editdlrm
_py_abc.cpython-312.pyc70540644editdlrm
_sitebuiltins.cpython-312.pyc47600644editdlrm
_strptime.cpython-312.pyc241160644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-312.pyc586510644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-312.pyc586450644editdlrm
_threading_local.cpython-312.pyc82950644editdlrm
_weakrefset.cpython-312.pyc117510644editdlrm
__future__.cpython-312.pyc47040644editdlrm
__hello__.cpython-312.pyc8700644editdlrm
Edit: /snap/core24/1643/usr/lib/python3.12/__pycache__/ssl.cpython-312.pyc (63011B)
Цi pdZddlZddlZddlmZddlmZmZ m Z ddlm Z ddl Z ddl mZmZmZddl mZmZmZddl mZmZmZmZmZmZmZdd l mZmZdd l mZm Z m!Z! dd l m"Z"dd l m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-dd l m.Z.m/Z/e j`de1de e j`de1de e j`de1de e j`de1de e j`de1de e j`de1de e2jfxZ4e2_4e2jjjmDcic]\}}|| c}}Z7e8e2ddZ9e e GddZ:e e GddZ;e e Gd d!Z<e e Gd"d#Z=ej|d$k(rdd%l m?Z?m@Z@dd&lAmAZAmBZBmCZCdd'lAmDZDmEZEmFZFddlAZGddlHZHddlIZIddlJZJeKZLd(gZMeNe d)ZOe.ZPeZQd*ZRd+ZSd,ZTed-d.ZUd/ZVGd0d1ed1d2ZWGd3d4eWeZXGd5d6eZYeXjfdddd7d8Z[dHe\d9eXjdddddd:d;Z]e[Z^e]Z_Gd<d=Z`d>ZaGd?d@eAZbebeY_ce`eY_ddAZedBZfdCZgdDZhdEZiejdeFfdFZkdGZly#e#$rYJwxYwcc}}w)Ia 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()) get_server_certificate (addr, ssl_version, ca_certs, timeout) -- Retrieve the certificate from the server at the specified address and return it as a PEM-encoded string 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_TLS_CLIENT PROTOCOL_TLS_SERVER 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)EnumIntEnumIntFlag) _simple_enum)OPENSSL_VERSION_NUMBEROPENSSL_VERSION_INFOOPENSSL_VERSION) _SSLContext MemoryBIO SSLSession)SSLErrorSSLZeroReturnErrorSSLWantReadErrorSSLWantWriteErrorSSLSyscallError SSLEOFErrorSSLCertVerificationError)txt2objnid2obj) RAND_statusRAND_add RAND_bytes)RAND_egd) HAS_SNIHAS_ECDHHAS_NPNHAS_ALPN HAS_SSLv2 HAS_SSLv3 HAS_TLSv1 HAS_TLSv1_1 HAS_TLSv1_2 HAS_TLSv1_3)_DEFAULT_CIPHERS_OPENSSL_API_VERSION _SSLMethodc2|jdxr|dk7S)N PROTOCOL_PROTOCOL_SSLv23 startswithnames /usr/lib/python3.12/ssl.pyr0}s-K$:K2K)sourceOptionsc$|jdS)NOP_r+r-s r/r0r0s'r1AlertDescriptionc$|jdS)NALERT_DESCRIPTION_r+r-s r/r0r0s!56r1SSLErrorNumberc$|jdS)N SSL_ERROR_r+r-s r/r0r0s.r1 VerifyFlagsc$|jdS)NVERIFY_r+r-s r/r0r0s+r1 VerifyModec$|jdS)NCERT_r+r-s r/r0r0s)r1PROTOCOL_SSLv2ceZdZejZej ZejZ ejZ ejZ ejZej Zy) TLSVersionN)__name__ __module__ __qualname___sslPROTO_MINIMUM_SUPPORTEDMINIMUM_SUPPORTED PROTO_SSLv3SSLv3 PROTO_TLSv1TLSv1 PROTO_TLSv1_1TLSv1_1 PROTO_TLSv1_2TLSv1_2 PROTO_TLSv1_3TLSv1_3PROTO_MAXIMUM_SUPPORTEDMAXIMUM_SUPPORTEDr1r/rDrDsQ44   E   E  G  G  G44r1rDc(eZdZdZdZdZdZdZdZdZ y) _TLSContentTypez@Content types (record layer) See RFC 8446, section B.1 N) rErFrG__doc__CHANGE_CIPHER_SPECALERT HANDSHAKEAPPLICATION_DATAHEADERINNER_CONTENT_TYPErWr1r/rYrYs* EI Fr1rYceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%y$)% _TLSAlertTypezQAlert types for TLSContentType.ALERT messages See RFC 8466, section B.2 r rZr[r\()*+,-./0123<FGPVZdmnopqrstxN)&rErFrGr` CLOSE_NOTIFYUNEXPECTED_MESSAGEBAD_RECORD_MACDECRYPTION_FAILEDRECORD_OVERFLOWDECOMPRESSION_FAILUREHANDSHAKE_FAILURENO_CERTIFICATEBAD_CERTIFICATEUNSUPPORTED_CERTIFICATECERTIFICATE_REVOKEDCERTIFICATE_EXPIREDCERTIFICATE_UNKNOWNILLEGAL_PARAMETER UNKNOWN_CA ACCESS_DENIED DECODE_ERROR DECRYPT_ERROREXPORT_RESTRICTIONPROTOCOL_VERSIONINSUFFICIENT_SECURITYINTERNAL_ERRORINAPPROPRIATE_FALLBACK USER_CANCELEDNO_RENEGOTIATIONMISSING_EXTENSIONUNSUPPORTED_EXTENSIONCERTIFICATE_UNOBTAINABLEUNRECOGNIZED_NAMEBAD_CERTIFICATE_STATUS_RESPONSEBAD_CERTIFICATE_HASH_VALUEUNKNOWN_PSK_IDENTITYCERTIFICATE_REQUIREDNO_APPLICATION_PROTOCOLrWr1r/rhrhsLNONO JMLMNM"&)#!$!r1rhcheZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZy)_TLSMessageTypezFMessage types (handshake protocol) See RFC 8446, section B.3 r rZr[r\r]Cr_N)rErFrGr` HELLO_REQUEST CLIENT_HELLO SERVER_HELLOHELLO_VERIFY_REQUESTNEWSESSION_TICKETEND_OF_EARLY_DATAHELLO_RETRY_REQUESTENCRYPTED_EXTENSIONS CERTIFICATESERVER_KEY_EXCHANGECERTIFICATE_REQUEST SERVER_DONECERTIFICATE_VERIFYCLIENT_KEY_EXCHANGEFINISHEDCERTIFICATE_URLCERTIFICATE_STATUSSUPPLEMENTAL_DATA KEY_UPDATE NEXT_PROTO MESSAGE_HASHrarWr1r/rrsMLLKKHOJJLr1rwin32)enum_certificates enum_crls)socket SOCK_STREAMcreate_connection) SOL_SOCKETSO_TYPE_GLOBAL_DEFAULT_TIMEOUT tls-uniqueHOSTFLAG_NEVER_CHECK_SUBJECTc|sy|jd}|s!|j|jk(S|dkDrtdj||j d\}}}d|vrtdj||stdj||dk7rtdj||j d\}}}|r|sy|j|jk(S) aMatching according to RFC 6125, section 6.4.3 - Hostnames are compared lower-case. - For IDNA, both dn and hostname must be encoded as IDN A-label (ACE). - Partial wildcards like 'www*.example.org', multiple wildcards, sole wildcard or wildcards in labels other then the left-most label are not supported and a CertificateError is raised. - A wildcard must match at least one character. F*rz1too many wildcards in certificate DNS name: {!r}..z9wildcard can only be present in the leftmost label: {!r}.z>sole wildcard without additional labels are not support: {!r}.zt|j}||k(S)zExact matching of IP addresses. RFC 6125 explicitly doesn't define an algorithm for this (section 1.7.2 - "Out of Scope"). )rrstrip)cert_ipaddresshost_ipips r/_ipaddress_matchrls! ^**, -B =r1DefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathc`tj}tjj |d|d}tjj |d|d}t tj j|r|ndtj j|r|ndg|S)z/Return paths to default cafile and capath. rrrrN) rHget_default_verify_pathsosenvirongetrpathisfileisdir)partscafilecapaths r/rr|s  ) ) +EZZ^^E!HeAh /F ZZ^^E!HeAh /F v(>fD(* f(=f4 &$ &&r1cNeZdZdZdZfdZefdZefdZxZ S) _ASN1Objectz#ASN.1 object identifier lookup rWc:t||gt|dS)NFr-super__new___txt2obj)clsoid __class__s r/rz_ASN1Object.__new__sws?Xc%>??r1c6t||gt|S)z3Create _ASN1Object from OpenSSL numeric ID )rr_nid2obj)rnidrs r/fromnidz_ASN1Object.fromnidsws3Xc]33r1c:t||gt|dS)z=Create _ASN1Object from short name, long name or OID Tr-r )rr.rs r/fromnamez_ASN1Object.fromnames ws?Xd%>??r1) rErFrGr` __slots__r classmethodrr __classcell__rs@r/r r s=I@44 @@r1r znid shortname longname oidceZdZdZdZdZy)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)rErFrGr` SERVER_AUTH CLIENT_AUTHrWr1r/rrs%K%Kr1rcjeZdZdZdZdZdZddZdZ d dZ d!dZ dZ d Z d Z d Zej fd Zeed r   # &??6*11': :??7+ +r1c F|jj|||||||S)N)sock server_sidedo_handshake_on_connectsuppress_ragged_eofsserver_hostnamecontextsession)sslsocket_class_create)r0r:r;r<r=r>r@s r/ wrap_socketzSSLContext.wrap_sockets7 ##++#$;!5+,  r1cb|jj||||j|||S)N)r;r>r@r?)sslobject_classrBr8)r0incomingoutgoingr;r>r@s r/wrap_biozSSLContext.wrap_bios<##++ hK 11/BT,  r1c<tjdtdt}|D]`}t |d}t |dk(st |dkDr t d|jt ||j|b|j|y)N'ssl NPN is deprecated, use ALPN insteadrr(r3rz(NPN protocols must be 1 to 255 in length) r)r*r+ bytearraybyteslenrappendextend_set_npn_protocols)r0 npn_protocolsprotosr-bs r/set_npn_protocolszSSLContext.set_npn_protocolss 5  % Hh(A1v{c!fslIJJ MM#a& ! MM!    'r1cbd_yts tdfd}|_y)Nznot a callable objectc:j|}|||SN)r8)sslobj servernamesslctxr0server_name_callbacks r/shim_cbz3SSLContext.set_servername_callback..shim_cbs"!22:> +FJGGr1) sni_callbackcallable TypeError)r0r]r^s`` r/set_servername_callbackz"SSLContext.set_servername_callbacks6  ' $D 01 788 H!(D r1ct}|D]`}t|d}t|dk(st|dkDr td|j t||j |b|j |y)Nr3rrLz)ALPN protocols must be 1 to 255 in length)rMrNrOrrPrQ_set_alpn_protocols)r0alpn_protocolsrTr-rUs r/set_alpn_protocolszSSLContext.set_alpn_protocolssq& Hh(A1v{c!fslJKK MM#a& ! MM!      (r1c t} t|D]0\}}}|dk(s |dus|j|vs |j|2 |r|j||S#t$rt j dY6wxYw)Nx509_asnTz-unable to enumerate Windows certificate store)cadata)rMrrrQPermissionErrorr)r*load_verify_locations)r0 storenamepurposecertscertencodingtrusts r/_load_windows_store_certsz$SSLContext._load_windows_store_certss  K):9)E +%hz)} u(< T*  +   & &e & 4  K MMI J KsA!A!A!!BBct|ts t|tjdk(r#|j D]}|j |||jy)Nr)r4r rasysplatform_windows_cert_storesrrset_default_verify_paths)r0rmrls r/load_default_certszSSLContext.load_default_certssV';/G$ $ <<7 "!66 C ..y'B C %%'r1minimum_versionc*tt|SrY)rDrryr0rs r/ryzSSLContext.minimum_versioneg56 6r1c|tjk(r$|xjtjzc_t t t j||yrY) rDrLoptionsr3 OP_NO_SSLv3rr#ry__set__r0valuers r/ryzSSLContext.minimum_versions? ((( !4!4 44 *j 9 A A$ Nr1c*tt|SrY)rDrmaximum_versionr{s r/rzSSLContext.maximum_version$r|r1cJttt j||yrY)rr#rrrs r/rzSSLContext.maximum_version(s *j 9 A A$ Nr1c*tt|SrY)r3rr~r{s r/r~zSSLContext.options,suw''r1cJttt j||yrY)rr#r~rrs r/r~zSSLContext.options0s j*-55dEBr1rcb|jtjz}|tjk7SrY _host_flagsrHr)r0ncss r/hostname_checks_common_namez&SSLContext.hostname_checks_common_name5s)""T%F%FFC$;;; ;r1c|r%|xjtjzc_y|xjtjzc_yrYr)r0rs r/rz&SSLContext.hostname_checks_common_name:s6  T%F%F$FF   D$E$EE r1cy)NTrWr0s r/rz&SSLContext.hostname_checks_common_nameAsr1c6t|}| |jSy)a9TLS message callback The message callback provides a debugging hook to analyze TLS connections. The callback is called for any TLS protocol message (header, handshake, alert, and more), but not for application data. Due to technical limitations, the callback can't be used to filter traffic or to abort a connection. Any exception raised in the callback is delayed until the handshake, read, or write operation has been performed. def msg_cb(conn, direction, version, content_type, msg_type, data): pass conn :class:`SSLSocket` or :class:`SSLObject` instance direction ``read`` or ``write`` version :class:`TLSVersion` enum member or int for unknown version. For a frame header, it's the header version. content_type :class:`_TLSContentType` enum member or int for unsupported content type. msg_type Either a :class:`_TLSContentType` enum number for a header message, a :class:`_TLSAlertType` enum member for an alert message, a :class:`_TLSMessageType` enum member for other messages, or int for unsupported message types. data Raw, decrypted message content as bytes N)r _msg_callback user_function)r0innerrs r/rzSSLContext._msg_callbackEs%B%  && &r1c#ttt j|dyt dst dfd}|_ttt j||y)N__call__z is not callable.c. t|} t|}|tjk(rt}n |tjk(rt }nt } ||}||||||S#t$rYgwxYw#t$rYjwxYw#t$rY6wxYwrY)rDrrYrerbrhr)conn directionversion content_typemsg_typedatamsg_enumcallbacks r/rz'SSLContext._msg_callback..innerus $W- .|< 555*!6!66(* #H-D)W((D: :'       s4 A* A9B* A65A69 BB BB)rr#rrhasattrrar)r0rrrs ` r/rzSSLContext._msg_callbacklsf   *j 7 ? ?d K x,xj(9:; ; :2' j*3;;D%Hr1c*tt|SrY)r'rr-r{s r/r-zSSLContext.protocols%'*++r1c*tt|SrY)r<r verify_flagsr{s r/rzSSLContext.verify_flagss57/00r1cJttt j||yrY)rr#rrrs r/rzSSLContext.verify_flagss j*2::4Gr1cRt|} t|S#t$r|cYSwxYwrY)r verify_moder?rrs r/rzSSLContext.verify_modes1# e$ $ L s  &&cJttt j||yrY)rr#rrrs r/rzSSLContext.verify_modes j*199$Fr1rY)FTTNN)FNN) rErFrGr`rvrArErr8rCrHrVrbrfrrrr rxrr propertyrysetterrr~rHrrr-rrrrs@r/r#r#s>)OO ,-2,0)-26 8=/3 ( ( ) *1)<)<({-.  7  7    O  O  7  7    O  O(( ^^CCt34  <  < % + + F , F    $$L#I#IJ,,11HHGGr1r#)rr rict|ts t||tjk(r"t t }t|_d|_ n.|tjk(rt t}n t||s|s|r|j|||n$|jtk7r|j|t!|drBt"j$j'd}|r!t(j*j,s||_|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. Tkeylog_filename SSLKEYLOGFILE)r4r rarr r#PROTOCOL_TLS_CLIENT CERT_REQUIREDrcheck_hostnamer!PROTOCOL_TLS_SERVERrrk CERT_NONErxrrrrrtflagsignore_environmentr)rmrr rir? keylogfiles r/create_default_contextrs g{ +  '%%%01+!% G'' '01!! 6%%fff=    ) ""7+w)*ZZ^^O4 cii::&0G # Nr1F) cert_reqsrrmcertfilekeyfilerr riclt|ts t||tjk(r |.t }n'|tj k(r |t}n t|t|} || _ ||| _ |rd| _ |r |s td|s|r| j|||s|s|r| j|||n$| jtk7r| j|t!| drBt"j$j'd} | r!t(j*j,s| | _| 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. Tzcertfile must be specifiedrr)r4r rarr rr!rrr#rrload_cert_chainrkrrxrrrrrtrrr) r-rrrmrrrr rir?rs r/_create_unverified_contextrs g{ +  '%%%  *H G'' '  *H!!"G+G'!%x5667'26%%fff=    ) ""7+w)*ZZ^^O4 cii::&0G # Nr1ceZdZdZdZe ddZedZejdZedZ e jdZ ed Z ed Z ed Z dd Zd ZddZdZdZdZdZdZdZdZdZddZdZdZy) SSLObjectaThis class implements an interface on top of a low-level SSL object as implemented by OpenSSL. This object captures the state of an SSL connection but does not provide any network IO itself. IO needs to be performed through separate "BIO" objects which are OpenSSL's IO abstraction layer. This class does not have a public constructor. Instances are returned by ``SSLContext.wrap_bio``. This class is typically used by framework authors that want to implement asynchronous IO for SSL through memory buffers. When compared to ``SSLSocket``, this object lacks the following features: * Any form of network IO, including methods such as ``recv`` and ``send``. * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery. cFt|jjd)NzU does not have a public constructor. Instances are returned by SSLContext.wrap_bio().rarrEr0r.r/s r/__init__zSSLObject.__init__s+~~&&'(L M  r1Ncd|j|}|j||||||}||_|S)N)r;r>ownerr@)r _wrap_bio_sslobj) rrFrGr;r>r@r?r0rZs r/rBzSSLObject._create$sD{{3"" hK+#    r1c.|jjS)z(The SSLContext that is currently in use.rr?rs r/r?zSSLObject.context0||###r1c&||j_yrYrr0ctxs r/r?zSSLObject.context5s" r1c.|jjS)z!The SSLSession for client socket.rr@rs r/r@zSSLObject.session9rr1c&||j_yrYrr0r@s r/r@zSSLObject.session>s& r1c.|jjS)z.Was the client session reused during handshakersession_reusedrs r/rzSSLObject.session_reusedBs||***r1c.|jjS)z%Whether this is a server-side socket.)rr;rs r/r;zSSLObject.server_sideGs||'''r1c.|jjS)z^The currently set server hostname (for SNI), or ``None`` if no server hostname is set.)rr>rs r/r>zSSLObject.server_hostnameLs||+++r1c|||jj||}|S|jj|}|S)zRead up to 'len' bytes from the SSL object and return them. If 'buffer' is provided, read into this buffer and return the number of bytes read. )rread)r0rObuffervs r/rzSSLObject.readRsB   !!#v.A !!#&Ar1c8|jj|S)zWrite 'data' to the SSL object and return the number of bytes written. The 'data' argument must support the buffer interface. )rwriter0rs r/rzSSLObject.write^s ||!!$''r1c8|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. )r getpeercertr0 binary_forms r/rzSSLObject.getpeercertfs||'' 44r1c<tjdtdy)zReturn the currently selected NPN protocol as a string, or ``None`` if a next protocol was not negotiated or if NPN is not supported by one of the peers.rJrrKN)r)r*r+rs r/selected_npn_protocolzSSLObject.selected_npn_protocolos  5  r1c6|jjS)zReturn the currently selected ALPN protocol as a string, or ``None`` if a next protocol was not negotiated or if ALPN is not supported by one of the peers.)rselected_alpn_protocolrs r/rz SSLObject.selected_alpn_protocolys||2244r1c6|jjS)z_Return the currently selected cipher as a 3-tuple ``(name, ssl_version, secret_bits)``.)rcipherrs r/rzSSLObject.ciphers||""$$r1c6|jjS)zReturn a list of ciphers shared by the client during the handshake or None if this is not a valid server connection. )rshared_ciphersrs r/rzSSLObject.shared_cipherss||**,,r1c6|jjS)zReturn the current compression algorithm in use, or ``None`` if compression was not negotiated or not supported by one of the peers.)r compressionrs r/rzSSLObject.compressions||''))r1c6|jjS)z8Return the number of bytes that can be read immediately.)rpendingrs r/rzSSLObject.pendings||##%%r1c8|jjy)zStart the SSL/TLS handshake.N)r do_handshakers r/rzSSLObject.do_handshakes !!#r1c6|jjS)z!Start the SSL shutdown handshake.)rshutdownrs r/unwrapzSSLObject.unwraps||$$&&r1c8|jj|S)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).)rget_channel_bindingr0cb_types r/rzSSLObject.get_channel_bindings||//88r1c6|jjS)zZReturn a string identifying the protocol version used by the current SSL channel. rrrs r/rzSSLObject.versions||##%%r1c6|jjSrY)rverify_client_post_handshakers r/rz&SSLObject.verify_client_post_handshakes||88::r1)FNNNNFr)rErFrGr`rrrBrr?rr@rr;r>rrrrrrrrrrrrrrrWr1r/rrs  5:=A  $$ ^^##$$ ^^''++((,, (5 5 % - * &$'9 & ;r1rcXtt|jj|_|S)z*Copy docstring from SSLObject to SSLSocket)getattrrrEr`)funcs r/ _sslcopydocrs9dmm4<r<r= getpeernamererrnoENOTCONN getblocking setblockingrecvEINVALrreasonlibrary settimeout _connected _wrap_socketrclose)rr:r;r<r=r>r?r@ sock_timeoutr/r0 connectedeblockingnotconn_pre_handshake_datar notconn_pre_handshake_data_errortimeoutrs r/rBzSSLSocket._creates ??:w /; >%&IJ J  "233" "/00  ! !/FG G( ;;TYYdjj;;= s{{3)&) i'1&1 C #DM#DM DLDL*D #*#;#;O#LD +BD ((D4;?C4<@>><@8.% @b       s%AJ9-G=BJ9 J6AJ1H#"J1# I%,/I J1 I%%|js|jyyrY)rrrs r/_check_connectedzSSLSocket._check_connected?s     r1cD|j|j td ||jj||S|jj|S#t$r4}|j dt k(r|jr |Yd}~yYd}~yd}~wwxYw)zORead up to LEN bytes and return them. Return zero-length string on EOF.Nz'Read on closed or unwrapped SSL socket.rr1)r/rrrrr. SSL_ERROR_EOFr=)r0rOrxs r/rzSSLSocket.readGs  << FG G !||((f55||((-- vvayM)d.G.G% s#A"A"" B+$BBBc|j|j td|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.)r/rrrrs r/rzSSLSocket.write\s;  << GH H||!!$''r1cx|j|j|jj|SrY)r/r1rrrs r/rzSSLSocket.getpeercertes/  ||'' 44r1c\|jtjdtdy)NrJrrK)r/r)r*r+rs r/rzSSLSocket.selected_npn_protocolks(  5  r1c|j|jtjsy|jj SrY)r/rrHrrrs r/rz SSLSocket.selected_alpn_protocolus4  << t}}<<668 8r1cp|j|jy|jjSrY)r/rrrs r/rzSSLSocket.cipher}s.  << <<&&( (r1cp|j|jy|jjSrY)r/rrrs r/rzSSLSocket.shared_cipherss.  << <<..0 0r1cp|j|jy|jjSrY)r/rrrs r/rzSSLSocket.compressions.  << <<++- -r1c|j|j8|dk7rtd|jz|jj |St |||S)Nrz3non-zero flags not allowed in calls to send() on %s)r/rrrrrsend)r0rrrs r/r=zSSLSocket.sendsd  << #z INN#$$<<%%d+ +7<e, ,r1c|j|jtd|jz|t|||St||||S)Nz%sendto not allowed on instances of %s)r/rrrrsendto)r0r flags_or_addrrrs r/r?zSSLSocket.sendtos^  << #D!^^,- - \7>$ 6 67>$ t<  YYfn )EF"34AQJEfn    7?4/ /     s$B7/B+ B7+B4 0B77Ccd|j|j|||St| |||S)zSend a file, possibly by using os.sendfile() if this is a clear-text socket. Return the total number of bytes sent. )r_sendfile_use_sendrsendfile)r0fileoffsetrrs r/rNzSSLSocket.sendfiles: << #**4? ?7#D&%8 8r1c|j|j.|dk7rtd|jz|j |St |||S)Nrz3non-zero flags not allowed in calls to recv() on %s)r/rrrrrrr0buflenrrs r/rzSSLSocket.recvs^  << #z INN#$$99V$ $7<. .r1c*|j|)|%t|5}|j}ddd|sd}nd}|j/|dk7rt d|j z|j ||St|!|||S#1swY\xYw)Nrrz8non-zero flags not allowed in calls to recv_into() on %s) r/rFnbytesrrrrr recv_into)r0rrUrrIrs r/rVzSSLSocket.recv_intos  >!')4![[F)!F << #z L..!""99VV, ,7$VVU; ;))s B  Bc|j|jtd|jzt|||S)Nz'recvfrom not allowed on instances of %s)r/rrrrrecvfromrRs r/rXzSSLSocket.recvfromsI  << #F!^^,- -7#FE2 2r1c|j|jtd|jzt||||S)Nz,recvfrom_into not allowed on instances of %s)r/rrrr recvfrom_into)r0rrUrrs r/rZzSSLSocket.recvfrom_intosK  << #K!^^,- -7(? ?r1c2td|jz)Nz&recvmsg not allowed on instances of %srBrs r/recvmsgzSSLSocket.recvmsgs!"J"&..#12 2r1c2td|jz)Nz+recvmsg_into not allowed on instances of %srBrs r/ recvmsg_intozSSLSocket.recvmsg_intos !#')-#89 9r1cp|j|j|jjSyNr)r/rrrs r/rzSSLSocket.pendings.  << #<<'') )r1cR|jd|_t| |yrY)r/rrr)r0howrs r/rzSSLSocket.shutdowns#   r1c|jr#|jj}d|_|Stdt|zNzNo SSL wrapper around )rrrr5)r0ss r/rzSSLSocket.unwrap s< << %%'ADLH5D AB Br1c||jr|jjStdt|zrd)rrrr5rs r/rz&SSLSocket.verify_client_post_handshakes1 <<<<<<> >5D AB Br1c0d|_t| yrY)rr _real_closer{s r/rhzSSLSocket._real_closes  r1c|j|j} |dk(r|r|jd|jj |j|y#|j|wxYw)Nr )r1r rrr)r0blockr%s r/rzSSLSocket.do_handshake!s] //# %#~%% LL % % ' OOG $DOOG $s 2A&&A9c|jr td|js |j td|jj |d|j ||j|_ |rt|%|}nd}t|)||s#d|_|jr|j|S#ttf$r d|_wxYw)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!FrT)r;rrrr?rr>rr connect_exconnectr<rr)r0rrlrcrs r/ _real_connectzSSLSocket._real_connect,s   @A A ??dll6NO O||00 %-- 1   W'-%"&//%%'I$ DL  s 6A CCc(|j|dy)QConnects to remote ADDR, and then wraps the connection in an SSL channel.FNror0rs r/rmzSSLSocket.connectFs 4'r1c&|j|dS)rqTrrrss r/rlzSSLSocket.connect_exKs!!$--r1ct|\}}|jj||j|j d}||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.T)r<r=r;)racceptr?rCr<r=)r0newsockrrs r/rvzSSLSocket.acceptPsQ ( ,,**7,0,H,H)-)B)B $+&}r1c|j|jj|S|tvrtdj |y)Nz({0} channel binding type not implemented)rrCHANNEL_BINDING_TYPESrrrs r/rzSSLSocket.get_channel_binding\sJ << #<<33G< <33 >EEgNr1cP|j|jjSyrYrrs r/rzSSLSocket.versiongs" << #<<'') )r1)FTTNNNrYrr)r)rN)rrr`r)0rErFrGr`rrrBrrr?rr@rr,r/r1rrrrrrrrr=r?rCrHrNrrVrXrZr\r^rrrrrhrrormrlrvrrrrs@r/rrs; FJ;?&*\\| ^^##(( ^^++ //; *(55 99))11.. -=2 0 9 /<&3@29 CCCC %%4( . r1rcddlm}ddlm}d}d} |j |ddj dz}||dd|}||d|f|d d zS#t $rt d |d |d wxYw)aReturn the time in seconds since the Epoch, given the timestring representing the "notBefore" or "notAfter" date from a certificate in ``"%b %d %H:%M:%S %Y %Z"`` strptime format (C locale). "notBefore" or "notAfter" dates must use UTC (RFC 5280). Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec UTC should be specified as GMT (see ASN1_TIME_print()) r)strptime)timegm) JanFebMarAprMayJunJulAugSepOctNovDecz %d %H:%M:%S %Y GMTNrrrrz time data z does not match format "%b")timer|calendarr}indextitler) cert_timer|r}months time_format month_numbertts r/cert_time_to_secondsrvsF(K 7||IbqM$7$7$9:Q> im[ 1r!ul+b1g566 F-6 EF FFs %AA2z-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----cttj|dd}tg}|t dt |dDcgc] }|||dz c}z }|j tdzdj|Scc}w)z[Takes a certificate in binary DER format and returns the PEM version of it as a string.ASCIIstrictr@ ) r5base64standard_b64encode PEM_HEADERrangerOrP PEM_FOOTERjoin)der_cert_bytesfssis r/DER_cert_to_PEM_certrst F % %n 5wIA BeAs1vr2 31Qqt9 33BIIj4 99R= 4sA>c`|jtstdtz|jj t stdt z|jt tt t  }tj|jddS)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) r,rrstripendswithrrOr decodebytesr6)pem_cert_stringds r/PEM_cert_to_DER_certrs  % %j 1C%&' '  " + +J 7A%&' 'JZ0@AA   ahhw9 ::r1c&|\}}|t}nt}t|||}t||5}|j ||5} | j d} ddddddt  S#1swYxYw#1swYt  SxYw)a=Retrieve 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. If 'timeout' is specified, use it in the connection attempt. N)rr)r%)r>T)rr_create_stdlib_contextrrCrr) r ssl_versionca_certsr%hostportrr?r:sslsockdercerts r/get_server_certificatersJD$!  $[/8,46G 4 10T  t < 0))$/G 00  (( 0 00  ((s#A=A1A=1A: 6A==Bc.tj|dS)Nz )_PROTOCOL_NAMESr) protocol_codes r/get_protocol_namers   }k ::r1rY)mr`rtr collectionsrenumr_Enumr_IntEnumr_IntFlagrrHrr r r r r rrrrrrrrrrrrrrr ImportErrorrrrrrr r!r"r#r$r%r& _convert_rEr'r,r* __members__itemsrr_SSLv2_IF_EXISTSrDrYrhrrurrrrrrrrrrrr)r socket_errorryrHAS_NEVER_CHECK_COMMON_NAME_RESTRICTED_SERVER_CIPHERSrrrrrrr rr#r rrr_create_default_https_contextrrrrrArErrrrrrrr)r.rs00r/rs[Xt "HH NN33:22  8(K   x'  6  h.  8+  ()  0:/F/FF*,2<2H2H2N2N2PQ;45$;Q:'7>h555h   h&"&"&"Rh   :<<7199??  %%d,JK.+.>b DF  4 &@*],HI@*&k5&BGBGJ$+#6#6$$"&t$L49*/9L9L$($"&tD4n!74X;X;v ||@' &  7<+ (  ;.A$(2I),;i*  TRsJ&> J2&J/.J/