Documentation
¶
Overview ¶
Package sshkeygen provides the ssh-keygen utility — generate, manage, and convert SSH keys.
It exposes a Config struct with a Parse method for command-line argument parsing, individual action functions (Generate, Fingerprint, ChangePassphrase, ShowPublicKey, ChangeComment), and a Run dispatcher.
Index ¶
- func ChangeComment(cfg *Config, streams stdio.TerminalStreams) int
- func ChangePassphrase(cfg *Config, streams stdio.TerminalStreams) int
- func Fingerprint(cfg *Config, streams stdio.TerminalStreams) int
- func FingerprintString(key ssh.PublicKey, algo string) string
- func Generate(cfg *Config, streams stdio.TerminalStreams) int
- func KeySize(key ssh.PublicKey) int
- func KeyTypeName(key ssh.PublicKey) string
- func ParseKeyTypes(spec string) []string
- func Run(cfg *Config, streams stdio.TerminalStreams) int
- func ShowPublicKey(cfg *Config, streams stdio.TerminalStreams) int
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeComment ¶
func ChangeComment(cfg *Config, streams stdio.TerminalStreams) int
ChangeComment changes the comment on a key file.
func ChangePassphrase ¶
func ChangePassphrase(cfg *Config, streams stdio.TerminalStreams) int
ChangePassphrase changes the passphrase on an existing private key.
func Fingerprint ¶
func Fingerprint(cfg *Config, streams stdio.TerminalStreams) int
Fingerprint prints the fingerprint of a key file and returns an exit code.
func FingerprintString ¶
FingerprintString returns the fingerprint string for a public key using the specified hash algorithm ("md5" or "sha256").
func Generate ¶
func Generate(cfg *Config, streams stdio.TerminalStreams) int
Generate generates a new SSH key pair.
func KeyTypeName ¶
KeyTypeName returns a human-readable name for the SSH key type.
func ParseKeyTypes ¶
ParseKeyTypes translates user-friendly type names to SSH algorithm names.
func Run ¶
func Run(cfg *Config, streams stdio.TerminalStreams) int
Run dispatches to the appropriate action based on cfg and returns a process exit code.
func ShowPublicKey ¶
func ShowPublicKey(cfg *Config, streams stdio.TerminalStreams) int
ShowPublicKey extracts and prints the public key from a private key file.
Types ¶
type Config ¶
type Config struct {
KeyType string // -t
Bits int // -b
Comment string // -C
KeyFile string // -f
NewPass string // -N
OldPass string // -P (old passphrase for -p)
Fingerprint bool // -l
ChangePass bool // -p
ChangeComment bool // -c
ShowPub bool // -y
HashAlgo string // -E (md5 or sha256)
Quiet bool // -q
Version bool // -V
}
Config holds parsed ssh-keygen command-line arguments.