ssh

package
v0.0.0-...-2b6d021 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBitSize        = 4096
	DefaultPrivateKeyPath = "id_rsa"
	DefaultPublicKeyPath  = "id_rsa.pub"
)

Variables

View Source
var (
	ErrNoSSHKeyDefined = errors.New("no ssh key configured")
)

Functions

func FetchCert

func FetchCert() ([]byte, error)

func GenerateED25519Key

func GenerateED25519Key() ([]byte, []byte)

func MarshalED25519PrivateKey

func MarshalED25519PrivateKey(key ed25519.PrivateKey) []byte

Types

type Options

type Options struct {
	BitSize    int    `json:"bit_size"`
	PriKeyPath string `json:"pri_key_path"`
	PubKeyPath string `json:"pub_key_path"`
}

SSHKey is a struct that holds the options when creating a new ssh key

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns the default options

func (*Options) SetDefaults

func (o *Options) SetDefaults()

SetDefaults sets the default values for the options

type SshKey

type SshKey struct {
	PrivKey *rsa.PrivateKey
	Priv    []byte
	Pub     []byte
	// contains filtered or unexported fields
}

func NewSSHKey

func NewSSHKey(opt Options) *SshKey

func (*SshKey) Generate

func (s *SshKey) Generate() error

func (*SshKey) SaveToFile

func (s *SshKey) SaveToFile() error

Jump to

Keyboard shortcuts

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