+
    üÐj,%  ã                   óp  € R t ^ RIt^ RIHtHt ^ RIHt ^ RIHtH	t	H
t
 ^ RIHtHt  ! R R]P                  4      t ! R R	]P                  4      t^t^t^t^t^t^	t^t^t^t^t^t^t^t/ t]! 4       PA                  4       PC                  4        F"  w  t"t#]"R
,          R8X  g   K  ]"R,          ]]#&   K$  	  R# )zÞ
Implements the SSH v2 key agent protocol.  This protocol is documented in the
SSH source code, in the file
U{PROTOCOL.agent<http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.agent>}.

Maintainer: Paul Swartz
N)Ú
ConchErrorÚMissingKeyStoreError)Úkeys)ÚNSÚgetMPÚgetNS)ÚdeferÚprotocolc                   ód   a € ] tR t^t o RtR tR tR tR tR t	RR lt
R tR	 tR
 tR tRtV tR# )ÚSSHAgentClientz­
The client side of the SSH agent protocol.  This is equivalent to
ssh-add(1) and can be used with either ssh-agent(1) or the SSHAgentServer
protocol, also in this package.
c                ó"   € R V n         . V n        R# ©ó    N©ÚbufÚ	deferreds©Úselfs   &Ú9/usr/lib/python3/dist-packages/twisted/conch/ssh/agent.pyÚ__init__ÚSSHAgentClient.__init__   s   € ØˆŒØˆŽr   c                ó‚  € V ;P                   V,          un          \        V P                   4      ^8:  d   R# \        P                  ! RV P                   R,          4      ^ ,          p\        V P                   4      ^V,           8  d   R# V P                   ^^V,            V P                   ^V,           R uq0n         \	        VR,          4      pV P
                  P                  ^ 4      pV\        8X  d   VP                  \        R4      4       Kô  V\        8X  d   VP                  R4       EK  VP                  V4       EK'  )é   Nú!LºNé   Nºé    r   Nzagent failurer   )r   ÚlenÚstructÚunpackÚordr   ÚpopÚAGENT_FAILUREÚerrbackr   ÚAGENT_SUCCESSÚcallback)r   ÚdataÚpackLenÚpacketÚreqTypeÚds   &&    r   ÚdataReceivedÚSSHAgentClient.dataReceived    sÞ   € Ø�Š�DÕ�ØÜ�4—8‘8‹} Ô!ÙÜ—m’m D¨$¯(©(°2­,Ó7¸Õ:ˆGÜ�4—8‘8‹}˜q 7�{Ô*ÙØ#Ÿx™x¨¨A°­KÐ8¸$¿(¹(À1ÀwÅ;À=Ð:QÐˆF”HÜ˜& �+Ó&ˆGØ—‘×"Ñ" 1Ó%ˆAØœ-Ô'Ø—	‘	œ* _Ó5Ö6ØœMÔ)Ø—
‘
˜3—à—
‘
˜6×"r   c                óú   € \         P                  ! R \        V4      ^,           V4      V,           pV P                  P	                  V4       \
        P                  ! 4       pV P                  P                  V4       V# )ú!LB)	r   Úpackr   Ú	transportÚwriter   ÚDeferredr   Úappend)r   r*   r'   r0   r+   s   &&&  r   ÚsendRequestÚSSHAgentClient.sendRequest2   sV   € Ü�{Š{˜5¤# d£)¨a¥-°Ó9¸DÕ@ˆØ�‰×Ñ˜TÔ"Ü�NŠNÓˆØ�‰×Ñ˜aÔ Øˆr   c                óh   € V P                  \        R4      pVP                  V P                  4       V# )z¤
@return: A L{Deferred} which will fire with a list of all keys found in
    the SSH agent. The list of keys is comprised of (public key blob,
    comment) tuples.
r   )r5   ÚAGENTC_REQUEST_IDENTITIESÚaddCallbackÚ_cbRequestIdentities)r   r+   s   & r   ÚrequestIdentitiesÚ SSHAgentClient.requestIdentities9   s.   € ð ×ÑÔ6¸Ó<ˆØ	�‰�d×/Ñ/Ô0Øˆr   c                ó\  € \        VR,          4      \        8w  d#   \        R\        VR,          4      ,          4      h\        P                  ! RVR,          4      ^ ,          p. pVR,          p\        V4       F/  p\        V4      w  rQ\        V4      w  raVP                  WV34       K1  	  V# )ze
Unpack a collection of identities into a list of tuples comprised of
public key blobs and comments.
r   zunexpected response: %ir   :r   é   N:r>   NN)r!   ÚAGENT_IDENTITIES_ANSWERr   r   r    Úranger   r4   )r   r'   ÚnumKeysÚresultÚiÚblobÚcomments   &&     r   r:   Ú#SSHAgentClient._cbRequestIdentitiesC   sŽ   € ô
 ˆt�C�y‹>Ô4Ô4ÜÐ6¼¸TÀ#½Y»ÕGÓHÐHÜ—-’-  d¨3¥iÓ0°Õ3ˆØˆØ�B�xˆÜ�w–ˆAÜ˜t›‰JˆDÜ! $›K‰MˆGØ�M‰M˜4˜/Ö*ñ  ð ˆr   c                óV   € TpV\        V4      ,          pV P                  \        V4      # )z;
Add a private key blob to the agent's collection of keys.
)r   r5   ÚAGENTC_ADD_IDENTITY)r   rD   rE   Úreqs   &&& r   ÚaddIdentityÚSSHAgentClient.addIdentityS   s+   € ð ˆØŒr�'‹{ÕˆØ×ÑÔ 3°SÓ9Ð9r   c                ó¬   € \        V4      pV\        V4      ,          pVR,          pV P                  \        V4      P                  V P                  4      # )aF  
Request that the agent sign the given C{data} with the private key
which corresponds to the public key given by C{blob}.  The private
key should have been added to the agent already.

@type blob: L{bytes}
@type data: L{bytes}
@return: A L{Deferred} which fires with a signature for given data
    created with the given key.
ó       )r   r5   ÚAGENTC_SIGN_REQUESTr9   Ú_cbSignData)r   rD   r'   rI   s   &&& r   ÚsignDataÚSSHAgentClient.signData[   sJ   € ô �‹hˆØŒr�$‹x�ˆØÐ"Õ"ˆØ×ÑÔ 3°SÓ9×EÑEÀd×FVÑFVÓWÐWr   c                ó²   € \        VR ,          4      \        8w  d#   \        R\        VR ,          4      ,          4      h\        VR,          4      ^ ,          pV# )r   zunexpected data: %iºr   NN)r!   ÚAGENT_SIGN_RESPONSEr   r   )r   r'   Ú	signatures   && r   rO   ÚSSHAgentClient._cbSignDatak   sD   € Üˆt�C�y‹>Ô0Ô0ÜÐ2´S¸¸c½³^ÕCÓDÐDÜ˜$˜r�(“O AÕ&ˆ	ØÐr   c                óD   € \        V4      pV P                  \        V4      # )zX
Remove the private key corresponding to the public key in blob from the
running agent.
)r   r5   ÚAGENTC_REMOVE_IDENTITY)r   rD   rI   s   && r   ÚremoveIdentityÚSSHAgentClient.removeIdentityq   s!   € ô
 �‹hˆØ×ÑÔ 6¸Ó<Ð<r   c                ó.   € V P                  \        R4      # )z)
Remove all keys from the running agent.
r   )r5   ÚAGENTC_REMOVE_ALL_IDENTITIESr   s   &r   ÚremoveAllIdentitiesÚ"SSHAgentClient.removeAllIdentitiesy   s   € ð ×ÑÔ <¸cÓBÐBr   r   N)r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r,   r5   r;   r:   rJ   rP   rO   rY   r]   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      sD   ø‡ € ñòò#ò$òòô :òXò ò=÷Cð Cr   r   c                   óf   a € ] tR t^€t o RtR t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# )ÚSSHAgentServerz­
The server side of the SSH agent protocol.  This is equivalent to
ssh-agent(1) and can be used with either ssh-add(1) or the SSHAgentClient
protocol, also in this package.
c                ó   € R V n         R# r   ©r   r   s   &r   r   ÚSSHAgentServer.__init__‡   s	   € ØˆŽr   c                óÀ  € V ;P                   V,          un          \        V P                   4      ^8:  d   R# \        P                  ! RV P                   R,          4      ^ ,          p\        V P                   4      ^V,           8  d   R# V P                   ^^V,            V P                   ^V,           R uq0n         \	        VR,          4      p\
        P                  VR4      pV'       g   V P                  \        R4       Kè  \        V RV,          4      p\        V P                  RR4      f!   V P                  \        R4       \        4       hV! VR,          4       EKF  )	r   Nr   r   r   r   z	agentc_%sr   rS   )r   r   r   r    r!   ÚmessagesÚgetÚsendResponser#   ÚgetattrÚfactoryr   )r   r'   r(   r)   r*   ÚreqNameÚfs   &&     r   r,   ÚSSHAgentServer.dataReceivedŠ   sý   € Ø�Š�DÕ�ØÜ�4—8‘8‹} Ô!ÙÜ—m’m D¨$¯(©(°2­,Ó7¸Õ:ˆGÜ�4—8‘8‹}˜q 7�{Ô*ÙØ#Ÿx™x¨¨A°­KÐ8¸$¿(¹(À1ÀwÅ;À=Ð:QÐˆF”HÜ˜& �+Ó&ˆGÜ—l‘l 7¨DÓ1ˆGßØ×!Ñ!¤-°Ö5ä˜D +°Õ"7Ó8�Ü˜4Ÿ<™<¨°Ó6Ò>Ø×%Ñ%¤m°SÔ9Ü.Ó0Ð0Ù�&˜•*—r   c                óš   € \         P                  ! R \        V4      ^,           V4      V,           pV P                  P	                  V4       R# )r/   N)r   r0   r   r1   r2   )r   r*   r'   r0   s   &&& r   rp   ÚSSHAgentServer.sendResponsež   s3   € Ü�{Š{˜5¤# d£)¨a¥-°Ó9¸DÕ@ˆØ�‰×Ñ˜TÖ"r   c                óÎ  € VR8X  g   Q h\        V P                  P                  4      p. pVP                  \        P
                  ! RV4      4       V P                  P                  P                  4        FG  w  rEVP                  \        VP                  4       4      4       VP                  \        V4      4       KI  	  V P                  \        RP                  V4      4       R# )zA
Return all of the identities that have been added to the server
r   r   N)r   rr   r   r4   r   r0   Úvaluesr   rD   rp   r?   Újoin)r   r'   rA   ÚrespÚkeyrE   s   &&    r   Úagentc_REQUEST_IDENTITIESÚ(SSHAgentServer.agentc_REQUEST_IDENTITIES¢   s    € ð �sŒ{Ðˆ{Ü�d—l‘l×'Ñ'Ó(ˆØˆà�‰”F—K’K  gÓ.Ô/Ø ŸL™L×-Ñ-×4Ñ4Ö6‰LˆCØ�K‰Kœ˜3Ÿ8™8›:›Ô'Ø�K‰Kœ˜7›Ö$ñ 7ð 	×ÑÔ1°3·8±8¸D³>ÖBr   c                óL  € \        V4      w  r!W P                  P                  9  d   V P                  \        R4      # \        V4      w  r1VR8X  g   Q hV P                  \
        \        V P                  P                  V,          ^ ,          P                  V4      4      4       R# )zÓ
Data is a structure with a reference to an already added key object and
some data that the clients wants signed with that key.  If the key
object wasn't loaded, return AGENT_FAILURE, else return the signature.
r   rM   N)r   rr   r   rp   r#   rT   r   Úsign)r   r'   rD   rP   s   &&  r   Úagentc_SIGN_REQUESTÚ"SSHAgentServer.agentc_SIGN_REQUEST°   sƒ   € ô ˜4“[‰
ˆØ—|‘|×(Ñ(Ô(Ø×$Ñ$¤]°CÓ8Ð8Ü˜t›‰ˆØÐ*Ô*Ð*Ð*Ø×ÑÜ¤ D§L¡L×$5Ñ$5°dÕ$;¸AÕ$>×$CÑ$CÀHÓ$MÓ!Nö	
r   c                ó~  € \        V4      w  r#VR8X  d   ^pM'VR8X  d   ^pM\        P                  ! RV,          4      h\        W44      R,          p\        V4      w  rS\        P                  P                  VRR7      pWe3V P                  P                  VP                  4       &   V P                  \        R4       R# )	z£
Adds a private key to the agent's collection of identities.  On
subsequent interactions, the private key can be accessed using only the
corresponding public key.
s   ssh-rsas   ssh-dsszunknown blob type: %sÚprivate_blob©Útyper   Néÿÿÿÿ)
r   r   ÚBadKeyErrorr   ÚKeyÚ
fromStringrr   rD   rp   r%   )r   r'   ÚkeyTypeÚrestÚnmprE   Úks   &&     r   Úagentc_ADD_IDENTITYÚ"SSHAgentServer.agentc_ADD_IDENTITY¿   s¤   € ô ˜d›‰ˆØ�jÔ Ø‰CØ˜
Ô"Ø‰Cä×"Ò"Ð#:¸WÕ#DÓEÐEä�TÓØõ
ˆô ˜d›‰ˆä�H‰H×Ñ ¨>ÐÓ:ˆØ'( lˆ�‰×Ñ˜!Ÿ&™&›(Ñ#Ø×Ñœ-¨Ö-r   c                óØ   € \        V4      w  r#\        P                  P                  VRR7      pV P                  P                  VP                  4        V P                  \        R4       R# )zB
Remove a specific key from the agent's collection of identities.
rD   r…   r   N)r   r   r‰   rŠ   rr   rD   rp   r%   )r   r'   rD   Ú_rŽ   s   &&   r   Úagentc_REMOVE_IDENTITYÚ%SSHAgentServer.agentc_REMOVE_IDENTITYØ   sP   € ô ˜“+‰ˆÜ�H‰H×Ñ ¨6ÐÓ2ˆØ�L‰L×Ñ˜aŸf™f›hÐ'Ø×Ñœ-¨Ö-r   c                óf   € VR8X  g   Q h/ V P                   n        V P                  \        R4       R# )z<
Remove all keys from the agent's collection of identities.
r   N)rr   r   rp   r%   ©r   r'   s   &&r   Úagentc_REMOVE_ALL_IDENTITIESÚ+SSHAgentServer.agentc_REMOVE_ALL_IDENTITIESá   s,   € ð �sŒ{Ðˆ{Øˆ�‰ÔØ×Ñœ-¨Ö-r   c                ó\   € V P                  \        \        P                  ! R^ 4      4       R# )zo
v1 message for listing RSA1 keys; superseded by
agentc_REQUEST_IDENTITIES, which handles different key types.
r   N)rp   ÚAGENT_RSA_IDENTITIES_ANSWERr   r0   r–   s   &&r   Úagentc_REQUEST_RSA_IDENTITIESÚ,SSHAgentServer.agentc_REQUEST_RSA_IDENTITIESí   s    € ð
 	×ÑÔ5´v·{²{À4ÈÓ7KÖLr   c                ó2   € V P                  \        R4       R# )zm
v1 message for removing RSA1 keys; superseded by
agentc_REMOVE_IDENTITY, which handles different key types.
r   N©rp   r%   r–   s   &&r   Úagentc_REMOVE_RSA_IDENTITYÚ)SSHAgentServer.agentc_REMOVE_RSA_IDENTITYô   ó   € ð
 	×Ñœ-¨Ö-r   c                ó2   € V P                  \        R4       R# )zw
v1 message for removing all RSA1 keys; superseded by
agentc_REMOVE_ALL_IDENTITIES, which handles different key types.
r   Nrž   r–   s   &&r   Ú agentc_REMOVE_ALL_RSA_IDENTITIESÚ/SSHAgentServer.agentc_REMOVE_ALL_RSA_IDENTITIESû   r¡   r   rk   N)r_   r`   ra   rb   rc   r   r,   rp   r}   r�   r�   r“   r—   r›   rŸ   r£   rd   re   rf   s   @r   ri   ri   €   sH   ø‡ € ñòòò(#òCò
ò.ò2.ò.òMò.÷.ð .r   ri   :Né   NÚAGENTC_:r¥   NN)$rc   r   Útwisted.conch.errorr   r   Útwisted.conch.sshr   Útwisted.conch.ssh.commonr   r   r   Útwisted.internetr   r	   ÚProtocolr   ri   ÚAGENTC_REQUEST_RSA_IDENTITIESrš   r#   r%   ÚAGENTC_REMOVE_RSA_IDENTITYÚ AGENTC_REMOVE_ALL_RSA_IDENTITIESr8   r?   rN   rT   rH   rX   r\   rn   ÚlocalsÚcopyÚitemsÚnameÚvalue© r   r   Ú<module>rµ      sÕ   ðñó ç @Ý "ß 5Ñ 5ß ,ôhC�X×&Ñ&ô hCôV@.�X×&Ñ&ô @.ðF !"Ð ØÐ Ø€Ø€àÐ Ø#$Ð  àÐ ØÐ ØÐ ØÐ ØÐ ØÐ Ø!Ð à€Ù“8—=‘=“?×(Ñ(Ö*�K€Dˆ%ØˆB…x�9ÖØ˜r�(ˆ�‹ó +r   