+
    üÐjÆ  ã                   ó\   € R t ^ RIt^ RIHt ^ RIHt ^ RIHtHt ^ RI	H
t
  ! R R]
4      tR# )z9
Tests for L{twisted.cred}'s implementation of CRAM-MD5.
N)Úhexlify)ÚHMAC)ÚCramMD5CredentialsÚIUsernameHashedPassword)ÚTestCasec                   ó�   a € ] tR t^t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
RtV tR# )ÚCramMD5CredentialsTestsz"
Tests for L{CramMD5Credentials}.
c                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnN© )ÚformatÚ__classdict__s   "€ÚA/usr/lib/python3/dist-packages/twisted/cred/test/test_cramauth.pyÚ__annotate__Ú$CramMD5CredentialsTests.__annotate__   s   ø€ ÷ 1ñ 1¨$ñ 1ó    c                óx   € \        4       pVP                  4       pV P                  W!P                  4       4       R# )zo
The same L{CramMD5Credentials} will always provide the same challenge,
no matter how many times it is called.
N)r   ÚgetChallengeÚassertEqual©ÚselfÚcÚchals   &  r   Útest_idempotentChallengeÚ0CramMD5CredentialsTests.test_idempotentChallenge   s-   € ô
 Ó ˆØ�~‰~ÓˆØ×Ñ˜Ÿ~™~Ó/Ö0r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r      s   ø€ ÷ 
4ñ 
4 Dñ 
4r   c                óê   € \        4       pVP                  4       p\        \        RV\        P
                  R7      P                  4       4      Vn        V P                  VP                  R4      4       R# )a
  
When a valid response (which is a hex digest of the challenge that has
been encrypted by the user's shared secret) is set on the
L{CramMD5Credentials} that created the challenge, and C{checkPassword}
is called with the user's shared secret, it will return L{True}.
ó   secret©Ú	digestmodN)
r   r   r   r   ÚhashlibÚmd5ÚdigestÚresponseÚ
assertTrueÚcheckPasswordr   s   &  r   Útest_checkPasswordÚ*CramMD5CredentialsTests.test_checkPassword   sO   € ô Ó ˆØ�~‰~ÓˆÜœT )¨T¼W¿[¹[ÔI×PÑPÓRÓSˆŒ
Ø�‰˜Ÿ™¨	Ó2Ö3r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r   +   s   ø€ ÷ 5ñ 5 ñ 5r   c                óZ   € \        4       pV P                  VP                  R4      4       R# )zO
When there is no response set, calling C{checkPassword} will return
L{False}.
r   N)r   ÚassertFalser'   )r   r   s   & r   Útest_noResponseÚ'CramMD5CredentialsTests.test_noResponse+   s#   € ô
 Ó ˆØ×Ñ˜Ÿ™¨Ó3Ö4r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r   3   s   ø€ ÷ 5ñ 5 Dñ 5r   c                óê   € \        4       pVP                  4       p\        \        RV\        P
                  R7      P                  4       4      Vn        V P                  VP                  R4      4       R# )zø
When an invalid response is set on the L{CramMD5Credentials} (one that
is not the hex digest of the challenge, encrypted with the user's shared
secret) and C{checkPassword} is called with the user's correct shared
secret, it will return L{False}.
s   thewrongsecretr    r   N)
r   r   r   r   r"   r#   r$   r%   r,   r'   r   s   &  r   Útest_wrongPasswordÚ*CramMD5CredentialsTests.test_wrongPassword3   sW   € ô Ó ˆØ�~‰~ÓˆÜÜÐ" D´G·K±KÔ@×GÑGÓIó
ˆŒ
ð 	×Ñ˜Ÿ™¨Ó3Ö4r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r   A   s   ø€ ÷ 2ñ 2 $ñ 2r   c                óX  € \        4       pVP                  4       pVP                  RP                  R\	        \        RV\        P                  R7      P                  4       4      34      4       V P                  VP                  R4      4       V P                  VP                  R4       R# )z¢
When C{setResponse} is called with a string that is the username and
the hashed challenge separated with a space, they will be set on the
L{CramMD5Credentials}.
ó    s   squirrels   supersecretr    N)r   r   ÚsetResponseÚjoinr   r   r"   r#   r$   r&   r'   r   Úusernamer   s   &  r   Útest_setResponseÚ(CramMD5CredentialsTests.test_setResponseA   s�   € ô Ó ˆØ�~‰~ÓˆØ	�‰Ø�I‰IàÜœD °ÄÇÁÔM×TÑTÓVÓWðóô	
ð 	�‰˜Ÿ™¨Ó7Ô8Ø×Ñ˜Ÿ™ [Ö1r   c                ó   <€ V ^8„  d   QhRR/# r
   r   )r   r   s   "€r   r   r   T   s   ø€ ÷ Sñ S ñ Sr   c                óX   € V P                  \        P                  ! \        4      4       R# )zL
L{CramMD5Credentials} implements the L{IUsernameHashedPassword}
interface.
N)r&   r   ÚimplementedByr   )r   s   &r   Útest_interfaceÚ&CramMD5CredentialsTests.test_interfaceT   s   € ð
 	�‰Ô/×=Ò=Ô>PÓQÖRr   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r(   r-   r1   r9   r>   Ú__static_attributes__Ú__classdictcell__)r   s   @r   r   r      sH   ø‡ € ñ÷1ð 1÷
4ð 
4÷5ð 5÷5ð 5÷2ð 2÷&Sö Sr   r   )rD   r"   Úbinasciir   Úhmacr   Útwisted.cred.credentialsr   r   Útwisted.trial.unittestr   r   r   r   r   Ú<module>rK      s+   ðñó
 Ý Ý ç PÝ +ôHS˜hö HSr   