1180750SdesThis describes the protocol used by OpenSSH's ssh-agent.
2180750Sdes
3180750SdesOpenSSH's agent supports managing keys for the standard SSH protocol
4180750Sdes2 as well as the legacy SSH protocol 1. Support for these key types
5180750Sdesis almost completely disjoint - in all but a few cases, operations on
6180750Sdesprotocol 2 keys cannot see or affect protocol 1 keys and vice-versa.
7180750Sdes
8180750SdesProtocol 1 and protocol 2 keys are separated because of the differing
9180750Sdescryptographic usage: protocol 1 private RSA keys are used to decrypt
10180750Sdeschallenges that were encrypted with the corresponding public key,
11180750Sdeswhereas protocol 2 RSA private keys are used to sign challenges with
12180750Sdesa private key for verification with the corresponding public key. It
13180750Sdesis considered unsound practice to use the same key for signing and
14180750Sdesencryption.
15180750Sdes
16180750SdesWith a couple of exceptions, the protocol message names used in this
17180750Sdesdocument indicate which type of key the message relates to. SSH_*
18180750Sdesmessages refer to protocol 1 keys only. SSH2_* messages refer to
19180750Sdesprotocol 2 keys. Furthermore, the names also indicate whether the
20180750Sdesmessage is a request to the agent (*_AGENTC_*) or a reply from the
21180750Sdesagent (*_AGENT_*). Section 3 below contains the mapping of the
22180750Sdesprotocol message names to their integer values.
23180750Sdes
24180750Sdes1. Data types
25180750Sdes
26180750SdesBecause of support for legacy SSH protocol 1 keys, OpenSSH's agent
27180750Sdesprotocol makes use of some data types not defined in RFC 4251.
28180750Sdes
29180750Sdes1.1 uint16
30180750Sdes
31180750SdesThe "uint16" data type is a simple MSB-first 16 bit unsigned integer
32180750Sdesencoded in two bytes.
33180750Sdes
34180750Sdes1.2 mpint1
35180750Sdes
36180750SdesThe "mpint1" type represents an arbitrary precision integer (bignum).
37180750SdesIts format is as follows:
38180750Sdes
39180750Sdes	uint16			bits
40180750Sdes	byte[(bits + 7) / 8]	bignum
41180750Sdes
42180750Sdes"bignum" contains an unsigned arbitrary precision integer encoded as
43180750Sdeseight bits per byte in big-endian (MSB first) format.
44180750Sdes
45180750SdesNote the difference between the "mpint1" encoding and the "mpint"
46180750Sdesencoding defined in RFC 4251. Also note that the length of the encoded
47180750Sdesinteger is specified in bits, not bytes and that the byte length of
48180750Sdesthe integer must be calculated by rounding up the number of bits to the
49180750Sdesnearest eight.
50180750Sdes
51180750Sdes2. Protocol Messages
52180750Sdes
53180750SdesAll protocol messages are prefixed with their length in bytes, encoded
54180750Sdesas a 32 bit unsigned integer. Specifically:
55180750Sdes
56180750Sdes	uint32			message_length
57180750Sdes	byte[message_length]	message
58180750Sdes
59180750SdesThe following message descriptions refer only to the content the
60180750Sdes"message" field.
61180750Sdes
62180750Sdes2.1 Generic server responses
63180750Sdes
64180750SdesThe following generic messages may be sent by the server in response to
65180750Sdesrequests from the client. On success the agent may reply either with:
66180750Sdes
67180750Sdes	byte			SSH_AGENT_SUCCESS
68180750Sdes
69180750Sdesor a request-specific success message.
70180750Sdes
71180750SdesOn failure, the agent may reply with:
72180750Sdes
73180750Sdes	byte			SSH_AGENT_FAILURE
74180750Sdes
75180750SdesSSH_AGENT_FAILURE messages are also sent in reply to unknown request
76180750Sdestypes.
77180750Sdes
78180750Sdes2.2 Adding keys to the agent
79180750Sdes
80180750SdesKeys are added to the agent using the SSH_AGENTC_ADD_RSA_IDENTITY and
81180750SdesSSH2_AGENTC_ADD_IDENTITY requests for protocol 1 and protocol 2 keys
82180750Sdesrespectively.
83180750Sdes
84180750SdesTwo variants of these requests are SSH_AGENTC_ADD_RSA_ID_CONSTRAINED
85180750Sdesand SSH2_AGENTC_ADD_ID_CONSTRAINED - these add keys with optional
86180750Sdes"constraints" on their usage.
87180750Sdes
88180750SdesOpenSSH may be built with support for keys hosted on a smartcard
89180750Sdesor other hardware security module. These keys may be added
90180750Sdesto the agent using the SSH_AGENTC_ADD_SMARTCARD_KEY and
91180750SdesSSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED requests.
92180750Sdes
93180750Sdes2.2.1 Key constraints
94180750Sdes
95180750SdesThe OpenSSH agent supports some basic optional constraints on key usage.
96180750SdesAt present there are two constraints defined.
97180750Sdes
98180750SdesThe first constraint limits the validity duration of a key. It is
99180750Sdesencoded as:
100180750Sdes
101180750Sdes	byte			SSH_AGENT_CONSTRAIN_LIFETIME
102180750Sdes	uint32			seconds
103180750Sdes
104180750SdesWhere "seconds" contains the number of seconds that the key shall remain
105180750Sdesvalid measured from the moment that the agent receives it. After the
106180750Sdesvalidity period has expired, OpenSSH's agent will erase these keys from
107180750Sdesmemory.
108180750Sdes
109180750SdesThe second constraint requires the agent to seek explicit user
110180750Sdesconfirmation before performing private key operations with the loaded
111180750Sdeskey. This constraint is encoded as:
112180750Sdes
113180750Sdes	byte			SSH_AGENT_CONSTRAIN_CONFIRM
114180750Sdes
115180750SdesZero or more constraints may be specified when adding a key with one
116180750Sdesof the *_CONSTRAINED requests. Multiple constraints are appended
117180750Sdesconsecutively to the end of the request:
118180750Sdes
119180750Sdes	byte			constraint1_type
120180750Sdes	....			constraint1_data
121180750Sdes	byte			constraint2_type
122180750Sdes	....			constraint2_data
123180750Sdes	....
124180750Sdes	byte			constraintN_type
125180750Sdes	....			constraintN_data
126180750Sdes
127180750SdesSuch a sequence of zero or more constraints will be referred to below
128180750Sdesas "constraint[]". Agents may determine whether there are constraints
129180750Sdesby checking whether additional data exists in the "add key" request
130180750Sdesafter the key data itself. OpenSSH will refuse to add a key if it
131180750Sdescontains unknown constraints.
132180750Sdes
133180750Sdes2.2.2 Add protocol 1 key
134180750Sdes
135180750SdesA client may add a protocol 1 key to an agent with the following
136180750Sdesrequest:
137180750Sdes
138180750Sdes	byte			SSH_AGENTC_ADD_RSA_IDENTITY or
139180750Sdes				SSH_AGENTC_ADD_RSA_ID_CONSTRAINED
140180750Sdes	uint32			ignored
141180750Sdes	mpint1			rsa_n
142180750Sdes	mpint1			rsa_e
143180750Sdes	mpint1			rsa_d
144180750Sdes	mpint1			rsa_iqmp
145180750Sdes	mpint1			rsa_q
146180750Sdes	mpint1			rsa_p
147180750Sdes	string			key_comment
148180750Sdes	constraint[]		key_constraints
149180750Sdes
150180750SdesNote that there is some redundancy in the key parameters; a key could be
151180750Sdesfully specified using just rsa_q, rsa_p and rsa_e at the cost of extra
152180750Sdescomputation.
153180750Sdes
154180750Sdes"key_constraints" may only be present if the request type is
155251135SdesSSH_AGENTC_ADD_RSA_ID_CONSTRAINED.
156180750Sdes
157180750SdesThe agent will reply with a SSH_AGENT_SUCCESS if the key has been
158180750Sdessuccessfully added or a SSH_AGENT_FAILURE if an error occurred.
159180750Sdes
160180750Sdes2.2.3 Add protocol 2 key
161180750Sdes
162221420SdesThe OpenSSH agent supports DSA, ECDSA and RSA keys for protocol 2. DSA
163221420Sdeskeys may be added using the following request
164180750Sdes
165180750Sdes	byte			SSH2_AGENTC_ADD_IDENTITY or
166180750Sdes				SSH2_AGENTC_ADD_ID_CONSTRAINED
167180750Sdes	string			"ssh-dss"
168180750Sdes	mpint			dsa_p
169180750Sdes	mpint			dsa_q
170180750Sdes	mpint			dsa_g
171180750Sdes	mpint			dsa_public_key
172180750Sdes	mpint			dsa_private_key
173180750Sdes	string			key_comment
174180750Sdes	constraint[]		key_constraints
175180750Sdes
176204917SdesDSA certificates may be added with:
177204917Sdes	byte			SSH2_AGENTC_ADD_IDENTITY or
178204917Sdes				SSH2_AGENTC_ADD_ID_CONSTRAINED
179204917Sdes	string			"ssh-dss-cert-v00@openssh.com"
180204917Sdes	string			certificate
181204917Sdes	mpint			dsa_private_key
182204917Sdes	string			key_comment
183204917Sdes	constraint[]		key_constraints
184204917Sdes
185221420SdesECDSA keys may be added using the following request
186221420Sdes
187221420Sdes	byte			SSH2_AGENTC_ADD_IDENTITY or
188221420Sdes				SSH2_AGENTC_ADD_ID_CONSTRAINED
189221420Sdes	string			"ecdsa-sha2-nistp256" |
190221420Sdes				"ecdsa-sha2-nistp384" |
191221420Sdes				"ecdsa-sha2-nistp521"
192221420Sdes	string			ecdsa_curve_name
193221420Sdes	string			ecdsa_public_key
194221420Sdes	mpint			ecdsa_private
195221420Sdes	string			key_comment
196221420Sdes	constraint[]		key_constraints
197221420Sdes
198221420SdesECDSA certificates may be added with:
199221420Sdes	byte			SSH2_AGENTC_ADD_IDENTITY or
200221420Sdes				SSH2_AGENTC_ADD_ID_CONSTRAINED
201221420Sdes	string			"ecdsa-sha2-nistp256-cert-v01@openssh.com" |
202221420Sdes				"ecdsa-sha2-nistp384-cert-v01@openssh.com" |
203221420Sdes				"ecdsa-sha2-nistp521-cert-v01@openssh.com"
204221420Sdes	string			certificate
205221420Sdes	mpint			ecdsa_private_key
206221420Sdes	string			key_comment
207221420Sdes	constraint[]		key_constraints
208221420Sdes
209180750SdesRSA keys may be added with this request:
210180750Sdes
211180750Sdes	byte			SSH2_AGENTC_ADD_IDENTITY or
212180750Sdes				SSH2_AGENTC_ADD_ID_CONSTRAINED
213180750Sdes	string			"ssh-rsa"
214180750Sdes	mpint			rsa_n
215180750Sdes	mpint			rsa_e
216180750Sdes	mpint			rsa_d
217180750Sdes	mpint			rsa_iqmp
218180750Sdes	mpint			rsa_p
219180750Sdes	mpint			rsa_q
220180750Sdes	string			key_comment
221180750Sdes	constraint[]		key_constraints
222180750Sdes
223204917SdesRSA certificates may be added with this request:
224204917Sdes
225204917Sdes	byte			SSH2_AGENTC_ADD_IDENTITY or
226204917Sdes				SSH2_AGENTC_ADD_ID_CONSTRAINED
227204917Sdes	string			"ssh-rsa-cert-v00@openssh.com"
228204917Sdes	string			certificate
229204917Sdes	mpint			rsa_d
230204917Sdes	mpint			rsa_iqmp
231204917Sdes	mpint			rsa_p
232204917Sdes	mpint			rsa_q
233204917Sdes	string			key_comment
234204917Sdes	constraint[]		key_constraints
235204917Sdes
236180750SdesNote that the 'rsa_p' and 'rsa_q' parameters are sent in the reverse
237180750Sdesorder to the protocol 1 add keys message. As with the corresponding
238180750Sdesprotocol 1 "add key" request, the private key is overspecified to avoid
239180750Sdesredundant processing.
240180750Sdes
241221420SdesFor DSA, ECDSA and RSA key add requests, "key_constraints" may only be
242180750Sdespresent if the request type is SSH2_AGENTC_ADD_ID_CONSTRAINED.
243180750Sdes
244180750SdesThe agent will reply with a SSH_AGENT_SUCCESS if the key has been
245180750Sdessuccessfully added or a SSH_AGENT_FAILURE if an error occurred.
246180750Sdes
247180750Sdes2.2.4 Loading keys from a smartcard
248180750Sdes
249180750SdesThe OpenSSH agent may have optional smartcard support built in to it. If
250180750Sdesso, it supports an operation to load keys from a smartcard. Technically,
251180750Sdesonly the public components of the keys are loaded into the agent so
252180750Sdesthis operation really arranges for future private key operations to be
253180750Sdesdelegated to the smartcard.
254180750Sdes
255180750Sdes	byte			SSH_AGENTC_ADD_SMARTCARD_KEY or
256180750Sdes				SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED
257180750Sdes	string			reader_id
258180750Sdes	string			pin
259180750Sdes	constraint[]		key_constraints
260180750Sdes
261180750Sdes"reader_id" is an identifier to a smartcard reader and "pin"
262180750Sdesis a PIN or passphrase used to unlock the private key(s) on the
263180750Sdesdevice. "key_constraints" may only be present if the request type is
264180750SdesSSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED.
265180750Sdes
266180750SdesThis operation may load all SSH keys that are unlocked using the
267180750Sdes"pin" on the specified reader. The type of key loaded (protocol 1
268180750Sdesor protocol 2) will be specified by the smartcard itself, it is not
269180750Sdesclient-specified.
270180750Sdes
271180750SdesThe agent will reply with a SSH_AGENT_SUCCESS if one or more keys have
272180750Sdesbeen successfully loaded or a SSH_AGENT_FAILURE if an error occurred.
273180750SdesThe agent will also return SSH_AGENT_FAILURE if it does not support
274180750Sdessmartcards.
275180750Sdes
276180750Sdes2.3 Removing multiple keys
277180750Sdes
278180750SdesA client may request that an agent delete all protocol 1 keys using the
279180750Sdesfollowing request:
280180750Sdes
281180750Sdes	byte			SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES
282180750Sdes
283180750SdesThis message requests the deletion of all protocol 2 keys:
284180750Sdes
285180750Sdes	byte			SSH2_AGENTC_REMOVE_ALL_IDENTITIES
286180750Sdes
287180750SdesOn success, the agent will delete all keys of the requested type and
288180750Sdesreply with a SSH_AGENT_SUCCESS message. If an error occurred, the agent
289180750Sdeswill reply with SSH_AGENT_FAILURE.
290180750Sdes
291180750SdesNote that, to delete all keys (both protocol 1 and 2), a client
292180750Sdesmust send both a SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES and a
293180750SdesSSH2_AGENTC_REMOVE_ALL_IDENTITIES request.
294180750Sdes
295180750Sdes2.4 Removing specific keys
296180750Sdes
297180750Sdes2.4.1 Removing a protocol 1 key
298180750Sdes
299180750SdesRemoval of a protocol 1 key may be requested with the following message:
300180750Sdes
301180750Sdes	byte 			SSH_AGENTC_REMOVE_RSA_IDENTITY
302180750Sdes	uint32			key_bits
303180750Sdes	mpint1			rsa_e
304180750Sdes	mpint1			rsa_n
305180750Sdes
306180750SdesNote that key_bits is strictly redundant, as it may be inferred by the
307180750Sdeslength of rsa_n.
308180750Sdes
309180750SdesThe agent will delete any private key matching the specified public key
310180750Sdesand return SSH_AGENT_SUCCESS. If no such key was found, the agent will
311180750Sdesreturn SSH_AGENT_FAILURE.
312180750Sdes
313180750Sdes2.4.2 Removing a protocol 2 key
314180750Sdes
315180750SdesProtocol 2 keys may be removed with the following request:
316180750Sdes
317180750Sdes	byte			SSH2_AGENTC_REMOVE_IDENTITY
318180750Sdes	string			key_blob
319180750Sdes
320180750SdesWhere "key_blob" is encoded as per RFC 4253 section 6.6 "Public Key
321221420SdesAlgorithms" for any of the supported protocol 2 key types.
322180750Sdes
323180750SdesThe agent will delete any private key matching the specified public key
324180750Sdesand return SSH_AGENT_SUCCESS. If no such key was found, the agent will
325180750Sdesreturn SSH_AGENT_FAILURE.
326180750Sdes
327180750Sdes2.4.3 Removing keys loaded from a smartcard
328180750Sdes
329180750SdesA client may request that a server remove one or more smartcard-hosted
330180750Sdeskeys using this message:
331180750Sdes
332180750Sdes	byte			SSH_AGENTC_REMOVE_SMARTCARD_KEY
333180750Sdes	string			reader_id
334180750Sdes	string			pin
335180750Sdes
336180750Sdes"reader_id" the an identifier to a smartcard reader and "pin" is a PIN
337180750Sdesor passphrase used to unlock the private key(s) on the device.
338180750Sdes
339180750SdesWhen this message is received, and if the agent supports
340180750Sdessmartcard-hosted keys, it will delete all keys that are hosted on the
341180750Sdesspecified smartcard that may be accessed with the given "pin".
342180750Sdes
343180750SdesThe agent will reply with a SSH_AGENT_SUCCESS if one or more keys have
344180750Sdesbeen successfully removed or a SSH_AGENT_FAILURE if an error occurred.
345180750SdesThe agent will also return SSH_AGENT_FAILURE if it does not support
346180750Sdessmartcards.
347180750Sdes
348180750Sdes2.5 Requesting a list of known keys
349180750Sdes
350180750SdesAn agent may be requested to list which keys it holds. Different
351180750Sdesrequests exist for protocol 1 and protocol 2 keys.
352180750Sdes
353180750Sdes2.5.1 Requesting a list of protocol 1 keys
354180750Sdes
355180750SdesTo request a list of protocol 1 keys that are held in the agent, a
356180750Sdesclient may send the following message:
357180750Sdes
358180750Sdes	byte			SSH_AGENTC_REQUEST_RSA_IDENTITIES
359180750Sdes
360180750SdesThe agent will reply with the following message:
361180750Sdes
362180750Sdes	byte			SSH_AGENT_RSA_IDENTITIES_ANSWER
363180750Sdes	uint32			num_keys
364180750Sdes
365180750SdesFollowed by zero or more consecutive keys, encoded as:
366180750Sdes
367180750Sdes	uint32			bits
368180750Sdes	mpint1			rsa_e
369180750Sdes	mpint1			rsa_n
370180750Sdes	string			key_comment
371180750Sdes
372180750Sdes2.5.2 Requesting a list of protocol 2 keys
373180750Sdes
374180750SdesA client may send the following message to request a list of
375180750Sdesprotocol 2 keys that are stored in the agent:
376180750Sdes
377180750Sdes	byte			SSH2_AGENTC_REQUEST_IDENTITIES
378180750Sdes
379180750SdesThe agent will reply with the following message header:
380180750Sdes
381180750Sdes	byte			SSH2_AGENT_IDENTITIES_ANSWER
382180750Sdes	uint32			num_keys
383180750Sdes
384180750SdesFollowed by zero or more consecutive keys, encoded as:
385180750Sdes
386180750Sdes	string			key_blob
387180750Sdes	string			key_comment
388180750Sdes
389180750SdesWhere "key_blob" is encoded as per RFC 4253 section 6.6 "Public Key
390221420SdesAlgorithms" for any of the supported protocol 2 key types.
391180750Sdes
392180750Sdes2.6 Private key operations
393180750Sdes
394180750SdesThe purpose of the agent is to perform private key operations, such as
395180750Sdessigning and encryption without requiring a passphrase to unlock the
396180750Sdeskey and without allowing the private key itself to be exposed. There
397180750Sdesare separate requests for the protocol 1 and protocol 2 private key
398180750Sdesoperations.
399180750Sdes
400180750Sdes2.6.1 Protocol 1 private key challenge
401180750Sdes
402180750SdesThe private key operation used in version 1 of the SSH protocol is
403180750Sdesdecrypting a challenge that has been encrypted with a public key.
404180750SdesIt may be requested using this message:
405180750Sdes
406180750Sdes	byte			SSH_AGENTC_RSA_CHALLENGE
407180750Sdes	uint32			ignored
408180750Sdes	mpint1			rsa_e
409180750Sdes	mpint1			rsa_n
410180750Sdes	mpint1			encrypted_challenge
411180750Sdes	byte[16]		session_id
412180750Sdes	uint32			response_type /* must be 1 */
413180750Sdes
414180750Sdes"rsa_e" and "rsa_n" are used to identify which private key to use.
415180750Sdes"encrypted_challenge" is a challenge blob that has (presumably)
416180750Sdesbeen encrypted with the public key and must be in the range 
417180750Sdes1 <= encrypted_challenge < 2^256. "session_id" is the SSH protocol 1
418180750Sdessession ID (computed from the server host key, the server semi-ephemeral
419180750Sdeskey and the session cookie).
420180750Sdes
421180750Sdes"ignored" and "response_type" exist for compatibility with legacy
422180750Sdesimplementations. "response_type" must be equal to 1; other response
423180750Sdestypes are not supported.
424180750Sdes
425180750SdesOn receiving this request, the server decrypts the "encrypted_challenge"
426180750Sdesusing the private key matching the supplied (rsa_e, rsa_n) values. For
427180750Sdesthe response derivation, the decrypted challenge is represented as an
428180750Sdesunsigned, big-endian integer encoded in a 32 byte buffer (i.e. values
429180750Sdessmaller than 2^248 will have leading 0 bytes).
430180750Sdes
431180750SdesThe response value is then calculated as:
432180750Sdes
433180750Sdes	response = MD5(decrypted_challenge || session_id)
434180750Sdes
435180750Sdesand returned in the following message
436180750Sdes
437180750Sdes	byte			SSH_AGENT_RSA_RESPONSE
438180750Sdes	byte[16]		response
439180750Sdes
440180750SdesIf the agent cannot find the key specified by the supplied (rsa_e,
441180750Sdesrsa_n) then it will return SSH_AGENT_FAILURE.
442180750Sdes
443180750Sdes2.6.2 Protocol 2 private key signature request
444180750Sdes
445180750SdesA client may use the following message to request signing of data using
446180750Sdesa protocol 2 key:
447180750Sdes
448180750Sdes	byte			SSH2_AGENTC_SIGN_REQUEST
449180750Sdes	string			key_blob
450180750Sdes	string			data
451180750Sdes	uint32			flags
452180750Sdes
453180750SdesWhere "key_blob" is encoded as per RFC 4253 section 6.6 "Public Key
454221420SdesAlgorithms" for any of the supported protocol 2 key types. "flags" is
455221420Sdesa bit-mask, but at present only one possible value is defined (see below
456221420Sdesfor its meaning):
457180750Sdes
458180750Sdes	SSH_AGENT_OLD_SIGNATURE		1
459180750Sdes
460180750SdesUpon receiving this request, the agent will look up the private key that
461180750Sdescorresponds to the public key contained in key_blob. It will use this
462180750Sdesprivate key to sign the "data" and produce a signature blob using the
463180750Sdeskey type-specific method described in RFC 4253 section 6.6 "Public Key
464180750SdesAlgorithms".
465180750Sdes
466180750SdesAn exception to this is for "ssh-dss" keys where the "flags" word
467180750Sdescontains the value SSH_AGENT_OLD_SIGNATURE. In this case, a legacy
468180750Sdessignature encoding is used in lieu of the standard one. In this case,
469180750Sdesthe DSA signature blob is encoded as:
470180750Sdes
471180750Sdes	byte[40]		signature
472180750Sdes
473180750SdesThe signature will be returned in the response message:
474180750Sdes
475180750Sdes	byte			SSH2_AGENT_SIGN_RESPONSE
476180750Sdes	string			signature_blob
477180750Sdes
478180750SdesIf the agent cannot find the key specified by the supplied key_blob then
479180750Sdesit will return SSH_AGENT_FAILURE.
480180750Sdes
481180750Sdes2.7 Locking or unlocking an agent
482180750Sdes
483180750SdesThe agent supports temporary locking with a passphrase to suspend
484180750Sdesprocessing of sensitive operations until it has been unlocked with the
485180750Sdessame passphrase. To lock an agent, a client send the following request:
486180750Sdes
487180750Sdes	byte			SSH_AGENTC_LOCK
488180750Sdes	string			passphrase
489180750Sdes
490180750SdesUpon receipt of this message and if the agent is not already locked,
491180750Sdesit will suspend processing requests and return a SSH_AGENT_SUCCESS
492180750Sdesreply. If the agent is already locked, it will return SSH_AGENT_FAILURE.
493180750Sdes
494180750SdesWhile locked, the agent will refuse all requests except
495180750SdesSSH_AGENTC_UNLOCK, SSH_AGENTC_REQUEST_RSA_IDENTITIES and
496180750SdesSSH2_AGENTC_REQUEST_IDENTITIES. The "request identities" requests are
497180750Sdestreated specially by a locked agent: it will always return an empty list
498180750Sdesof keys.
499180750Sdes
500180750SdesTo unlock an agent, a client may request:
501180750Sdes
502180750Sdes	byte			SSH_AGENTC_UNLOCK
503180750Sdes	string			passphrase
504180750Sdes
505180750SdesIf the passphrase matches and the agent is locked, then it will resume
506180750Sdesprocessing all requests and return SSH_AGENT_SUCCESS. If the agent
507180750Sdesis not locked or the passphrase does not match then it will return
508180750SdesSSH_AGENT_FAILURE.
509180750Sdes
510180750SdesLocking and unlocking affects both protocol 1 and protocol 2 keys.
511180750Sdes
512180750Sdes3. Protocol message numbers
513180750Sdes
514180750Sdes3.1 Requests from client to agent for protocol 1 key operations
515180750Sdes
516180750Sdes	SSH_AGENTC_REQUEST_RSA_IDENTITIES		1
517180750Sdes	SSH_AGENTC_RSA_CHALLENGE			3
518180750Sdes	SSH_AGENTC_ADD_RSA_IDENTITY			7
519180750Sdes	SSH_AGENTC_REMOVE_RSA_IDENTITY			8
520180750Sdes	SSH_AGENTC_REMOVE_ALL_RSA_IDENTITIES		9
521180750Sdes	SSH_AGENTC_ADD_RSA_ID_CONSTRAINED		24
522180750Sdes
523180750Sdes3.2 Requests from client to agent for protocol 2 key operations
524180750Sdes
525180750Sdes	SSH2_AGENTC_REQUEST_IDENTITIES			11
526180750Sdes	SSH2_AGENTC_SIGN_REQUEST			13
527180750Sdes	SSH2_AGENTC_ADD_IDENTITY			17
528180750Sdes	SSH2_AGENTC_REMOVE_IDENTITY			18
529180750Sdes	SSH2_AGENTC_REMOVE_ALL_IDENTITIES		19
530180750Sdes	SSH2_AGENTC_ADD_ID_CONSTRAINED			25
531180750Sdes
532180750Sdes3.3 Key-type independent requests from client to agent
533180750Sdes
534180750Sdes	SSH_AGENTC_ADD_SMARTCARD_KEY			20
535180750Sdes	SSH_AGENTC_REMOVE_SMARTCARD_KEY			21
536180750Sdes	SSH_AGENTC_LOCK					22
537180750Sdes	SSH_AGENTC_UNLOCK				23
538180750Sdes	SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED	26
539180750Sdes
540180750Sdes3.4 Generic replies from agent to client
541180750Sdes
542180750Sdes	SSH_AGENT_FAILURE				5
543180750Sdes	SSH_AGENT_SUCCESS				6
544180750Sdes
545180750Sdes3.5 Replies from agent to client for protocol 1 key operations
546180750Sdes
547180750Sdes	SSH_AGENT_RSA_IDENTITIES_ANSWER			2
548180750Sdes	SSH_AGENT_RSA_RESPONSE				4
549180750Sdes
550180750Sdes3.6 Replies from agent to client for protocol 2 key operations
551180750Sdes
552180750Sdes	SSH2_AGENT_IDENTITIES_ANSWER			12
553180750Sdes	SSH2_AGENT_SIGN_RESPONSE			14
554180750Sdes
555180750Sdes3.7 Key constraint identifiers
556180750Sdes
557180750Sdes	SSH_AGENT_CONSTRAIN_LIFETIME			1
558180750Sdes	SSH_AGENT_CONSTRAIN_CONFIRM			2
559180750Sdes
560251135Sdes$OpenBSD: PROTOCOL.agent,v 1.7 2013/01/02 00:33:49 djm Exp $
561