+
    üÐj"  ã                   óê   € R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHtH	t	H
t
 ^ RIHt  ! R R]	4      t]
! ]4       ! R R4      4       t]
! ]4       ! R	 R
4      4       t]
! ]4       ! R R4      4       tR# )zF
Protocol agnostic implementations of SASL authentication mechanisms.
N)Úmd5)Ú	AttributeÚ	InterfaceÚimplementer)ÚnetworkStringc                   ó<   a € ] tR t^t o ]! R4      tR tR tRtV t	R# )ÚISASLMechanismz#Common name for the SASL Mechanism.c                 ó   € R# )z{
Get the initial client response, if defined for this mechanism.

@return: initial client response string.
@rtype: C{str}.
N© r
   ó    ÚP/usr/lib/python3/dist-packages/twisted/words/protocols/jabber/sasl_mechanisms.pyÚgetInitialResponseÚ!ISASLMechanism.getInitialResponse   ó   ‚ r   c                ó   € R# )z‘
Get the response to a server challenge.

@param challenge: server challenge.
@type challenge: C{str}.
@return: client response.
@rtype: C{str}.
Nr
   )Ú	challenges   &r   ÚgetResponseÚISASLMechanism.getResponse!   r   r   r
   N)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Únamer   r   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s   ø‡ € ÙÐ>Ó?€Dò÷ð r   r   c                   ó4   a € ] tR t^,t o RtRtR tR tRtV t	R# )Ú	Anonymousza
Implements the ANONYMOUS SASL authentication mechanism.

This mechanism is defined in RFC 2245.
Ú	ANONYMOUSc                ó   € R # ©Nr
   ©Úselfs   &r   r   ÚAnonymous.getInitialResponse6   ó   € Ùr   c                ó   € R # r!   r
   ©r#   r   s   &&r   r   ÚAnonymous.getResponse9   ó   € ár   r
   N)
r   r   r   r   Ú__doc__r   r   r   r   r   r   s   @r   r   r   ,   s    ø‡ € ñð €Dò÷ð r   r   c                   ó:   a € ] tR t^>t o RtRtR tR tR tRt	V t
R# )ÚPlainzv
Implements the PLAIN SASL authentication mechanism.

The PLAIN SASL authentication mechanism is defined in RFC 2595.
ÚPLAINc                ól   € T;'       g    RV n         T;'       g    RV n        T;'       g    RV n        R# )zÕ
@param authzid: The authorization identity.
@type authzid: L{unicode}

@param authcid: The authentication identity.
@type authcid: L{unicode}

@param password: The plain-text password.
@type password: L{unicode}
Ú N)ÚauthzidÚauthcidÚpassword)r#   r0   r1   r2   s   &&&&r   Ú__init__ÚPlain.__init__H   s+   € ð —}�} "ˆŒØ—}�} "ˆŒØ Ÿ˜ BˆŽr   c                óÔ   € V P                   P                  R 4      R,           V P                  P                  R 4      ,           R,           V P                  P                  R 4      ,           # )zutf-8ó    )r0   Úencoder1   r2   r"   s   &r   r   ÚPlain.getInitialResponseX   s[   € à�L‰L×Ñ Ó(Øõà�l‰l×!Ñ! 'Ó*õ+ð õð �m‰m×"Ñ" 7Ó+õ	,ð	
r   c                ó   € R # r!   r
   r'   s   &&r   r   ÚPlain.getResponsea   r)   r   )r1   r0   r2   N)r   r   r   r   r*   r   r3   r   r   r   r   r   s   @r   r,   r,   >   s%   ø‡ € ñð €Dò'ò 
÷ð r   r,   c                   óX   a € ] tR t^ft o RtRtR tR tR tR t	R t
R tR	 tR
 tRtV tR# )Ú	DigestMD5z€
Implements the DIGEST-MD5 SASL authentication mechanism.

The DIGEST-MD5 SASL authentication mechanism is defined in RFC 2831.
z
DIGEST-MD5c                ó†   € W@n         WPn        W n        V RV 2V n        Ve   V ;P                  RV 2,          un        R# R# )aq  
@param serv_type: An indication of what kind of server authentication
    is being attempted against.  For example, C{u"xmpp"}.
@type serv_type: C{unicode}

@param host: The authentication hostname.  Also known as the realm.
    This is used as a scope to help select the right credentials.
@type host: C{unicode}

@param serv_name: An additional identifier for the server.
@type serv_name: C{unicode}

@param username: The authentication username to use to respond to a
    challenge.
@type username: C{unicode}

@param password: The authentication password to use to respond to a
    challenge.
@type password: C{unicode}
Ú/N)Úusernamer2   ÚdefaultRealmÚ
digest_uri)r#   Ú	serv_typeÚhostÚ	serv_namer?   r2   s   &&&&&&r   r3   ÚDigestMD5.__init__p   sE   € ð* !ŒØ ŒØ Ôà&˜K q¨¨Ð/ˆŒØÒ Ø�OŠO  9 +˜Õ.�Oñ !r   c                ó   € R # r!   r
   r"   s   &r   r   ÚDigestMD5.getInitialResponse�   r%   r   c                ó  € V P                  V4      pR V9   d   R# VR,          P                  R4      p VR,          pV P                  W4VR,          4      #   \         d    T P                  P	                  T4      p LAi ; i)s   rspauthr   ó   charsetÚasciió   realmó   nonce)Ú_parseÚdecodeÚKeyErrorr@   r7   Ú_genResponse)r#   r   Ú
directivesÚcharsetÚrealms   &&   r   r   ÚDigestMD5.getResponse�   s‚   € Ø—[‘[ Ó+ˆ
ð ˜Ô#Ùà˜ZÕ(×/Ñ/°Ó8ˆð	6Ø˜xÕ(ˆEð × Ñ  °¸HÕ1EÓFÐFøô ô 	6Ø×%Ñ%×,Ñ,¨WÓ5ŠEð	6ús   ´	A Á&A?Á>A?c                ó  € Tp/ p^ pRpV'       dÏ   VP                  RV4      pW$V P                  4       pV^,          pW&V^,            R8X  dC   V^,          pVP                  RV4      pW&V p	VP                  RV4      ^,           pV^ 8X  d   RpMIVP                  RV4      pVR8X  d   W&R P                  4       p	RpMW&V P                  4       p	V^,           pW“V&   KÖ  R F$  p
W£9   g   K  W:,          P	                  R4      W:&   K&  	  V# )	z·
Parses the server challenge.

Splits the challenge into a dictionary of directives with values.

@return: challenge directives and their values.
@rtype: C{dict} of C{str} to C{str}.
Tó   =ó   "ó   ,FNéÿÿÿÿ)ó   qopó   cipher)ÚindexÚlstripÚfindÚrstripÚsplit)r#   r   ÚsÚ	paramDictÚcurÚremainingParamsÚmiddler   ÚendÚvalueÚparams   &&         r   rM   ÚDigestMD5._parse¡   s  € ð ˆØˆ	ØˆØˆßð
 —W‘W˜T 3Ó'ˆFØ˜�=×'Ñ'Ó)ˆDØ�a�KˆFØ˜& 1�*Ð%¨Ô-Ø˜!•�Ø—g‘g˜d FÓ+�Ø ˜�Ø—f‘f˜T 3Ó'¨!Õ+�Ø˜!”8Ø&+�Oøà—f‘f˜T 6Ó*�Ø˜"”9Ø˜g˜J×-Ñ-Ó/�EØ&+‘Oà S˜M×0Ñ0Ó2�EØ˜A•g�Ø#�d‹Oã(ˆEØÖ!Ø#,Õ#3×#9Ñ#9¸$Ó#?�	Ó ñ )ð Ðr   c                óÌ   € . pVP                  4        F>  w  r4VR9   d   VR,           V,           pMVR,           V,           pVP                  V4       K@  	  RP                  V4      # )a&  
Create message string from directives.

@param directives: dictionary of directives (names to their values).
                   For certain directives, extra quotes are added, as
                   needed.
@type directives: C{dict} of C{str} to C{str}
@return: message string.
@rtype: C{str}.
rV   rX   )ó   usernamerK   ó   cnoncerL   ó
   digest-uris   authzidr[   )ÚitemsÚappendÚjoin)r#   rQ   Údirective_listr   rg   Ú	directives   &&    r   Ú_unparseÚDigestMD5._unparseÍ   sh   € ð ˆØ%×+Ñ+Ö-‰KˆDØð ô ð ! 4�K¨%Õ/‘	à  4�K¨%Õ/�	à×!Ñ! )Ö,ñ .ð  �y‰y˜Ó(Ð(r   c                óp  a€ R oR pV3R lp	S! VR,           V,           R,           V,           4      R,           V,           R,           V,           p
RV,           pV! V	! V! S! V
4      4      VR,           V,           R,           V,           R,           R,           R,           V! S! V4      4      ,           4      4      pV# )zª
Calculates response with given encoded parameters.

@return: The I{response} field of a response to a Digest-MD5 challenge
    of the given parameters.
@rtype: L{bytes}
c                 ó4   € \        V 4      P                  4       # r!   )r   Údigest)ra   s   &r   ÚHÚ'DigestMD5._calculateResponse.<locals>.Hõ   s   € Ü�q“6—=‘=“?Ð"r   c                 ó.   € \         P                  ! V 4      # r!   )ÚbinasciiÚb2a_hex)Úns   &r   ÚHEXÚ)DigestMD5._calculateResponse.<locals>.HEXø   s   € Ü×#Ò# AÓ&Ð&r   c                 ó0   <€ S! V R ,           V,           4      # )ó   :r
   )Úkra   rx   s   &&€r   ÚKDÚ(DigestMD5._calculateResponse.<locals>.KDû   s   ø€ Ù�Q˜•X •\“?Ð"r   r�   s   AUTHENTICATE:ó   authr
   )r#   ÚcnonceÚncÚnoncer?   r2   rS   Úurir~   rƒ   Úa1Úa2Úresponserx   s   &&&&&&&&     @r   Ú_calculateResponseÚDigestMD5._calculateResponseì   s©   ø€ ò	#ò	'õ	#ñ ˆx˜$� Õ&¨Õ-°Õ8Ó9¸DÕ@À5ÕHÈ4ÕOÐRXÕXˆØ Õ#ˆáÙÙ‘A�b“E“
Ø˜•˜rÕ! DÕ(¨6Õ1°DÕ8¸7ÕBÀTÕIÉCÑPQÐRTÓPUËJÕVóó
ˆð ˆr   c                ó”  €  V P                   P                  V4      pV P                  P                  V4      pV P                  P                  V4      p\        ^R 4      pT P                  4       pRp	T P                  Y‡Y4YRT4      p
RTRTRTRTRTRT	R	TR
T
RTP                  R4      /	pT P                  T4      #   \         d    h i ; i)z±
Generate response-value.

Creates a response to a challenge according to section 2.1.2.1 of
RFC 2831 using the C{charset}, C{realm} and C{nonce} directives
from the challenge.
Ú08xr…   rk   rK   rL   rl   s   ncrZ   rm   s   responserI   rJ   )	r?   r7   r2   rA   ÚUnicodeErrorr   Ú
_gen_noncer�   rs   )r#   rR   rS   rˆ   r?   r2   rA   r‡   r†   ÚqoprŒ   rQ   s   &&&&        r   rP   ÚDigestMD5._genResponse	  sã   € ð	Ø—}‘}×+Ñ+¨GÓ4ˆHØ—}‘}×+Ñ+¨GÓ4ˆHØŸ™×/Ñ/°Ó8ˆJô
 ˜a ˜WÓ&ˆØ—‘Ó"ˆØˆð ×*Ñ*Ø˜¨¸*ó
ˆð
 ˜Ø�eØ�eØ�vØ�2Ø�CØ˜:Ø˜Ø˜Ÿ™ wÓ/ð

ˆ
ð �}‰}˜ZÓ(Ð(øô3 ô 	àð	ús   ‚AB: Â:Cc                óò   € R \         P                   ! 4       \        P                  ! 4       \        P                  ! 4       3,          p\	        V4      p\        V4      P                  4       P                  R4      # )z%f:%f:%drJ   )ÚrandomÚtimeÚosÚgetpidr   r   Ú	hexdigestr7   )r#   ÚnonceStringÚ
nonceBytess   &  r   r’   ÚDigestMD5._gen_nonce0  sM   € Ø ¤F§M¢M£O´T·Y²Y³[Ä"Ç)Â)Ã+Ð#NÕNˆÜ" ;Ó/ˆ
Ü�:‹×(Ñ(Ó*×1Ñ1°'Ó:Ð:r   )r@   rA   r2   r?   N)r   r   r   r   r*   r   r3   r   r   rM   rs   r�   rP   r’   r   r   r   s   @r   r<   r<   f   sA   ø‡ € ñð €Dò/ò:òGò"*òX)ò>ò:%)÷N;ð ;r   r<   )r*   r{   r˜   r–   r—   Úhashlibr   Úzope.interfacer   r   r   Útwisted.python.compatr   r   r   r,   r<   r
   r   r   Ú<module>r¡      sŽ   ðñó
 Û 	Û Û Ý ç <Ñ <å /ô�Yô ñ, ˆ^Ó÷ð ó ðñ" ˆ^Ó÷$ð $ó ð$ñN ˆ^Ó÷L;ð L;ó òL;r   