ssh

package
v0.0.0-...-62cd3b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyType

type KeyType string

KeyType specifies the type of SSH host key to generate.

const (
	// KeyTypeEd25519 generates an Ed25519 host key.
	KeyTypeEd25519 KeyType = "ed25519"
	// KeyTypeRSA generates an RSA host key (4096-bit).
	KeyTypeRSA KeyType = "rsa"
)

type PublicKey

type PublicKey = gossh.PublicKey

PublicKey is an alias for ssh.PublicKey to avoid requiring callers to import golang.org/x/crypto/ssh.

func ParseAuthorizedKeys

func ParseAuthorizedKeys(data []byte) ([]PublicKey, error)

ParseAuthorizedKeys parses an OpenSSH authorized_keys file and returns the parsed public keys. Lines that are empty or start with '#' are skipped.

type Signer

type Signer = gossh.Signer

Signer is an alias for ssh.Signer to avoid requiring callers to import golang.org/x/crypto/ssh.

func GenerateAndSaveHostKey

func GenerateAndSaveHostKey(path string, keyType KeyType) (Signer, error)

GenerateAndSaveHostKey generates an SSH host key of the specified type and saves it to path with 0600 permissions atomically, then returns a signer for the key.

func ParseHostKeyFile

func ParseHostKeyFile(data []byte) (Signer, error)

ParseHostKeyFile reads a PEM-encoded private key and returns an SSH signer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL