ó
    Ö›‘hƒ"  ã            	      óâ  • % S r SSKJr  SSKJrJrJrJr  SSKJ	r	J
r
  SSKJrJrJr  SSKJr  \	(       a  SSKJr   " S S	\
5      r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r\" \5       " S S5      5       r\" \5       " S S5      5       r\" \5       " S S5      5       r\" \5       " S S5      5       r\" \5       " S S5      5       r\" \5       " S S5      5       r\" \5       " S S5      5       r\" \5       " S  S!5      5       r\" 5       \" 5       \" 5       \" 5       \" 5       \" 5       \" 5       \" 5       S".rS#\ S$'   S,S% jr!S-S& jr"S-S' jr#S.S( jr$S/S) jr%S0S* jr&g+)1z
SSH key exchange handling.
é    )Úannotations)Úsha1Úsha256Úsha384Úsha512)ÚTYPE_CHECKINGÚProtocol)Ú	AttributeÚ	InterfaceÚimplementer)Úerror)Ú_Hashc                  ó"   • \ rS rSrSSS jjrSrg)Ú_HashFactoryé   c                ó   • g ©N© )ÚselfÚdatas     ÚZC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/conch/ssh/_kex.pyÚ__call__Ú_HashFactory.__call__   s   € Øó    r   N).)r   ÚbytesÚreturnr   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__r   r   r   r   r      s   † ÷ñ r   r   c                  óN   • \ rS rSr% Sr\" S5      rS\S'   \" S5      rS\S'   S	r	g
)Ú_IKexAlgorithmé   z:
An L{_IKexAlgorithm} describes a key exchange algorithm.
z‹An L{int} giving the preference of the algorithm when negotiating key exchange. Algorithms with lower precedence values are more preferred.ÚintÚ
preferencezqA callable hash algorithm constructor (e.g. C{hashlib.sha256}) suitable for use with this key exchange algorithm.r   ÚhashProcessorr   N)
r   r   r   r    Ú__doc__r
   r&   Ú__annotations__r'   r!   r   r   r   r#   r#      s7   ‡ ññ  ð	ó€J�ó ñ #,ð	=ó#€M�<ö r   r#   c                  ó8   • \ rS rSrSr\" S5      r\" S5      rSrg)Ú_IFixedGroupKexAlgorithmé-   zi
An L{_IFixedGroupKexAlgorithm} describes a key exchange algorithm with a
fixed prime / generator group.
zdAn L{int} giving the prime number used in Diffie-Hellman key exchange, or L{None} if not applicable.z�An L{int} giving the generator number used in Diffie-Hellman key exchange, or L{None} if not applicable. (This is not related to Python generator functions.)r   N)	r   r   r   r    r(   r
   ÚprimeÚ	generatorr!   r   r   r   r+   r+   -   s)   † ññ
 ð	2ó€Eñ
 ð	'óƒIr   r+   c                  ó   • \ rS rSrSrSrg)Ú#_IEllipticCurveExchangeKexAlgorithmé?   z’
An L{_IEllipticCurveExchangeKexAlgorithm} describes a key exchange algorithm
that uses an elliptic curve exchange between the client and server.
r   N©r   r   r   r    r(   r!   r   r   r   r0   r0   ?   s   † ôr   r0   c                  ó   • \ rS rSrSrSrg)Ú_IGroupExchangeKexAlgorithméF   zá
An L{_IGroupExchangeKexAlgorithm} describes a key exchange algorithm
that uses group exchange between the client and server.

A prime / generator group should be chosen at run time based on the
requested size. See RFC 4419.
r   Nr2   r   r   r   r4   r4   F   s   † ôr   r4   c                  ó    • \ rS rSrSrSr\rSrg)Ú_Curve25519SHA256éP   zˆ
Elliptic Curve Key Exchange using Curve25519 and SHA256. Defined in
U{https://datatracker.ietf.org/doc/draft-ietf-curdle-ssh-curves/}.
é   r   N©	r   r   r   r    r(   r&   r   r'   r!   r   r   r   r7   r7   P   ó   † ñð
 €JØƒMr   r7   c                  ó    • \ rS rSrSrSr\rSrg)Ú_Curve25519SHA256LibSSHé[   zF
As L{_Curve25519SHA256}, but with a pre-standardized algorithm name.
é   r   Nr:   r   r   r   r=   r=   [   s   † ñð €JØƒMr   r=   c                  ó    • \ rS rSrSrSr\rSrg)Ú_ECDH256ée   a<  
Elliptic Curve Key Exchange with SHA-256 as HASH. Defined in
RFC 5656.

Note that C{ecdh-sha2-nistp256} takes priority over nistp384 or nistp512.
This is the same priority from OpenSSH.

C{ecdh-sha2-nistp256} is considered preety good cryptography.
If you need something better consider using C{curve25519-sha256}.
é   r   Nr:   r   r   r   rA   rA   e   s   † ñ	ð €JØƒMr   rA   c                  ó    • \ rS rSrSrSr\rSrg)Ú_ECDH384év   zH
Elliptic Curve Key Exchange with SHA-384 as HASH. Defined in
RFC 5656.
é   r   N)	r   r   r   r    r(   r&   r   r'   r!   r   r   r   rE   rE   v   r;   r   rE   c                  ó    • \ rS rSrSrSr\rSrg)Ú_ECDH512é�   zH
Elliptic Curve Key Exchange with SHA-512 as HASH. Defined in
RFC 5656.
é   r   N)	r   r   r   r    r(   r&   r   r'   r!   r   r   r   rI   rI   �   r;   r   rI   c                  ó    • \ rS rSrSrSr\rSrg)Ú_DHGroupExchangeSHA256éŒ   zW
Diffie-Hellman Group and Key Exchange with SHA-256 as HASH. Defined in
RFC 4419, 4.2.
é   r   Nr:   r   r   r   rM   rM   Œ   r;   r   rM   c                  ó    • \ rS rSrSrSr\rSrg)Ú_DHGroupExchangeSHA1é—   zU
Diffie-Hellman Group and Key Exchange with SHA-1 as HASH. Defined in
RFC 4419, 4.1.
é   r   N)	r   r   r   r    r(   r&   r   r'   r!   r   r   r   rQ   rQ   —   s   † ñð
 €JØƒMr   rQ   c                  ó4   • \ rS rSrSrSr\r\" S5      r	Sr
Srg)Ú_DHGroup14SHA1é¢   zu
Diffie-Hellman key exchange with SHA-1 as HASH and Oakley Group 14
(2048-bit MODP Group). Defined in RFC 4253, 8.2.
é   Ái  32317006071311007300338913926423828248817941241140239112842009751400741706634354222619689417363569347117901737909704191754605873209195028853758986185622153212175412514901774520270235796078236248884246189477587641105928646099411723245426622522193230540919037680524235519125679715870117001058055877651038861847280257976054903569732561526167081339361799541336476559160368317896729073178384589680639671900977202194168647225871031411336429319536193471636533209717077448227988588565369208645296636077250268955505928362751121174096972998068410554359584866583291642136218231078990999448652468262416972035911852507045361090559r?   r   N)r   r   r   r    r(   r&   r   r'   r%   r-   r.   r!   r   r   r   rU   rU   ¢   s)   † ñð
 €JØ€Máð
	ó€Eð ƒIr   rU   )ó   curve25519-sha256s   curve25519-sha256@libssh.orgs$   diffie-hellman-group-exchange-sha256s"   diffie-hellman-group-exchange-sha1s   diffie-hellman-group14-sha1s   ecdh-sha2-nistp256s   ecdh-sha2-nistp384s   ecdh-sha2-nistp521zdict[bytes, _IKexAlgorithm]Ú_kexAlgorithmsc                ó\   • U [         ;  a  [        R                  " SU < 35      e[         U    $ )a9  
Get a description of a named key exchange algorithm.

@param kexAlgorithm: The key exchange algorithm name.
@type kexAlgorithm: L{bytes}

@return: A description of the key exchange algorithm named by
    C{kexAlgorithm}.
@rtype: L{_IKexAlgorithm}

@raises ConchError: if the key exchange algorithm is not found.
z$Unsupported key exchange algorithm: )rZ   r   Ú
ConchError©ÚkexAlgorithms    r   ÚgetKexr_   É   s1   € ð œ>Ó)Ü×ÒÐ!EÀlÑEUÐVÓWÐWÜ˜,Ñ'Ð'r   c                ó>   • [         R                  [        U 5      5      $ )zÄ
Returns C{True} if C{kexAlgorithm} is an elliptic curve.

@param kexAlgorithm: The key exchange algorithm name.

@return: C{True} if C{kexAlgorithm} is an elliptic curve, otherwise
    C{False}.
)r0   Ú
providedByr_   r]   s    r   ÚisEllipticCurverb   Û   s   € ô /×9Ñ9¼&ÀÓ:NÓOÐOr   c                ó>   • [         R                  [        U 5      5      $ )zâ
Returns C{True} if C{kexAlgorithm} has a fixed prime / generator group.

@param kexAlgorithm: The key exchange algorithm name.

@return: C{True} if C{kexAlgorithm} has a fixed prime / generator group,
    otherwise C{False}.
)r+   ra   r_   r]   s    r   ÚisFixedGrouprd   ç   s   € ô $×.Ñ.¬v°lÓ/CÓDÐDr   c                ó0   • [        U 5      nUR                  $ )zº
Get the hash algorithm callable to use in key exchange.

@param kexAlgorithm: The key exchange algorithm name.

@return: A callable hash algorithm constructor (e.g. C{hashlib.sha256}).
)r_   r'   ©r^   Úkexs     r   ÚgetHashProcessorrh   ó   s   € ô �Ó
€CØ×ÑÐr   c                óZ   • [        [        U 5      5      nUR                  UR                  4$ )zá
Get the generator and the prime to use in key exchange.

@param kexAlgorithm: The key exchange algorithm name.
@type kexAlgorithm: L{bytes}

@return: A L{tuple} containing L{int} generator and L{int} prime.
@rtype: L{tuple}
)r+   r_   r.   r-   rf   s     r   ÚgetDHGeneratorAndPrimerj   ÿ   s&   € ô #¤6¨,Ó#7Ó
8€CØ�=‰=˜#Ÿ)™)Ð#Ð#r   c                 óº  ^• SSK Jn   SSKJn  SSKJn  U " 5       n[        R                  5       m[        T5       H‘  nUR                  S5      (       a5  UR                  SS5      nUR                  UR                  5       X%   5      nO)UR                  S5      (       a  UR                  5       nOSnU(       a  M€  TR                  U5        M“     [        TU4S	 jS
9$ )z�
Get a list of supported key exchange algorithm names in order of
preference.

@return: A C{list} of supported key exchange algorithm names.
r   )Údefault_backend)Úec)Ú_curveTables   ecdhs   ecdsarY   Tc                ó"   >• TU    R                   $ r   )r&   )r^   ÚkexAlgorithmss    €r   Ú<lambda>Ú*getSupportedKeyExchanges.<locals>.<lambda>(  s   ø€ °¸lÑ0K×0VÒ0Vr   )Úkey)Úcryptography.hazmat.backendsrl   Ú)cryptography.hazmat.primitives.asymmetricrm   Útwisted.conch.ssh.keysrn   rZ   ÚcopyÚlistÚ
startswithÚreplaceÚ+elliptic_curve_exchange_algorithm_supportedÚECDHÚx25519_supportedÚpopÚsorted)rl   rm   rn   ÚbackendÚkeyAlgorithmÚkeyAlgorithmDsaÚ	supportedrp   s          @r   ÚgetSupportedKeyExchangesr„     sÃ   ø€ õ =Ý<å2áÓ€GÜ"×'Ñ'Ó)€MÜ˜]Ö+ˆØ×"Ñ" 7×+Ñ+Ø*×2Ñ2°7¸HÓEˆOØ×KÑKØ—‘“	˜;Ñ7ó‰Ið ×$Ñ$Ð%9×:Ñ:Ø×0Ñ0Ó2‰IàˆIßˆyØ×Ñ˜lÖ+ñ ,ô ØÔVñð r   N)r^   r   r   r#   )r^   r   r   Úbool)r^   r   r   r   )r^   r   r   ztuple[int, int])r   zlist[bytes])'r(   Ú
__future__r   Úhashlibr   r   r   r   Útypingr   r	   Úzope.interfacer
   r   r   Útwisted.conchr   r   r   r#   r+   r0   r4   r7   r=   rA   rE   rI   rM   rQ   rU   rZ   r)   r_   rb   rd   rh   rj   r„   r   r   r   Ú<module>r‹      s¹  ðò
õ #ç 0Ó 0ß *ç <Ñ <å æåô�8ô ô
�Yô ô"˜~ô ô$¨.ô ô .ô ñ Ð0Ó1÷ð ó 2ðñ Ð0Ó1÷ð ó 2ðñ Ð0Ó1÷ð ó 2ðñ  Ð0Ó1÷ð ó 2ðñ Ð0Ó1÷ð ó 2ðñ Ð(Ó)÷ð ó *ðñ Ð(Ó)÷ð ó *ðñ Ð%Ó&÷ð ó 'ðñ6 ,Ó-Ù%<Ó%>Ù-CÓ-EÙ+?Ó+AÙ$2Ó$4Ù#›:Ù#›:Ù#›:ñ	/€Ð+ó 	ô(ô$	Pô	Eô	ô$õr   