keys

package
v0.0.0-...-69a7a08 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2015 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrExists happens when a Key already exists in a database
	ErrExists = errors.New("rufus: key already in db")
	// ErrInvalidKeyID error happens when a key isn't found
	ErrInvalidKeyID = errors.New("rufus: invalid key id")
	// ErrFailedKeyGeneration happens when there is a failure in generating a key
	ErrFailedKeyGeneration = errors.New("rufus: failed to generate new key")
)

Functions

This section is empty.

Types

type HSMRSAKey

type HSMRSAKey struct {
	ID      string
	Type    string
	Public  []byte
	Private pkcs11.ObjectHandle
}

HSMRSAKey represents the information for an HSMRSAKey with ObjectHandle for private portion

func (*HSMRSAKey) Serialize

func (k *HSMRSAKey) Serialize() *JSONKey

Serialize returns the public key bits

type HexBytes

type HexBytes []byte

HexBytes represents hexadecimal bytes

func (HexBytes) MarshalJSON

func (b HexBytes) MarshalJSON() ([]byte, error)

MarshalJSON allows the representation in JSON of hexbytes

func (HexBytes) String

func (b HexBytes) String() string

func (*HexBytes) UnmarshalJSON

func (b *HexBytes) UnmarshalJSON(data []byte) error

UnmarshalJSON allows the representation in JSON of hexbytes

type JSONKey

type JSONKey struct {
	ID     string   `json:"id"`
	Type   string   `json:"type"`
	Public HexBytes `json:"public"`
}

JSONKey maps a key's public key bits to a json representation

type Key

type Key struct {
	ID      string
	Type    string
	Public  [ed25519.PublicKeySize]byte
	Private *[ed25519.PrivateKeySize]byte
}

Key represents all the information of a key, including the private and public bits

func (*Key) Serialize

func (k *Key) Serialize() *JSONKey

Serialize returns the public key bits

type KeyDB

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

KeyDB represents an in-memory key keystore

func NewKeyDB

func NewKeyDB() *KeyDB

NewKeyDB returns an instance of KeyDB

func (*KeyDB) AddKey

func (db *KeyDB) AddKey(key *Key) error

AddKey Adds a new key to the database

func (*KeyDB) CreateKey

func (db *KeyDB) CreateKey() (*JSONKey, error)

CreateKey is needed to implement KeyManager. Returns an empty key.

func (*KeyDB) DeleteKey

func (db *KeyDB) DeleteKey(keyID string) error

DeleteKey deletes the keyID from the database

func (*KeyDB) GetKey

func (db *KeyDB) GetKey(keyID string) (*Key, error)

GetKey returns the private bits of a key

func (*KeyDB) KeyInfo

func (db *KeyDB) KeyInfo(keyID string) (*JSONKey, error)

KeyInfo returns the public bits of a key, given a specific keyID

type Signature

type Signature struct {
	KeyID     string   `json:"keyid"`
	Signature HexBytes `json:"signature"`
}

Signature gives a json representation for a signed blob

type SigningRequest

type SigningRequest struct {
	Blob HexBytes `json:"blob"`
}

SigningRequest represents the json that comes when a signing request is made

Jump to

Keyboard shortcuts

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