keymanager

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KmsLabel is the label for the AWS KMS.
	KmsLabel = "kms"
)

Variables

This section is empty.

Functions

func GetDefaultKeyManager

func GetDefaultKeyManager() string

GetDefaultKeyManager returns the default key manager label.

func GetKeyManagers

func GetKeyManagers() []string

GetKeyManagers returns a list of registered key managers.

Types

type ARN

type ARN struct {
	Partition,
	Service,
	Region,
	AccountID,
	ResourceType,
	Resource string
	// contains filtered or unexported fields
}

ARN represents the ARN as documented by http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html

func NewARN

func NewARN(s string) (ARN, error)

NewARN parses s and constructs an ARN.

func (*ARN) IsKmsAlias

func (a *ARN) IsKmsAlias() bool

IsKmsAlias returns true iff the ARN represents a KMS Alias.

func (*ARN) IsKmsKey

func (a *ARN) IsKmsKey() bool

IsKmsKey returns true iff the ARN represents a KMS Key.

func (*ARN) String

func (a *ARN) String() string

type EnvelopeKey

type EnvelopeKey struct {
	// ResolvedID is the fully qualified key ID.
	ResolvedID string
	// Plaintext is the plaintext encryption key.
	Plaintext []byte
	// Ciphertext is the ciphertext of the encryption key, encrypted with a key that is managed
	// by the key manager.
	Ciphertext []byte
}

EnvelopeKey represents the key used in envelope encryption.

func (*EnvelopeKey) GetPlaintextKey

func (e *EnvelopeKey) GetPlaintextKey() *[32]byte

GetPlaintextKey returns the Plaintext key as a byte array.

type KeyManager

type KeyManager interface {
	GenerateEnvelopeKey(keyID, secretID string) (EnvelopeKey, error)
	Decrypt(keyID string, keyMetadata []byte, secretID string) ([]byte, error)
	Label() string
}

KeyManager represents a service that can generate envelope keys and provide decryption keys.

func New

func New(label string) (KeyManager, error)

New returns a KeyManager of the requested type.

func NewKms

func NewKms() KeyManager

NewKms returns a new Kms.

type Kms

type Kms struct{}

Kms is a KeyManager for AWS KMS.

func (*Kms) Decrypt

func (k *Kms) Decrypt(keyID string, keyCiphertext []byte, secretID string) ([]byte, error)

Decrypt decrypts the encrypted key.

func (*Kms) GenerateEnvelopeKey

func (k *Kms) GenerateEnvelopeKey(keyID string, secretID string) (EnvelopeKey, error)

GenerateEnvelopeKey generates an EnvelopeKey under a specific KeyID.

func (*Kms) Label

func (k *Kms) Label() string

Label returns kmsLabel

Jump to

Keyboard shortcuts

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