
    h
                     ^   S r SSKrSSKrSSKJr  SSKJr  SSKJr  SSK	J
r
Jr  SSKJr  \" \5       " S S	5      5       r\" \5       " S
 S5      5       r\" \5       " S S5      5       r\" \
5       " S S\R"                  5      5       r\" \
5       " S S\R"                  5      5       r/ SQrg)z*
Credential managers for L{twisted.mail}.
    N)implementer)credentials)IllegalClientResponse)IChallengeResponseIClientAuthentication)nativeStringc                   &    \ rS rSrS rS rS rSrg)CramMD5ClientAuthenticator   c                     Xl         g Nuserselfr   s     Y/root/1688_scrapy/alibaba-scraper/venv/lib/python3.13/site-packages/twisted/mail/_cred.py__init__#CramMD5ClientAuthenticator.__init__       	    c                     g)Ns   CRAM-MD5 r   s    r   getName"CramMD5ClientAuthenticator.getName   s    r   c                     [         R                  " X[        R                  S9R	                  5       nU R
                  S-   UR                  S5      -   $ )N)	digestmod    ascii)hmacHMAChashlibmd5	hexdigestr   encode)r   secretchalresponses       r   challengeResponse,CramMD5ClientAuthenticator.challengeResponse   s<    99VW[[AKKMyy4(//'":::r   r   N__name__
__module____qualname____firstlineno__r   r   r)   __static_attributes__r   r   r   r
   r
      s    ;r   r
   c                   ,    \ rS rSrS rS rS rS rSrg)LOGINAuthenticator!   c                 2    Xl         U R                  U l        g r   )r   challengeUsernamer)   r   s     r   r   LOGINAuthenticator.__init__#   s    	!%!7!7r   c                     g)Ns   LOGINr   r   s    r   r   LOGINAuthenticator.getName'       r   c                 <    U R                   U l        U R                  $ r   )challengeSecretr)   r   r   r&   r'   s      r   r5   $LOGINAuthenticator.challengeUsername*   s    !%!5!5yyr   c                     U$ r   r   r<   s      r   r;   "LOGINAuthenticator.challengeSecret/   s    r   )r)   r   N)	r,   r-   r.   r/   r   r   r5   r;   r0   r   r   r   r2   r2   !   s    8
r   r2   c                   &    \ rS rSrS rS rS rSrg)PLAINAuthenticator4   c                     Xl         g r   r   r   s     r   r   PLAINAuthenticator.__init__6   r   r   c                     g)Ns   PLAINr   r   s    r   r   PLAINAuthenticator.getName9   r9   r   c                 ,    SU R                   -   S-   U-   $ )N    r   r<   s      r   r)   $PLAINAuthenticator.challengeResponse<   s    tyy 5(611r   r   Nr+   r   r   r   rA   rA   4   s    2r   rA   c                   ,    \ rS rSrS rS rS rS rSrg)LOGINCredentials@   c                 j    SS/U l         SS/U l        [        R                  R	                  U S S 5        g )Ns	   Password s
   User Name s   passwords   username)
challenges	responsesr   UsernamePasswordr   r   s    r   r   LOGINCredentials.__init__B   s2    (.9%{3$$--dD$?r   c                 6    U R                   R                  5       $ r   )rN   popr   s    r   getChallengeLOGINCredentials.getChallengeG   s    ""$$r   c                 `    [        U [        U R                  R                  5       5      U5        g r   )setattrr   rO   rS   )r   r(   s     r   setResponseLOGINCredentials.setResponseJ   s     l4>>#5#5#78(Cr   c                 ,    [        U R                  5      $ r   )boolrN   r   s    r   moreChallengesLOGINCredentials.moreChallengesM   s    DOO$$r   )rN   rO   N	r,   r-   r.   r/   r   rT   rX   r\   r0   r   r   r   rK   rK   @   s    @
%D%r   rK   c                   ,    \ rS rSrS rS rS rS rSrg)PLAINCredentialsQ   c                 F    [         R                  R                  U S S 5        g r   )r   rP   r   r   s    r   r   PLAINCredentials.__init__S   s    $$--dD$?r   c                     g)Nr   r   r   s    r   rT   PLAINCredentials.getChallengeV   s    r   c                 x    UR                  S5      n[        U5      S:w  a  [        S5      eUu  o0l        U l        g )NrH      z*Malformed Response - wrong number of parts)splitlenr   usernamepassword)r   r(   partsuselesss       r   rX   PLAINCredentials.setResponseY   s5    u%u:?'(TUU05-r   c                     g)NFr   r   s    r   r\   PLAINCredentials.moreChallenges_   s    r   )rk   rj   Nr^   r   r   r   r`   r`   Q   s    @6r   r`   )r
   rK   r2   r`   rA   )__doc__r"   r    zope.interfacer   twisted.credr   twisted.mail._exceptr   twisted.mail.interfacesr   r   twisted.python.compatr   r
   r2   rA   rP   rK   r`   __all__r   r   r   <module>rx      s   
   & $ 6 M . "#	; 	; $	; "#  $$ "#2 2 $2  %{33 % !%   {33  !"r   