keygen

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package keygen package is a single entry point for generating OpenSSH keys

Index

Constants

View Source
const (
	DSA     = "dsa"
	ECDSA   = "ecdsa"
	RSA     = "rsa"
	ED25519 = "ed25519"
)

These constants represent the support key types

Variables

View Source
var (
	// ErrUnsupportedKeyType is the error returned when an unsupported key type is requested
	ErrUnsupportedKeyType = errors.New("unsupported key type")

	// ErrUnsupportedKeyLength is the error returned when an invalid key length is supplied for the key type
	ErrUnsupportedKeyLength = errors.New("invalid key length")

	// ErrUnsuppontedCurve is the error returned when generating an ECDSA key and an invalid curve is requested
	ErrUnsuppontedCurve = errors.New("only P-256, P-384 and P-521 EC keys are supported")
)

Functions

This section is empty.

Types

type Keydgen

type Keydgen struct {
	Type  string
	Bits  uint16
	Curve uint16
	// contains filtered or unexported fields
}

Keydgen represents an OpenSSH key generator

func (*Keydgen) GenerateKey

func (k *Keydgen) GenerateKey(rand io.Reader) (key interface{}, err error)

GenerateKey generates and/or returns a private key

func (*Keydgen) MarshalPrivateKey

func (k *Keydgen) MarshalPrivateKey() ([]byte, error)

MarshalPrivateKey returns an OpenSSH formatted private key

func (*Keydgen) MarshalPublicKey

func (k *Keydgen) MarshalPublicKey() ([]byte, error)

MarshalPublicKey returns an OpenSSH formatted public key

Jump to

Keyboard shortcuts

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