v3: go.mozilla.org/sops/v3/gcpkms Index | Files

package gcpkms

import "go.mozilla.org/sops/v3/gcpkms"


Package Files


type MasterKey Uses

type MasterKey struct {
    ResourceID   string
    EncryptedKey string
    CreationDate time.Time

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

func MasterKeysFromResourceIDString Uses

func MasterKeysFromResourceIDString(resourceID string) []*MasterKey

MasterKeysFromResourceIDString takes a comma separated list of GCP KMS resource IDs and returns a slice of new MasterKeys for them

func NewMasterKeyFromResourceID Uses

func NewMasterKeyFromResourceID(resourceID string) *MasterKey

NewMasterKeyFromResourceID takes a GCP KMS resource ID string and returns a new MasterKey for that

func (*MasterKey) Decrypt Uses

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

Decrypt decrypts the EncryptedKey field with CGP KMS and returns the result.

func (*MasterKey) Encrypt Uses

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

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

func (*MasterKey) EncryptIfNeeded Uses

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 Uses

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

EncryptedDataKey returns the encrypted data key this master key holds

func (*MasterKey) NeedsRotation Uses

func (key *MasterKey) NeedsRotation() bool

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

func (*MasterKey) SetEncryptedDataKey Uses

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

SetEncryptedDataKey sets the encrypted data key for this master key

func (MasterKey) ToMap Uses

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

ToMap converts the MasterKey to a map for serialization purposes

func (*MasterKey) ToString Uses

func (key *MasterKey) ToString() string

ToString converts the key to a string representation

Package gcpkms imports 10 packages (graph) and is imported by 3 packages. Updated 2020-06-20. Refresh now. Tools for package owners.