ssh

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyGeneration     = errors.New("unable to generate key")
	ErrValidation        = errors.New("unable to validate key")
	ErrPublicKey         = errors.New("unable to convert public key")
	ErrUnableToWriteFile = errors.New("unable to write file")
)

Functions

func GenerateSSHKey

func GenerateSSHKey(path string) error

GenerateSSHKey generates SSH keypair based on path of the private key The public key would be generated to the same path with ".pub" added

Types

type KeyPair

type KeyPair struct {
	PrivateKey []byte
	PublicKey  []byte
}

func NewKeyPair

func NewKeyPair() (keyPair *KeyPair, err error)

NewKeyPair generates a new SSH keypair This will return a private & public key encoded as DER.

func (*KeyPair) Fingerprint

func (kp *KeyPair) Fingerprint() string

Fingerprint calculates the fingerprint of the public key

func (*KeyPair) WriteToFile

func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) error

WriteToFile writes keypair to files

Jump to

Keyboard shortcuts

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