cryptoservice

package
v0.0.0-...-f7d0ea7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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, keyStore trustmanager.KeyStore) *CryptoService

NewCryptoService returns an instance of CryptoService

func (*CryptoService) Create

func (ccs *CryptoService) Create(role string, algorithm data.KeyAlgorithm) (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) RemoveKey

func (ccs *CryptoService) RemoveKey(keyID string) 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.

type UnlockedCryptoService

type UnlockedCryptoService struct {
	PrivKey       data.PrivateKey
	CryptoService signed.CryptoService
}

UnlockedCryptoService encapsulates a private key and a cryptoservice that uses that private key, providing convinience methods for generation of certificates.

func NewUnlockedCryptoService

func NewUnlockedCryptoService(privKey data.PrivateKey, cryptoService signed.CryptoService) *UnlockedCryptoService

NewUnlockedCryptoService creates an UnlockedCryptoService instance

func (*UnlockedCryptoService) GenerateCertificate

func (ucs *UnlockedCryptoService) GenerateCertificate(gun string) (*x509.Certificate, error)

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

func (*UnlockedCryptoService) ID

func (ucs *UnlockedCryptoService) ID() string

ID gets a consistent ID based on the PrivateKey bytes and algorithm type

func (*UnlockedCryptoService) PublicKey

func (ucs *UnlockedCryptoService) PublicKey() data.PublicKey

PublicKey Returns the public key associated with the private key

Jump to

Keyboard shortcuts

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