Skip to main content

Module ssh_agent

Module ssh_agent 

Source
Expand description

The OpenSSH agent protocol (R32), the part that needs no socket.

unv ssh-agent lets ssh use a key that lives in the vault and never in ~/.ssh. The agent answers two questions: which keys do you hold (REQUEST_IDENTITIES) and sign this for me (SIGN_REQUEST). It never returns a private key: the only things that leave are public key blobs, comments and signatures. Anything else, including adding or removing keys, is refused with FAILURE.

Wire format (draft-miller-ssh-agent): a message is a uint32 length, a type byte and a body; strings are a uint32 length and bytes. Signing is done by the reviewed ssh-key crate, not by code here. Only Ed25519 keys are accepted; an encrypted key, or any other algorithm, is skipped at load time and counted so the caller can say so.

Structs§

AgentKey
One key the agent holds: its public blob, its comment, and the private half it signs with.

Constants§

FAILURE
IDENTITIES_ANSWER
MAX_MESSAGE
The largest message accepted from a client. A sign request carries a hash-sized challenge or a session blob; nothing legitimate comes near this.
REQUEST_IDENTITIES
SIGN_REQUEST
SIGN_RESPONSE

Functions§

handle
The answer to one request payload (type byte and body, without the length prefix). Returns the reply payload and, when a signature was made, the comment of the key that made it, so the caller can audit it.
serve
Serves one client over any byte stream until it closes, calling signed(comment) after each signature. A message over MAX_MESSAGE ends the connection without being read.