mkssh

package
v0.0.0-...-d31c713 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpenTruncate = func(name string) (io.WriteCloser, error) {
	return os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
}

Functions

This section is empty.

Types

type KeyPair

type KeyPair struct {
	Public  crypto.PublicKey
	Private crypto.PrivateKey
	Type    KeyType
	Comment string
}

func NewEd25519KeyPair

func NewEd25519KeyPair(comment string) (KeyPair, error)

func NewKeyPair

func NewKeyPair(keyType KeyType, comment string) (KeyPair, error)

func NewRSAKeyPair

func NewRSAKeyPair(comment string) (KeyPair, error)

func (KeyPair) AddToAgent

func (k KeyPair) AddToAgent() error

func (KeyPair) MarshalPrivateKey

func (k KeyPair) MarshalPrivateKey(passphrase string) ([]byte, error)

func (KeyPair) MarshalPublicKey

func (k KeyPair) MarshalPublicKey() ([]byte, error)

func (KeyPair) Save

func (k KeyPair) Save(path, passphrase string) (err error)

func (KeyPair) WritePrivateKey

func (k KeyPair) WritePrivateKey(w io.Writer, passphrase string) error

func (KeyPair) WritePublicKey

func (k KeyPair) WritePublicKey(w io.Writer) error

WritePublicKey marshals the public key to the OpenSSH format.

Adapted from https://cs.opensource.google/go/x/crypto/+/master:ssh/keys.go;l=279-290;drc=b4de73f9ece8163b492578e101e4ef8923ac2c5c. (Adds comment support and uses io.Writer directly.)

type KeyType

type KeyType int
const (
	KeyTypeEd25519 KeyType = iota + 1
	KeyTypeRSA
)

Jump to

Keyboard shortcuts

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