+
    üÐjƒ"  ã                  ó  a € 0 t $ R t^ RIHt ^ RIHtHtHtHt ^ RI	H
t
Ht ^ RIHtHtHt ^ RIHt ]
'       d   ^ RIHt  ! R R]4      t ! R	 R
]4      t ! R R]4      t ! R R]4      t ! R R]4      t]! ]4       ! R R4      4       t]! ]4       ! R R4      4       t]! ]4       ! R R4      4       t]! ]4       ! R R4      4       t]! ]4       ! R R4      4       t]! ]4       ! R R4      4       t]! ]4       ! R R4      4       t]! ]4       ! R R 4      4       tR!]! 4       R"]! 4       R#]! 4       R$]! 4       R%]! 4       R&]! 4       R']! 4       R(]! 4       /t R)]!R*&   R+ R, lt"R- R. lt#R/ R0 lt$R1 R2 lt%R3 R4 lt&R5 R6 lt'R7# )8z
SSH key exchange handling.
)Úannotations)Úsha1Úsha256Úsha384Úsha512)ÚTYPE_CHECKINGÚProtocol)Ú	AttributeÚ	InterfaceÚimplementer)Úerror)Ú_Hashc                  ó&   € ] tR t^tRR R lltRtR# )Ú_HashFactoryc               ó    € V ^8„  d   QhRRRR/# )é   ÚdataÚbytesÚreturnr   © )Úformats   "Ú8/usr/lib/python3/dist-packages/twisted/conch/ssh/_kex.pyÚ__annotate__Ú_HashFactory.__annotate__   s   € ÷ ñ ˜Uð ¨Uñ ó    c                	ó   € R # ©Nr   )Úselfr   s   &&r   Ú__call__Ú_HashFactory.__call__   s   € Ùr   r   N).)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__r   r   r   r   r      s   † ÷ó r   r   c                  óP   € ] tR t^t$ Rt]! R4      tR]R&   ]! R4      tR]R&   Rt	R	# )
Ú_IKexAlgorithmz:
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                  ó:   € ] tR t^-tRt]! R4      t]! R4      tRtR# )Ú_IFixedGroupKexAlgorithmzi
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                  ó   € ] tR t^?tRtRtR# )Ú#_IEllipticCurveExchangeKexAlgorithmz’
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   r1   r1   ?   s   † õr   r1   c                  ó   € ] tR t^FtRtRtR# )Ú_IGroupExchangeKexAlgorithmzá
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                  ó"   € ] tR t^PtRt^t]tRtR# )Ú_Curve25519SHA256zˆ
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   r6   r6   P   ó   † ñð
 €JØ„Mr   r6   c                  ó"   € ] tR t^[tRt^t]tRtR# )Ú_Curve25519SHA256LibSSHzF
As L{_Curve25519SHA256}, but with a pre-standardized algorithm name.
r   Nr7   r   r   r   r:   r:   [   s   † ñð €JØ„Mr   r:   c                  ó"   € ] tR t^etRt^t]tRtR# )Ú_ECDH256a<  
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   Nr7   r   r   r   r<   r<   e   s   † ñ	ð €JØ„Mr   r<   c                  ó"   € ] tR t^vtRt^t]tRtR# )Ú_ECDH384zH
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   r>   r>   v   r8   r   r>   c                  ó"   € ] tR t^�tRt^t]tRtR# )Ú_ECDH512zH
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   r@   r@   �   r8   r   r@   c                  ó"   € ] tR t^ŒtRt^t]tRtR# )Ú_DHGroupExchangeSHA256zW
Diffie-Hellman Group and Key Exchange with SHA-256 as HASH. Defined in
RFC 4419, 4.2.
r   Nr7   r   r   r   rB   rB   Œ   r8   r   rB   c                  ó"   € ] tR t^—tRt^t]tRtR# )Ú_DHGroupExchangeSHA1zU
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   rD   rD   —   s   † ñð
 €JØ„Mr   rD   c                  ó6   € ] tR t^¢tRt^t]t]! R4      t	^t
RtR# )Ú_DHGroup14SHA1zu
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   N)r    r!   r"   r#   r*   r(   r   r)   r'   r.   r/   r$   r   r   r   rF   rF   ¢   s)   † ñð
 €JØ€Máð
	ó€Eð „Ir   rF   ó   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               ó    € V ^8„  d   QhRRRR/# )r   ÚkexAlgorithmr   r   r&   r   )r   s   "r   r   r   É   s   € ÷ (ñ (˜ð ( >ñ (r   c                óf   € V \         9  d   \        P                  ! RV : 24      h\         V ,          # )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: )rI   r   Ú
ConchError©rK   s   &r   ÚgetKexrO   É   s1   € ð œ>Ô)Ü×ÒÐ!EÀlÑEUÐVÓWÐWÜ˜,Õ'Ð'r   c               ó    € V ^8„  d   QhRRRR/# ©r   rK   r   r   Úboolr   )r   s   "r   r   r   Û   s   € ÷ 	Pñ 	P %ð 	P¨Dñ 	Pr   c                ó>   € \         P                  \        V 4      4      # )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}.
)r1   Ú
providedByrO   rN   s   &r   ÚisEllipticCurverU   Û   s   € ô /×9Ñ9¼&ÀÓ:NÓOÐOr   c               ó    € V ^8„  d   QhRRRR/# rQ   r   )r   s   "r   r   r   ç   s   € ÷ 	Eñ 	E˜uð 	E¨ñ 	Er   c                ó>   € \         P                  \        V 4      4      # )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-   rT   rO   rN   s   &r   ÚisFixedGrouprX   ç   s   € ô $×.Ñ.¬v°lÓ/CÓDÐDr   c               ó    € V ^8„  d   QhRRRR/# )r   rK   r   r   r   r   )r   s   "r   r   r   ó   s   € ÷ 	ñ 	 5ð 	¨\ñ 	r   c                ó0   € \        V 4      pVP                  # )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}).
)rO   r)   ©rK   Úkexs   & r   ÚgetHashProcessorr]   ó   s   € ô �Ó
€CØ×ÑÐr   c               ó    € V ^8„  d   QhRRRR/# )r   rK   r   r   ztuple[int, int]r   )r   s   "r   r   r   ÿ   s   € ÷ $ñ $¨ð $°?ñ $r   c                óZ   € \        \        V 4      4      pVP                  VP                  3# )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-   rO   r/   r.   r[   s   & r   ÚgetDHGeneratorAndPrimer`   ÿ   s&   € ô #¤6¨,Ó#7Ó
8€CØ�=‰=˜#Ÿ)™)Ð#Ð#r   c               ó   € V ^8„  d   QhRR/# )r   r   zlist[bytes]r   )r   s   "r   r   r     s   € ÷ ñ  +ñ r   c                 óÎ  a€ ^ RI Hp  ^ RIHp ^ RIHp V ! 4       p\        P                  4       o\        S4       F˜  pVP                  R4      '       d:   VP                  RR4      pVP                  VP                  4       W%,          4      pM*VP                  R4      '       d   VP                  4       pMRpV'       d   K‡  SP                  V4       Kš  	  \        SV3R lR	7      # )
z�
Get a list of supported key exchange algorithm names in order of
preference.

@return: A C{list} of supported key exchange algorithm names.
)Údefault_backend)Úec)Ú_curveTables   ecdhs   ecdsarH   Tc                ó*   <€ SV ,          P                   # r   )r(   )rK   ÚkexAlgorithmss   &€r   Ú<lambda>Ú*getSupportedKeyExchanges.<locals>.<lambda>(  s   ø€ °¸lÕ0K×0VÒ0Vr   )Úkey)Úcryptography.hazmat.backendsrc   Ú)cryptography.hazmat.primitives.asymmetricrd   Útwisted.conch.ssh.keysre   rI   ÚcopyÚlistÚ
startswithÚreplaceÚ+elliptic_curve_exchange_algorithm_supportedÚECDHÚx25519_supportedÚpopÚsorted)rc   rd   re   ÚbackendÚkeyAlgorithmÚkeyAlgorithmDsaÚ	supportedrg   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)(Ú__conditional_annotations__r*   Ú
__future__r   Úhashlibr   r   r   r   Útypingr   r   Úzope.interfacer	   r
   r   Útwisted.conchr   r   r   r&   r-   r1   r4   r6   r:   r<   r>   r@   rB   rD   rF   rI   r+   rO   rU   rX   r]   r`   r{   )r|   s   @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Ø"¡NÓ$4Ø™8›:Ø™8›:Ø™8›:ð	/€Ð+ó 	õ(õ$	Põ	Eõ	õ$÷r   