vault

package
v0.0.1-beta4 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHttpError

func NewHttpError(msg string, code int) error

Types

type AzureKey

type AzureKey struct {
	Key AzureKeyDetail `json:"key"`
}

AzureKey struct that contains data about azure key and honor the StoredKey interface

func (*AzureKey) Curve

func (az *AzureKey) Curve() string

Curve retrieve the curve to be used with this key

func (*AzureKey) ID

func (az *AzureKey) ID() string

ID retrive the id of this key

func (*AzureKey) PublicKey

func (az *AzureKey) PublicKey() []byte

PublicKey retrive the public key of this key in a compressed format

type AzureKeyDetail

type AzureKeyDetail struct {
	ID    string `json:"kid"`
	Curve string `json:"crv"`
	X     string `json:"x"`
	Y     string `json:"y"`
	KTY   string `json:"kty"`
}

AzureKeyDetail data about azure key

type AzureVault

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

AzureVault contains the necessary information to interact with azure key vault api

func NewAzureVault

func NewAzureVault(config config.AzureConfig, client HTTPClient) *AzureVault

NewAzureVault create a new AzureVault struct according to the config if client is nil it will use the default http client

func (*AzureVault) Contains

func (s *AzureVault) Contains(keyID string) bool

Contains return true if the keyHash was found in Azure Key Vault

func (*AzureVault) GetPublicKey

func (s *AzureVault) GetPublicKey(ctx context.Context, keyID string) (signatory.StoredKey, error)

GetPublicKey retrieve the public key matching keyID from the azure key vault rest api

func (*AzureVault) Import

func (s *AzureVault) Import(jwk *signatory.JWK) (string, error)

Import use the azure key vault rest api to import a JWK

func (*AzureVault) ListPublicKeys

func (s *AzureVault) ListPublicKeys(ctx context.Context) ([]signatory.StoredKey, error)

ListPublicKeys retrieve all the public keys matching keyHash from the azure key vault rest api

func (*AzureVault) Name

func (s *AzureVault) Name() string

Name return the name of the vault

func (*AzureVault) Ready

func (s *AzureVault) Ready() bool

Ready return true if the vault is ready

func (*AzureVault) Sign

func (s *AzureVault) Sign(ctx context.Context, digest []byte, storedKey signatory.StoredKey) ([]byte, error)

Sign submit a sign request to the azure keyvault api returns the decoded signature

func (*AzureVault) VaultName

func (s *AzureVault) VaultName() string

VaultName returns Azure vault name

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient interface representing a subset of http client method

type YubiHSM

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

YubiHSM struct containing information required to interrogate a Yubi HSM

func NewYubi

func NewYubi(config config.YubiConfig) (*YubiHSM, error)

NewYubi create a NewYubi vault according to config

func (*YubiHSM) GetPublicKey

func (s *YubiHSM) GetPublicKey(ctx context.Context, keyID string) (signatory.StoredKey, error)

GetPublicKey retrieve a public key from Yubi HSM

func (*YubiHSM) ListPublicKeys

func (s *YubiHSM) ListPublicKeys(ctx context.Context) ([]signatory.StoredKey, error)

ListPublicKeys list all public key from connected Yubi HSM

func (*YubiHSM) Name

func (s *YubiHSM) Name() string

Name return the name of the vault

func (*YubiHSM) Ready

func (s *YubiHSM) Ready() bool

Ready return if the vault is ready

func (*YubiHSM) Sign

func (s *YubiHSM) Sign(ctx context.Context, digest []byte, storedKey signatory.StoredKey) ([]byte, error)

Sign produce a signature of digest using the storedKey in YubiHSM

type YubiKey

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

YubiKey struct containing information about a Yubi HSM asymmetric-key

func (*YubiKey) Curve

func (k *YubiKey) Curve() string

Curve retrieve the curve to be used with this key

func (*YubiKey) ID

func (k *YubiKey) ID() string

ID retrive the id of this key

func (*YubiKey) PublicKey

func (k *YubiKey) PublicKey() []byte

PublicKey retrive the public key of this key in a compressed format

Jump to

Keyboard shortcuts

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