cryptoservice

package
v0.0.0-...-a9fda57 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2015 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCertificate

func GenerateCertificate(rootKey data.PrivateKey, gun string) (*x509.Certificate, error)

GenerateCertificate generates an X509 Certificate from a template, given a GUN

Types

type CryptoService

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

CryptoService implements Sign and Create, holding a specific GUN and keystore to operate on

func NewCryptoService

func NewCryptoService(gun string, keyStores ...trustmanager.KeyStore) *CryptoService

NewCryptoService returns an instance of CryptoService

func (*CryptoService) Create

func (ccs *CryptoService) Create(role, algorithm string) (data.PublicKey, error)

Create is used to generate keys for targets, snapshots and timestamps

func (*CryptoService) GetKey

func (ccs *CryptoService) GetKey(keyID string) data.PublicKey

GetKey returns a key by ID

func (*CryptoService) GetPrivateKey

func (ccs *CryptoService) GetPrivateKey(keyID string) (k data.PrivateKey, id string, err error)

GetPrivateKey returns a private key by ID

func (*CryptoService) ListKeys

func (ccs *CryptoService) ListKeys(role string) []string

ListKeys returns a list of key IDs valid for the given role

func (*CryptoService) RemoveKey

func (ccs *CryptoService) RemoveKey(keyID string) (err error)

RemoveKey deletes a key by ID

func (*CryptoService) Sign

func (ccs *CryptoService) Sign(keyIDs []string, payload []byte) ([]data.Signature, error)

Sign returns the signatures for the payload with a set of keyIDs. It ignores errors to sign and expects the called to validate if the number of returned signatures is adequate.

Jump to

Keyboard shortcuts

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