sshkeys

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostKey

type HostKey interface {
	PrivateKey() string
	PublicKey() string
}

func NewRSAHostKey

func NewRSAHostKey() (HostKey, error)

type KeyStore

type KeyStore interface {
	// Authentication methods configured to use this KeyStore.
	Auth() []ssh.AuthMethod
	// The raw private key bytes, as stored on disk.
	KeyBytes() []byte
	// Path to the private key
	KeyPath() string
	// The public key bytes, as stored on disk
	PublicKey() []byte
}

A KeyStore stores a single private key and the matching public key. It provides various methods to access both public and private key.

func NewKeyStore

func NewKeyStore(privateKeyPath string, publicKeyPath string) (KeyStore, error)

Creates a new keystore by reading the private and public key from the given path If the paths do not exist, the keys will be created at these locations

type KnownHosts

type KnownHosts interface {
	// Add the key for use by the given hosts
	AddHost(key string, hosts ...string)
	// Returns a HostKeyCallback and HostKeyAlgorithms for use in ssh clients with the currently known hosts
	AsHostKeyConfig() (ssh.HostKeyCallback, []string)
	// Writes a "ssh" compatible representation of the known hosts to the given writer
	AsKnownHostsFile(writer io.Writer) error
}

A go implementation of ~/.ssh/known_hosts

func NewKnownHosts

func NewKnownHosts() KnownHosts

Create a new KnownHosts instance. Doesn't trust any hosts by default

Jump to

Keyboard shortcuts

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