keys

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPem = errors.New("invalid pem (type should be RSA PUBLIC KEY, PUBLIC KEY, RSA PRIVATE KEY, or PRIVATE KEY)")
View Source
var ErrKeyAlreadyExists = errors.New("another key already exists with same name")
View Source
var ErrKeyNotFound = errors.New("couldn't find specified key")
View Source
var ErrMissingPem = errors.New("invalid pem (couldn't decode)")
View Source
var ErrNotRsaKey = errors.New("invalid pem (key is not RSA public key or private key)")

Functions

This section is empty.

Types

type Key

type Key struct {
	Name    string
	Public  *rsa.PublicKey
	Private *rsa.PrivateKey
}

func GenerateKey

func GenerateKey(name string, bits int) (*Key, error)

func LoadKey

func LoadKey(pemBytes []byte) (*Key, error)

func LoadKeyFromFile

func LoadKeyFromFile(path string) (*Key, error)

func NewPrivateKey

func NewPrivateKey(name string, rsaPrivateKey *rsa.PrivateKey) *Key

func NewPublicKey

func NewPublicKey(name string, rsaPublicKey *rsa.PublicKey) *Key

func (*Key) PrivatePem

func (key *Key) PrivatePem() []byte

func (*Key) PublicPem

func (key *Key) PublicPem() []byte

type Keychain

type Keychain struct {
	Path  string
	Cache map[string]*Key
}

func NewKeychain

func NewKeychain(path string) *Keychain

func (*Keychain) Find

func (keychain *Keychain) Find(name string) (*Key, error)

func (*Keychain) List added in v0.2.0

func (keychain *Keychain) List() []string

func (*Keychain) ListForDecryption added in v0.2.0

func (keychain *Keychain) ListForDecryption() []string

func (*Keychain) ListForEncryption added in v0.2.0

func (keychain *Keychain) ListForEncryption() []string

func (*Keychain) Save

func (keychain *Keychain) Save(key *Key) error

Jump to

Keyboard shortcuts

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