keymanager

package
v0.0.0-...-9725836 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyAKey = "Key-A"
	KeyBKey = "Key-B"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskKeyManager

type DiskKeyManager struct {

	// Type of key
	Type KeyType
	// Path to a key-pair file
	Path string
	// Rotation period
	RotationPeriod time.Duration
	// Check key expiration interval
	Interval time.Duration
	// KeyPair data read from file which specified by Path
	KeyPairs map[string]KeyPair
	// contains filtered or unexported fields
}

func NewDiskKeyManager

func NewDiskKeyManager(t KeyType, p string, rp time.Duration, iv time.Duration) *DiskKeyManager

func (*DiskKeyManager) GenerateKey

func (d *DiskKeyManager) GenerateKey() (*KeyPair, error)

func (*DiskKeyManager) GetPrivateKey

func (d *DiskKeyManager) GetPrivateKey() (string, crypto.PrivateKey, error)

func (*DiskKeyManager) GetPublicKeys

func (d *DiskKeyManager) GetPublicKeys() (map[string]crypto.PublicKey, error)

func (*DiskKeyManager) Initialize

func (d *DiskKeyManager) Initialize() error

func (*DiskKeyManager) WriteEntry

func (d *DiskKeyManager) WriteEntry() error

type KeyManager

type KeyManager interface {
	GetPrivateKey() (string, crypto.PrivateKey, error)
	GetPublicKeys() (map[string]crypto.PublicKey, error)
	GenerateKey() (*KeyPair, error)
	WriteEntry() error
}

type KeyPair

type KeyPair struct {
	// Key pair identifier. It is used as 'kid' in JWK.
	ID string `json:"id"`
	// DER encoded private-key
	PrivateKeyDER []byte `json:"privateKey"`
	// DER encoded public-key
	PublicKeyDER []byte `json:"publicKey"`
	// Time when key pair was issued
	IssueAt time.Time `json:"issueAt"`
	// Time when key pair is expired
	ExpireAt time.Time `json:"expireAt"`
}

type KeyType

type KeyType int32
const (
	UNSPECIFIED_KEY_TYPE KeyType = 0
	EC_P256              KeyType = 1
	EC_P384              KeyType = 2
	RSA_2048             KeyType = 4
	RSA_4096             KeyType = 5
)

Jump to

Keyboard shortcuts

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