{"modulePath":"github.com/generaltso/gogs","version":"v0.7.0","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package agent\n\n\tPackage agent implements a client to an ssh-agent daemon.\n\nReferences:\n\n\t[PROTOCOL.agent]:    http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.agent?rev=HEAD\n\n## Functions\n\n```go\nfunc ForwardToAgent(client *ssh.Client, keyring Agent) error\n```\nForwardToAgent routes authentication requests to the given keyring.\n\n```go\nfunc ForwardToRemote(client *ssh.Client, addr string) error\n```\nForwardToRemote routes authentication requests to the ssh-agent process serving on the given unix socket.\n\n```go\nfunc RequestAgentForwarding(session *ssh.Session) error\n```\nRequestAgentForwarding sets up agent forwarding for the session. ForwardToAgent or ForwardToRemote should be called to route the authentication requests.\n\n```go\nfunc ServeAgent(agent Agent, c io.ReadWriter) error\n```\nServeAgent serves the agent protocol on the given connection. It returns when an I/O error occurs.\n\n## Types\n\n```go\ntype AddedKey struct {\n\t// PrivateKey must be a *rsa.PrivateKey, *dsa.PrivateKey or\n\t// *ecdsa.PrivateKey, which will be inserted into the agent.\n\tPrivateKey interface{}\n\t// Certificate, if not nil, is communicated to the agent and will be\n\t// stored with the key.\n\tCertificate *ssh.Certificate\n\t// Comment is an optional, free-form string.\n\tComment string\n\t// LifetimeSecs, if not zero, is the number of seconds that the\n\t// agent will store the key for.\n\tLifetimeSecs uint32\n\t// ConfirmBeforeUse, if true, requests that the agent confirm with the\n\t// user before each use of this key.\n\tConfirmBeforeUse bool\n}\n```\nAddedKey describes an SSH key to be added to an Agent.\n\n```go\ntype Agent interface {\n\t// List returns the identities known to the agent.\n\tList() ([]*Key, error)\n\n\t// Sign has the agent sign the data using a protocol 2 key as defined\n\t// in [PROTOCOL.agent] section 2.6.2.\n\tSign(key ssh.PublicKey, data []byte) (*ssh.Signature, error)\n\n\t// Add adds a private key to the agent.\n\tAdd(key AddedKey) error\n\n\t// Remove removes all identities with the given public key.\n\tRemove(key ssh.PublicKey) error\n\n\t// RemoveAll removes all identities.\n\tRemoveAll() error\n\n\t// Lock locks the agent. Sign and Remove will fail, and List will empty an empty list.\n\tLock(passphrase []byte) error\n\n\t// Unlock undoes the effect of Lock\n\tUnlock(passphrase []byte) error\n\n\t// Signers returns signers for all the known keys.\n\tSigners() ([]ssh.Signer, error)\n}\n```\nAgent represents the capabilities of an ssh-agent.\n\n```go\nfunc NewClient(rw io.ReadWriter) Agent\n```\nNewClient returns an Agent that talks to an ssh-agent process over the given connection.\n\n```go\nfunc NewKeyring() Agent\n```\nNewKeyring returns an Agent that holds keys in memory.  It is safe for concurrent use by multiple goroutines.\n\n```go\ntype Key struct {\n\tFormat  string\n\tBlob    []byte\n\tComment string\n}\n```\nKey represents a protocol 2 public key as defined in \\[PROTOCOL.agent], section 2.5.2.\n\n```go\nfunc (k *Key) Marshal() []byte\n```\nMarshal returns key blob to satisfy the ssh.PublicKey interface.\n\n```go\nfunc (k *Key) String() string\n```\nString returns the storage form of an agent key with the format, base64 encoded serialized key, and the comment if it is not empty.\n\n```go\nfunc (k *Key) Type() string\n```\nType returns the public key type.\n\n```go\nfunc (k *Key) Verify(data []byte, sig *ssh.Signature) error\n```\nVerify satisfies the ssh.PublicKey interface, but is not implemented for agent keys.\n\n","path":"github.com/generaltso/gogs/modules/crypto/ssh/agent","name":"agent","synopsis":"Package agent implements a client to an ssh-agent daemon.","isRedistributable":true}
