keys

package
v0.2.0-DEV Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyBits = 2048

	PrivateBlock = pem.Block{
		Headers: nil,
		Type:    "RSA PRIVATE KEY",
	}

	PublicBlock = pem.Block{
		Headers: nil,
		Type:    "PUBLIC KEY",
	}

	ErrMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM Encoded PKCS1.")
	ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key.")
	ErrNotRSAPublicKey  = errors.New("Key is not a valid RSA public key.")
)

Functions

func RSASingletonPrivate

func RSASingletonPrivate() []byte

func RSASingletonPublic

func RSASingletonPublic() []byte

Types

type Key

type Key interface {
	Generate() error
	Key() *rsa.PrivateKey
	Private() ([]byte, error)
	Public() ([]byte, error)
	Write(io.Writer, io.Writer) error
	Read([]byte, []byte) error
}

type RSAKey

type RSAKey struct {
	// contains filtered or unexported fields
}

func GetRSAKeySingleton

func GetRSAKeySingleton() *RSAKey

func (*RSAKey) Generate

func (m *RSAKey) Generate() error

func (*RSAKey) Key

func (m *RSAKey) Key() *rsa.PrivateKey

func (*RSAKey) Private

func (m *RSAKey) Private() ([]byte, error)

func (*RSAKey) Public

func (m *RSAKey) Public() ([]byte, error)

func (*RSAKey) Read

func (m *RSAKey) Read(priv []byte, pub []byte) error

func (*RSAKey) Write

func (m *RSAKey) Write(priv io.Writer, pub io.Writer) error

Jump to

Keyboard shortcuts

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