Documentation
¶
Overview ¶
Package sshutil provides helpers for working with SSH public keys, such as parsing `authorized_keys`-format `.pub` files and matching them against a SHA256 fingerprint (e.g. `SHA256:AbCdEfGhIjKlMnOpQrStUvWxYz0123456789ABCDEF`).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeFingerprint ¶
NormalizeFingerprint adds the "SHA256:" prefix if the caller omitted it.
Types ¶
type KeyInfo ¶
type KeyInfo struct {
Path string // filesystem path to the .pub file
Type string // e.g. "ssh-ed25519", "ecdsa-sha2-nistp521"
Comment string // trailing comment, typically "user@host"
Fingerprint string // SHA256 fingerprint, e.g. "SHA256:eLpJ..."
}
KeyInfo describes a single parsed SSH public key file.
func FindByFingerprint ¶
FindByFingerprint scans dir for `*.pub` files whose SHA256 fingerprint matches target. The "SHA256:" prefix on target is optional. Files that fail to parse do not abort the search; they are returned via errs.
func ParseAuthorizedKeyFile ¶
ParseAuthorizedKeyFile parses a single `authorized_keys`-format file, such as a `~/.ssh/id_ed25519.pub` file, and returns its KeyInfo.