barbican

package
v3.6.0-barbican Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package barbican contains an implementation of the go.mozilla.org/sops/v3/keys.MasterKey interface that encrypts and decrypts the data key using OpenStack Barbican using the gophercloud sdk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MasterKey

type MasterKey struct {
	SecretHref   string
	EncryptedKey string
	CreationDate time.Time
}

MasterKey is a GCP KMS key used to encrypt and decrypt sops' data key.

func MasterKeysFromSecretHref

func MasterKeysFromSecretHref(secretHref string) []*MasterKey

MasterKeysFromSecretHref takes a comma separated list of Secret Hrefs and returns a slice of new MasterKeys for them

func NewMasterKeyFromSecretHref

func NewMasterKeyFromSecretHref(secretHref string) *MasterKey

NewMasterKeyFromSecretHref takes a Barbican Secret Href and returns a new MasterKey for that

func (*MasterKey) Decrypt

func (key *MasterKey) Decrypt() ([]byte, error)

Decrypt decrypts the EncryptedKey field with Barbican and returns the result.

func (*MasterKey) Encrypt

func (key *MasterKey) Encrypt(dataKey []byte) error

Encrypt takes a sops data key, encrypts it with Barbican and stores the result in the EncryptedKey field

func (*MasterKey) EncryptIfNeeded

func (key *MasterKey) EncryptIfNeeded(dataKey []byte) error

EncryptIfNeeded encrypts the provided sops' data key and encrypts it if it hasn't been encrypted yet

func (*MasterKey) EncryptedDataKey

func (key *MasterKey) EncryptedDataKey() []byte

EncryptedDataKey returns the encrypted data key this master key holds

func (*MasterKey) NeedsRotation

func (key *MasterKey) NeedsRotation() bool

NeedsRotation returns whether the data key needs to be rotated or not.

func (*MasterKey) SetEncryptedDataKey

func (key *MasterKey) SetEncryptedDataKey(enc []byte)

SetEncryptedDataKey sets the encrypted data key for this master key

func (MasterKey) ToMap

func (key MasterKey) ToMap() map[string]interface{}

ToMap converts the MasterKey to a map for serialization purposes

func (*MasterKey) ToString

func (key *MasterKey) ToString() string

ToString converts the key to a string representation

Jump to

Keyboard shortcuts

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