ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //opt/alt/python311/lib64/python3.11/__pycache__/ssl.cpython-311.opt-1.pyc

h!
dZddlZddlZddlmZddlmZmZ	m
ZddlmZddl
Z
ddl
mZmZmZddl
mZmZmZddl
mZmZmZmZmZmZmZdd	l
mZmZdd
l
mZm Z m!Z!m"Z"	ddl
m#Z#n#e$$rYnwxYwdd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/m0Z0e	j1de2de
ej1de2de
e	j1de2de
e	j1de2de
ej1de2de
e	j1de2de
e3j4xZ5e3_5de3j67DZ8e9e3ddZ:ee	GddZ;ee	Gdd Z<ee	Gd!d"Z=ee	Gd#d$Z>ej?d%krdd&l
m@Z@mAZAdd'lBmBZBmCZCmDZDdd(lBmEZEmFZFmGZGddlBZHddlIZIddlJZJddlKZKeLZMd)gZNeOe
d*ZPe/ZQeZRd+ZSd,ZTd-ZUd.ZVed/d0ZWd1ZXGd2d3ed3d4ZYGd5d6eYeZZGd7d8eZ[eZj\fdddd9d:Z]dLe^d;eZj\dddddd<d=Z_e]Z`e_ZaGd>d?Zbd@ZcGdAdBeBZdede[_eebe[_fddd;e^e4ddCdCdf	dDZgdEZhdFZidGZjdHZkdIZlemdeGfdJZndKZodS)Ma
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)SSLErrorSSLZeroReturnErrorSSLWantReadErrorSSLWantWriteErrorSSLSyscallErrorSSLEOFErrorSSLCertVerificationError)txt2objnid2obj)RAND_statusRAND_add
RAND_bytesRAND_pseudo_bytes)RAND_egd)
HAS_SNIHAS_ECDHHAS_NPNHAS_ALPN	HAS_SSLv2	HAS_SSLv3	HAS_TLSv1HAS_TLSv1_1HAS_TLSv1_2HAS_TLSv1_3)_DEFAULT_CIPHERS_OPENSSL_API_VERSION
_SSLMethodc8|do|dkS)N	PROTOCOL_PROTOCOL_SSLv23
startswithnames */opt/alt/python311/lib64/python3.11/ssl.py<lambda>r1}s--K$:K2K)sourceOptionsc,|dS)NOP_r,r.s r0r1r1s''r2AlertDescriptionc,|dS)NALERT_DESCRIPTION_r,r.s r0r1r1s!566r2SSLErrorNumberc,|dS)N
SSL_ERROR_r,r.s r0r1r1s..r2VerifyFlagsc,|dS)NVERIFY_r,r.s r0r1r1s++r2
VerifyModec,|dS)NCERT_r,r.s r0r1r1s))r2ci|]\}}||	SrD).0r/values   r0
<dictcomp>rGsQQQ;45$QQQr2PROTOCOL_SSLv2cpeZdZejZejZejZ	ej
ZejZ
ejZejZdS)
TLSVersionN)__name__
__module____qualname___sslPROTO_MINIMUM_SUPPORTEDMINIMUM_SUPPORTEDPROTO_SSLv3SSLv3PROTO_TLSv1TLSv1
PROTO_TLSv1_1TLSv1_1
PROTO_TLSv1_2TLSv1_2
PROTO_TLSv1_3TLSv1_3PROTO_MAXIMUM_SUPPORTEDMAXIMUM_SUPPORTEDrDr2r0rJrJsJ4EE G G G4r2rJc*eZdZdZdZdZdZdZdZdZ	dS)	_TLSContentTypez@Content types (record layer)

    See RFC 8446, section B.1
    N)
rKrLrM__doc__CHANGE_CIPHER_SPECALERT	HANDSHAKEAPPLICATION_DATAHEADERINNER_CONTENT_TYPErDr2r0r^r^s=EI
Fr2r^ceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$S)%
_TLSAlertTypezQAlert types for TLSContentType.ALERT messages

    See RFC 8466, section B.2
    r
r_r`ra()*+,-./0123<FGPVZdmnopqrstxN)&rKrLrMre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_PROTOCOLrDr2r0rmrmsLNONO JMLMNM"&)#!$!r2rmcjeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdS)_TLSMessageTypezFMessage types (handshake protocol)

    See RFC 8446, section B.3
    r
r_r`rarbCrdN)rKrLrMre
HELLO_REQUESTCLIENT_HELLOSERVER_HELLOHELLO_VERIFY_REQUESTNEWSESSION_TICKETEND_OF_EARLY_DATAHELLO_RETRY_REQUESTENCRYPTED_EXTENSIONSCERTIFICATESERVER_KEY_EXCHANGECERTIFICATE_REQUESTSERVER_DONECERTIFICATE_VERIFYCLIENT_KEY_EXCHANGEFINISHEDCERTIFICATE_URLCERTIFICATE_STATUSSUPPLEMENTAL_DATA
KEY_UPDATE
NEXT_PROTOMESSAGE_HASHrfrDr2r0rrsMLLKKHOJJLr2rwin32)enum_certificates	enum_crls)socketSOCK_STREAMcreate_connection)
SOL_SOCKETSO_TYPE_GLOBAL_DEFAULT_TIMEOUT
tls-uniqueHOSTFLAG_NEVER_CHECK_SUBJECTc|sdS|d}|s*||kS|dkr"td||d\}}}d|vr"td||s"td||dkr"td||d\}}}|r|sdS||kS)	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}.z<partial wildcards in leftmost label are not supported: {!r}.)countlowerCertificateErrorformat	partition)dnhostname	wildcardsdn_leftmostsepdn_remainderhostname_leftmosthostname_remainders        r0_dnsname_matchrslu

I.xxzzX^^----1}}?FFrJJLL	L&(\\#%6%6"Kl
l
F2JJ  	  
F2JJ  	 c
F2JJ  	 2:1C1CC1H1H.s.Cu#5#;#;#=#===r2c	tj|}tj||kr|Std|#t
$rYnwxYw	tjtj|S#t
$r#td|t$rYnwxYwtd|)zTry to convert an IP address to packed binary form

    Supports IPv4 addresses on all platforms and IPv6 on platforms with IPv6
    support.
    z'{!r} is not a quad-dotted IPv4 address.z+{!r} is neither an IPv4 nor an IP6 address.z{!r} is not an IPv4 address.)	_socket	inet_aton	inet_ntoa
ValueErrorrOSError	inet_ptonAF_INET6AttributeError)ipnameaddrs  r0_inet_patonrIs	
 ((
T""f,,K9@@HH





 !16:::444$$*F6NN44	4



3::6BB
C
CCs#A
AA#B5B:9B:cPt|}||kS)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   r0_ipaddress_matchrls'
^**,,	-	-B
=r2c^tjdtd|std	t	|}n#t$rd}YnwxYwg}|dd}|D]f\}}|dkr+|t
||rdS||6|d	kr*|t||rdS||g|sP|d
dD]9}|D]4\}}|dkr)t
||rdS||5:t|dkr;td
|ddtt|t|dkrtd
|d|dtd)aVerify that *cert* (in decoded format as returned by
    SSLSocket.getpeercert()) matches the *hostname*.  RFC 2818 and RFC 6125
    rules are followed.

    The function matches IP addresses rather than dNSNames if hostname is a
    valid ipaddress string. IPv4 addresses are supported on all platforms.
    IPv6 addresses are supported on platforms with IPv6 support (AF_INET6
    and inet_pton).

    CertificateError is raised on failure. On success, the function
    returns nothing.
    z"ssl.match_hostname() is deprecatedrcategory
stacklevelztempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDNsubjectAltNamerDDNSz
IP Addresssubject
commonNamerz	hostname z doesn't match either of z, z doesn't match rz=no appropriate commonName or subjectAltName fields were found)warningswarnDeprecationWarningrrgetrappendrlenrjoinmaprepr)certrrdnsnamessankeyrFsubs        r0match_hostnamerxs>
M,#
;:;;	;h''H
((#R
(
(C##
U%<<>%#B#BOOE""""
L
 
 "'7w'G'G"OOE"""
+88Ir**	+	+C!
+
+
U,&&%eX66OOE***

+8}}qxx3tX#6#6777 9::	:

X!		xx! &''	' /00	0s?A
ADefaultVerifyPathszQcafile capath openssl_cafile_env openssl_cafile openssl_capath_env openssl_capathcxtj}tj|d|d}tj|d|d}ttj|r|ndtj|r|ndg|RS)z/Return paths to default cafile and capath.
    rrrrN)	rNget_default_verify_pathsosenvironrrpathisfileisdir)partscafilecapaths   r0rrs
)++EZ^^E!HeAh
/
/F
Z^^E!HeAh
/
/Fv(>(>HffD(*

f(=(=Gff4&$&&&&r2cZeZdZdZdZfdZefdZefdZxZ	S)_ASN1Objectz#ASN.1 object identifier lookup
    rDcVtj|gt|dRS)NFr.super__new___txt2obj)clsoid	__class__s  r0r*z_ASN1Object.__new__s.uwws?Xc%>%>%>????r2cRtj|gt|RS)z3Create _ASN1Object from OpenSSL numeric ID
        )r)r*_nid2obj)r,nidr.s  r0fromnidz_ASN1Object.fromnids)uwws3Xc]]3333r2cVtj|gt|dRS)z=Create _ASN1Object from short name, long name or OID
        Tr.r()r,r/r.s  r0fromnamez_ASN1Object.fromnames0uwws?Xd%>%>%>????r2)
rKrLrMre	__slots__r*classmethodr2r4
__classcell__r.s@r0r&r&sI@@@@@4444[4
@@@@[@@@@@r2r&znid shortname longname oidceZdZdZdZdZdS)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)rKrLrMreSERVER_AUTHCLIENT_AUTHrDr2r0r:r:s"%K%KKKr2r:ceZdZdZdZdZdZd!dZdZ				d"dZ			d#d	Z
d
ZdZdZ
d
ZejfdZeedr>efdZejfdZefdZejfdZefdZejfdZeedredZejdZnedZefdZejfdZefdZefdZejfdZefdZejfd ZxZS)$
SSLContextz|An SSLContext holds various SSL-related configuration options and
    data, such as certificates and possibly a private key.)CAROOTNcz|#tjdtdt}t	j||}|S)Nz9ssl.SSLContext() without protocol argument is deprecated.rr)rrr
PROTOCOL_TLSrr*)r,protocolargskwargsselfs     r0r*zSSLContext.__new__sHMK+




$H"311r2c|dSt|tr(|ddS|dS)Nidnaascii)
isinstancestrencodedecode)rFrs  r0_encode_hostnamezSSLContext._encode_hostnamesQ4
#
&
&	,??6**11':::??7+++r2FTc	D|j|||||||S)N)sockserver_sidedo_handshake_on_connectsuppress_ragged_eofsserver_hostnamecontextsession)sslsocket_class_create)rFrPrQrRrSrTrVs       r0wrap_socketzSSLContext.wrap_sockets9#++#$;!5+,

	
r2ch|j|||||||S)N)rQrTrVrU)sslobject_classrXrN)rFincomingoutgoingrQrTrVs      r0wrap_biozSSLContext.wrap_biosA#++hK 11/BBT,

	
r2ctjdtdt}|D]~}t	|d}t|dkst|dkrt
d|t||||	|dS)N'ssl NPN is deprecated, use ALPN insteadrrrIrz(NPN protocols must be 1 to 255 in length)
rrr
	bytearraybytesrrrextend_set_npn_protocols)rF
npn_protocolsprotosrCbs     r0set_npn_protocolszSSLContext.set_npn_protocolss
5	
	
	
	

%		Hh((A1vv{{c!ffsllIJJJMM#a&&!!!MM!'''''r2cv	d_dStstdfd}|_dS)Nznot a callable objectcH|}|||SN)rN)sslobj
servernamesslctxrFserver_name_callbacks   r0shim_cbz3SSLContext.set_servername_callback.<locals>.shim_cb0s+!22:>>
++FJGGGr2)sni_callbackcallable	TypeError)rFrqrrs`` r0set_servername_callbackz"SSLContext.set_servername_callback)sl' $D011
9 7888
H
H
H
H
H
H!(Dr2cNt}|D]~}t|d}t|dkst|dkrtd|t|||||dS)NrIrrbz)ALPN protocols must be 1 to 255 in length)rcrdrrrre_set_alpn_protocols)rFalpn_protocolsrhrCris     r0set_alpn_protocolszSSLContext.set_alpn_protocols6s&		Hh((A1vv{{c!ffsllJKKKMM#a&&!!!MM!  (((((r2ct}	t|D].\}}}|dkr"|dus	|j|vr||/n$#t$rtjdYnwxYw|r|||S)Nx509_asnTz-unable to enumerate Windows certificate store)cadata)rcrr-rePermissionErrorrrload_verify_locations)rF	storenamepurposecertsrencodingtrusts       r0_load_windows_store_certsz$SSLContext._load_windows_store_certsAs	K):9)E)E
+
+%hz))}}u(<(<T***	
+
	K	K	KMIJJJJJ	K	5&&e&444s>AA0/A0ct|tst|tjdkr |jD]}||||dS)Nr)rJr&rusysplatform_windows_cert_storesrset_default_verify_paths)rFrrs   r0load_default_certszSSLContext.load_default_certsOst';//	%G$$$<7""!6
C
C	..y'BBBB%%'''''r2minimum_versioncDttjSrm)rJr)rrFr.s r0rzSSLContext.minimum_versionXegg5666r2c|tjkr|xjtjzc_tttj||dSrm)	rJrRoptionsr4OP_NO_SSLv3r)r>r__set__rFrFr.s  r0rzSSLContext.minimum_version\sP
(((!4 44*j))9AA$NNNNNr2cDttjSrm)rJr)maximum_versionrs r0rzSSLContext.maximum_versionbrr2cntttj||dSrm)r)r>rrrs  r0rzSSLContext.maximum_versionfs,*j))9AA$NNNNNr2cDttjSrm)r4r)rrs r0rzSSLContext.optionsjsuww'''r2cntttj||dSrm)r)r>rrrs  r0rzSSLContext.optionsns,
j*%%-55dEBBBBBr2rcJ|jtjz}|tjkSrm_host_flagsrNr)rFncss  r0hostname_checks_common_namez&SSLContext.hostname_checks_common_namess "T%FFC$;;;r2cx|r|xjtjzc_dS|xjtjzc_dSrmr)rFrFs  r0rz&SSLContext.hostname_checks_common_namexsH
F  T%F$FF      D$EE    r2cdS)NTrDrFs r0rz&SSLContext.hostname_checks_common_names4r2c@tj}||jSdS)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)rFinnerr.s  r0rzSSLContext._msg_callbacks&B%&&4r2c:5tttj|ddSt	dstdfd}|_tttj||dS)N__call__z is not callable.cP	t|}n#t$rYnwxYw	t|}n#t$rYnwxYw|tjkrt}n|tjkrt
}nt}	||}n#t$rYnwxYw||||||Srm)rJrr^rjrgrmr)conn	directionversioncontent_typemsg_typedatamsg_enumcallbacks       r0rz'SSLContext._msg_callback.<locals>.inners
$W--




.|<<



555*!666(*
#8H--



8D)W((D::
:s-
  4
AA<B
BB)r)r>rrhasattrrur)rFrrr.s ` r0rzSSLContext._msg_callbacks*j))7??dKKKFx,,	<x:::;;;	:	:	:	:	:2'
j*%%3;;D%HHHHHr2cDttjSrm)r(r)rCrs r0rCzSSLContext.protocols%''*+++r2cDttjSrm)r=r)verify_flagsrs r0rzSSLContext.verify_flagss577/000r2cntttj||dSrm)r)r>rrrs  r0rzSSLContext.verify_flagss,
j*%%2::4GGGGGr2cntj}	t|S#t$r|cYSwxYwrm)r)verify_moder@rrs  r0rzSSLContext.verify_modesF#	e$$$			LLL	s%44cntttj||dSrm)r)r>rrrs  r0rzSSLContext.verify_modes,
j*%%199$FFFFFr2rm)FTTNN)FNN) rKrLrMrerrWr[r*rNrYr^rjrvrzrr:r;rrrpropertyrsetterrrrNrrrCrrr7r8s@r0r>r>s>>)OO				,,,-2,0)-26



 8=/3



((( (((	)	)	)*1)<((((w{-..O		7	7	7	7
	7
		O	O	O	O
 		O

	7	7	7	7
	7
		O	O	O	O
 		O((((X(
^CCCC^Cwt344		<	<
	<
%	+	F	F
,	+	F	F
		
	$$$$X$L#I#I#I#I#IJ,,,,X,1111X1HHHHHXGGGGGGGGGr2r>)r#r$r}c>t|tst||tjkr(tt}t|_d|_	n4|tj
krtt}nt||s|s|r|
|||n%|jtkr||t!|dr9t"jd}|rt(jjs||_|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)rJr&rur:r;r>PROTOCOL_TLS_CLIENT
CERT_REQUIREDrcheck_hostnamer<PROTOCOL_TLS_SERVERrr	CERT_NONErrrrrrflagsignore_environmentr)rr#r$r}rU
keylogfiles      r0create_default_contextrsg{++!   
'%%%011+!%	G'	'	'011!!!
,,6,%%fff====				)	)	""7+++w)**1Z^^O44
	1ci:	1&0G#Nr2F)	cert_reqsrrcertfilekeyfiler#r$r}ct|tst||tjkr
|t
}n)|tjkr
|t}nt|t|}	||	_
|||	_|rd|	_
|r|std|s|r|	|||s|s|r|	
|||n%|	jtkr|	|t!|	dr9t"jd}
|
rt(jjs|
|	_|	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.
    NTcertfile must be specifiedrr)rJr&rur:r;rr<rrr>rrload_cert_chainrrrrrrrrrrr)rCrrrrrr#r$r}rUrs           r0_create_unverified_contextrs|g{++!   
'%%%*H	G'	'	'*H!!!""G+G'&!%7x75666373'222,,6,%%fff====				)	)	""7+++w)**1Z^^O44
	1ci:	1&0G#Nr2c<eZdZdZdZe		ddZedZej	dZedZ
e
j	d	Z
ed
ZedZedZ
ddZdZddZdZdZdZdZdZdZdZdZd dZdZdZdS)!	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.
    c:t|jjd)NzU does not have a public constructor. Instances are returned by SSLContext.wrap_bio().rur.rKrFrDrEs   r0__init__zSSLObject.__init__\s.~&
M
M
M

	
r2FNct||}|||||||}||_|S)N)rQrTownerrV)r*	_wrap_bio_sslobj)	r,r\r]rQrTrVrUrFrns	         r0rXzSSLObject._createbsL{{3""hK+#


r2c|jjS)z(The SSLContext that is currently in use.rrUrs r0rUzSSLObject.contextn|##r2c||j_dSrmrrFctxs  r0rUzSSLObject.contextss"r2c|jjS)z!The SSLSession for client socket.rrVrs r0rVzSSLObject.sessionwrr2c||j_dSrmrrFrVs  r0rVzSSLObject.session|s&r2c|jjS)z.Was the client session reused during handshakersession_reusedrs r0rzSSLObject.session_reuseds|**r2c|jjS)z%Whether this is a server-side socket.)rrQrs r0rQzSSLObject.server_sides|''r2c|jjS)z^The currently set server hostname (for SNI), or ``None`` if no
        server hostname is set.)rrTrs r0rTzSSLObject.server_hostnames|++r2cv||j||}n|j|}|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)rFrbuffervs    r0rzSSLObject.reads=!!#v..AA!!#&&Ar2c6|j|S)zWrite 'data' to the SSL object and return the number of bytes
        written.

        The 'data' argument must support the buffer interface.
        )rwriterFrs  r0rzSSLObject.writes|!!$'''r2c6|j|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.
        )rgetpeercertrFbinary_forms  r0rzSSLObject.getpeercerts|''444r2c>tjdtddS)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.r`rraN)rrr
rs r0selected_npn_protocolzSSLObject.selected_npn_protocols0	
5	
	
	
	
	
	
r2c4|jS)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 r0rz SSLObject.selected_alpn_protocols|22444r2c4|jS)z_Return the currently selected cipher as a 3-tuple ``(name,
        ssl_version, secret_bits)``.)rcipherrs r0rzSSLObject.ciphers|""$$$r2c4|jS)zReturn a list of ciphers shared by the client during the handshake or
        None if this is not a valid server connection.
        )rshared_ciphersrs r0rzSSLObject.shared_cipherss|**,,,r2c4|jS)zReturn the current compression algorithm in use, or ``None`` if
        compression was not negotiated or not supported by one of the peers.)rcompressionrs r0rzSSLObject.compressions|'')))r2c4|jS)z8Return the number of bytes that can be read immediately.)rpendingrs r0rzSSLObject.pendings|##%%%r2c8|jdS)zStart the SSL/TLS handshake.N)rdo_handshakers r0rzSSLObject.do_handshakes!!#####r2c4|jS)z!Start the SSL shutdown handshake.)rshutdownrs r0unwrapzSSLObject.unwraps|$$&&&r2rc6|j|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_bindingrFcb_types  r0rzSSLObject.get_channel_bindings|//888r2c4|jS)zZReturn a string identifying the protocol version used by the
        current SSL channel. rrrs r0rzSSLObject.versions|##%%%r2c4|jSrm)rverify_client_post_handshakers r0rz&SSLObject.verify_client_post_handshakes|88:::r2)FNNNrNFr)rKrLrMrerr6rXrrUrrVrrQrTrrrrrrrrrrrrrrrDr2r0rrMs




5:=A			[	$$X$
^##^#$$X$
^''^'++X+((X(,,X,




(((5555


555%%%
---***
&&&$$$'''9999&&&
;;;;;r2rcNtt|jj|_|S)z*Copy docstring from SSLObject to SSLSocket)getattrrrKre)funcs r0_sslcopydocrs9dm44<DLKr2ceZdZdZdZe			d1fd	ZeedZ	e	j
dZ	eed	Zej
d
ZeedZdZ
d2d
ZdZd3dZdZed4dZedZedZedZedZedZd5fd	Zd2fd	ZdZd5fd	Zd6fd	Zd7fd	Zd8fd	Zd7fd 	Zd8fd!	Z d"Z!d#Z"ed$Z#fd%Z$ed&Z%ed'Z&fd(Z'ed4d)Z(fd*Z)d+Z*d,Z+fd-Z,ed9d/Z-ed0Z.xZ/S):	SSLSocketzThis 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. c:t|jjd)NzX does not have a public constructor. Instances are returned by SSLContext.wrap_socket().rrs   r0rzSSLSocket.__init__s+~&
)
)
)

	
r2FTNc|tttkrt	d|r"|rtd|td|jr|std|}t|j	|j
|j|}	|j
|fi|	}
tt|
jdi|	|	||
_||
_d|
_d|
_||
_|||
_||
_||
_	|
d}n#t8$r}|jt:jkrd}|
}
|
 d	|
!d}n9#t8$r,}|jt:jt:j"fvrd	}Yd}~nd}~wwxYw|
 |
|r/d
}tG|j|}||_$d|_%	|#d}wxYwYd}~nd}~wwxYw|
&|||
_'|rm|
j(|
||
j|
|
j|
_|r=|
}|dkrtd
|
)n,#	|
*n#t8$rYnwxYwxYw|
S)Nz!only stream sockets are supportedz4server_hostname can only be specified in client modez,session can only be specified in client modez'check_hostname requires server_hostname)familytypeprotofilenoFTrr2z5Closed before TLS handshake with data in recv buffer.rrVzHdo_handshake_on_connect should not be specified for non-blocking socketsrD)+
getsockoptrrrNotImplementedErrorrr
gettimeoutdictrrrrr*r)rrdetach_context_session_closedrrQrNrTrRrSgetpeernamererrnoENOTCONNgetblockingsetblockingrecvEINVALrreasonlibrary
settimeout
_connected_wrap_socketrclose)r,rPrQrRrSrTrUrVsock_timeoutrErF	connectedeblockingnotconn_pre_handshake_datar, notconn_pre_handshake_data_errortimeoutr.s                  r0rXzSSLSocket._creates??:w//;>>%&IJJJ	0
3 "2333" "/000!	H/	HFGGG((;TYdj;;==


s{3))&))'i'11&111


C	#DM#DM DLDL*D#*#;#;O#L#LD +BD((<D%#
!  """D!		C
@
@
@7en,,!	++--  '''
5
261..555wu~u|&DDD14......	5
  ***-
@UF7?7P7P4>D4;?C4<@>><@8????
@
@
@
@
@%
@F
OOL)))'DO
(#}99+t';
 :  +("oo//G#~~()sttt%%'''	






sAK
E$!K$
I.AI
0GI

G<"G72I
7G<<?I
<H>>II
K
IBKL!K65L6
LLLLc|jSrm)r"rs r0rUzSSLSocket.contextYs}r2c,||_||j_dSrm)r"rrUrs  r0rUzSSLSocket.context^s
"r2c,|j|jjSdSrmrrs r0rVzSSLSocket.sessioncs<#<''$#r2c>||_|j||j_dSdSrm)r#rrVrs  r0rVzSSLSocket.sessionis)
<##*DL   $#r2c,|j|jjSdSrmrrs r0rzSSLSocket.session_reusedos<#<..$#r2c:td|jjz)NzCan't dup() %s instances)rr.rKrs r0dupz
SSLSocket.dupus$!"<"&."9#:;;	;r2cdSrmrD)rFmsgs  r0_checkClosedzSSLSocket._checkClosedysr2c@|js|dSdSrm)r/r%rs r0_check_connectedzSSLSocket._check_connected}s0	

		r2rcB||jtd	||j||S|j|S#t$r1}|jdtkr|jr|Yd}~dSYd}~dSd}~wwxYw)zORead up to LEN bytes and return them.
        Return zero-length string on EOF.Nz'Read on closed or unwrapped SSL socket.rr2)rBrrrrrD
SSL_ERROR_EOFrS)rFrrxs    r0rzSSLSocket.reads	
<FGGG	!|((f555|((---			vayM))d.G)%1111133333	s#A#	A##
B-BBBc||jtd|j|S)zhWrite DATA to the underlying SSL channel.  Returns
        number of bytes of DATA actually transmitted.Nz(Write on closed or unwrapped SSL socket.)rBrrrrs  r0rzSSLSocket.writesC	
<GHHH|!!$'''r2c|||j|Srm)rBrDrrrs  r0rzSSLSocket.getpeercerts<|''444r2cf|tjdtddS)Nr`rra)rBrrr
rs r0rzSSLSocket.selected_npn_protocols=
5	
	
	
	

tr2c||jtjsdS|jSrm)rBrrNrrrs r0rz SSLSocket.selected_alpn_protocols<<t}4<66888r2cn||jdS|jSrm)rBrrrs r0rzSSLSocket.ciphers5<4<&&(((r2cn||jdS|jSrm)rBrrrs r0rzSSLSocket.shared_cipherss5<4<..000r2cn||jdS|jSrm)rBrrrs r0rzSSLSocket.compressions5<4<++---r2rc||j7|dkrtd|jz|j|St||S)Nrz3non-zero flags not allowed in calls to send() on %s)rBrrr.rr)send)rFrrr.s   r0rPzSSLSocket.sendsu<#zz IN#$$$<%%d+++77<<e,,,r2c||jtd|jz|"t	||St	|||S)Nz%sendto not allowed on instances of %s)rBrrr.r)sendto)rFr
flags_or_addrrr.s    r0rRzSSLSocket.sendtoss<#D!^,--
-
\77>>$
66677>>$
t<<<r2c0td|jz)Nz&sendmsg not allowed on instances of %srr.rs   r0sendmsgzSSLSocket.sendmsgs#""J"&.#122	2r2c||j|dkrtd|jzd}t	|5}|d5}t
|}||kr(|||d}||z
}||k(dddn#1swxYwYddddS#1swxYwYdSt	||S)Nrz6non-zero flags not allowed in calls to sendall() on %sB)
rBrrr.
memoryviewcastrrPr)sendall)	rFrrrview	byte_viewamountrr.s	        r0r[zSSLSocket.sendallsx<#zz LN#$$$ED!!
T499S>>
YYfnn		)EFF"344AQJEfnn
































77??4///s6C!>B+C+B/	/C2B/	3CC
Cc|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_sendr)sendfile)rFfileoffsetrr.s    r0razSSLSocket.sendfilesC<#**4???77##D&%888r2c||j2|dkrtd|jz||St||S)Nrz3non-zero flags not allowed in calls to recv() on %s)rBrrr.rr)r*rFbuflenrr.s   r0r*zSSLSocket.recvsq<#zz IN#$$$99V$$$77<<...r2cX||7|3t|5}|j}dddn#1swxYwY|sd}nd}|j3|dkrt	d|jz|||St|||S)Nrrz8non-zero flags not allowed in calls to recv_into() on %s)	rBrYnbytesrrr.rr)	recv_into)rFrrhrr\r.s     r0rizSSLSocket.recv_intos>!'')4![F)))))))))))))))"!F<#zz L.!"""99VV,,,77$$VVU;;;s=AAc||jtd|jzt	||S)Nz'recvfrom not allowed on instances of %s)rBrrr.r)recvfromres   r0rkzSSLSocket.recvfrom&sX<#F!^,--
-77##FE222r2c||jtd|jzt	|||S)Nz,recvfrom_into not allowed on instances of %s)rBrrr.r)
recvfrom_into)rFrrhrr.s    r0rmzSSLSocket.recvfrom_into.sZ<#K!^,--
-77((???r2c0td|jz)Nz&recvmsg not allowed on instances of %srUrs   r0recvmsgzSSLSocket.recvmsg6s!!"J"&.#122	2r2c0td|jz)Nz+recvmsg_into not allowed on instances of %srUrs   r0recvmsg_intozSSLSocket.recvmsg_into:s#!#')-#899	9r2cn||j|jSdSNr)rBrrrs r0rzSSLSocket.pending>s5<#<'')))1r2c|d|_t|dSrm)rBrr)r)rFhowr.s  r0rzSSLSocket.shutdownFs:
r2c|jr"|j}d|_|Stdt|zNzNo SSL wrapper around )rrrrK)rFss  r0rzSSLSocket.unwrapKsF<	C%%''ADLH5D		ABBBr2c|jr|jStdt|zrw)rrrrKrs r0rz&SSLSocket.verify_client_post_handshakeTs;<	C<<<>>>5D		ABBBr2cVd|_tdSrm)rr)_real_closers r0r{zSSLSocket._real_close[s&
r2c"||}	|dkr|r|d|j||dS#||wxYw)Nr)rDrr.rr)rFblockr8s   r0rzSSLSocket.do_handshake_s//##	%#~~%~%%%L%%'''OOG$$$$$DOOG$$$$s6A77Bc|jrtd|js|jtd|j|d|j||j|_	|r"t	|}n#d}t
||s"d|_|jr||S#ttf$r	d|_wxYw)Nz!can't connect in server-side modez/attempt to connect already-connected SSLSocket!FrT)rQrr/rrUr0rTr#r)
connect_exconnectrRrr)rFrrrcr.s    r0
_real_connectzSSLSocket._real_connectjs	B@AAA?	Pdl6NOOO|00%-
1


	
&WW''--%%%
("&/(%%'''I$			DL	s
$A,CC+c2||ddS)QConnects to remote ADDR, and then wraps the connection in
        an SSL channel.FNrrFrs  r0rzSSLSocket.connects 	
4'''''r2c.||dS)rTrrs  r0rzSSLSocket.connect_exs!!$---r2ct\}}|j||j|jd}||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)rRrSrQ)r)acceptrUrYrRrS)rFnewsockrr.s   r0rzSSLSocket.acceptsU
((
,**7,0,H)-)B $+&&}r2rc|j|j|S|tvr"td|dS)Nz({0} channel binding type not implemented)rrCHANNEL_BINDING_TYPESrrrs  r0rzSSLSocket.get_channel_bindingsV<#<33G<<<333 >EEgNN4r2cF|j|jSdSrmr	rs r0rzSSLSocket.versions#<#<'')))4r2)FTTNNNrmrr
)r)rN)rrrsr)0rKrLrMrerr6rXrrrUrrVrr?rBrDrrrrrrrrrPrRrVr[rar*rirkrmrorqrrrrr{rrrrrrrr7r8s@r0rrsn;;


FJ;?&*\\\\\[\|[X
^##^#(([X(
^++^+
//[X/;;;



*(((555[5
[99[9))[)11[1..[.	-	-	-	-	-	-======222000000 999999	/	/	/	/	/	/<<<<<<&333333@@@@@@222999[
CC[CCC[C%%%[%4(((
...





[[r2rTc
ptjdtd|r|std|r|stdt	|}
||
_|r|
||r|
|||	r|
|	|
	||||S)Nz=ssl.wrap_socket() is deprecated, use SSLContext.wrap_socket()rrz5certfile must be specified for server-side operationsr)rPrQrRrS)
rrr
rr>rrrset_ciphersrY)rPrrrQrssl_versionca_certsrRrSciphersrUs           r0rYrYs
MG#
'8'&''	'7x75666%%G#G0%%h///3'222%G$$$
{ 71r2c4ddlm}ddlm}d}d}	||dddz}||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")timercalendarrindextitler)	cert_timerrmonthstime_formatmonth_numbertts       r0cert_time_to_secondsrsF(K
7||IbqbM$7$7$9$9::Q>Xim[
1
1vr!ul+b1g5666FFFj-6YYEFF	FFs2A66!Bz-----BEGIN CERTIFICATE-----z-----END CERTIFICATE-----cttj|ddtg}|fdt	dtdDz
}|tdzd|S)z[Takes a certificate in binary DER format and returns the
    PEM version of it as a string.ASCIIstrictc*g|]}||dzS)@rD)rEifs  r0
<listcomp>z(DER_cert_to_PEM_cert.<locals>.<listcomp>s%
3
3
31QqtV9
3
3
3r2rr
)	rKbase64standard_b64encode
PEM_HEADERrangerr
PEM_FOOTERr)der_cert_bytesssrs  @r0DER_cert_to_PEM_certrs	F%n55wIIA
B
3
3
3
3eAs1vvr22
3
3
33BIIj4   99R==r2c|tstdtz|t
stdt
z|t
tt
t
}tj|	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)
r-rrstripendswithrrrdecodebytesrL)pem_cert_stringds  r0PEM_cert_to_DER_certrs%%j11'C%&''	'  ""++J77'A%&''	'JZ0@ @AAahhw99:::r2cJ|\}}|t}nt}t|||}t||5}|||5}	|	d}
dddn#1swxYwYdddn#1swxYwYt
|
S)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#)r8)rTT)rr_create_stdlib_contextrrYrr)rrrr8hostportrrUrPsslsockdercerts           r0get_server_certificater
s0JD$!			$[/8,4666G
4	1	1	10T

 
 t
 
<
<	0))$//G	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0000000000000000 (((s5BA4(B4A8	8B;A8	<BBBc8t|dS)Nz	<unknown>)_PROTOCOL_NAMESr)
protocol_codes r0get_protocol_namer s}k:::r2rm)prerrcollectionsrenumr_Enumr_IntEnumr_IntFlagrrNrr	r
rrr
rrrrrrrrr+rr0rrrrrImportErrorrrrrr r!r"r#r$r%r&r'	_convert_rKr(rBr+__members__itemsrr_SSLv2_IF_EXISTSrJr^rmrrrrrrrrrrrrr&rrsocket_errorrrHAS_NEVER_CHECK_COMMON_NAME_RESTRICTED_SERVER_CIPHERSrrrrrrrr&r:r>r;rrr_create_default_https_contextrrrrrWr[rYrrrrrrrrrDr2r0<module>rsXXt


				""""""HHHHHHHHHHNNNNNNNNNN3333333333:9999999EEEEEEEEEEEE				D	
87777777(KK

x''
66
h..
8++
())
0:/FF*,QQ*2H2N2N2P2PQQQ7:'7>>h55555555hh&"&"&"&"&"&"&"&"Rh        :<7111111119999999999??????????



%%gd,JKK.+.>.>.>b D D DF			;0;0;0| Z 4&&&@@@@@**],HII@@@*&&&&&k5&&&BGBGBGBGBGBGBGBGJ$+#6$$"&t$$$$$L49*/9L$($"&tD44444n!74X;X;X;X;X;X;X;X;v||||||||@'
&
#T!Y(4(,%)@777<+

(
;;;.A$(2I)))),;;;;;s A''A/.A/