Documentation ¶
Index ¶
- type CryptoService
- func (ccs *CryptoService) Create(role string, algorithm data.KeyAlgorithm) (data.PublicKey, error)
- func (ccs *CryptoService) GetKey(keyID string) data.PublicKey
- func (ccs *CryptoService) RemoveKey(keyID string) error
- func (ccs *CryptoService) Sign(keyIDs []string, payload []byte) ([]data.Signature, error)
- type UnlockedCryptoService
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
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