alicloudkms

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MPL-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	EnvAliCloudKMSWrapperKeyID   = "ALICLOUDKMS_WRAPPER_KEY_ID"
	EnvVaultAliCloudKMSSealKeyID = "VAULT_ALICLOUDKMS_SEAL_KEY_ID"
)

These constants contain the accepted env vars; the Vault one is for backwards compat

Variables

This section is empty.

Functions

This section is empty.

Types

type Wrapper

type Wrapper struct {
	// contains filtered or unexported fields
}

Wrapper is a Wrapper that uses AliCloud's KMS

func NewWrapper

func NewWrapper(opts *wrapping.WrapperOptions) *Wrapper

NewWrapper creates a new AliCloud Wrapper

func (*Wrapper) Decrypt

func (k *Wrapper) Decrypt(_ context.Context, in *wrapping.EncryptedBlobInfo, aad []byte) (pt []byte, err error)

Decrypt is used to decrypt the ciphertext. This should be called after Init.

func (*Wrapper) Encrypt

func (k *Wrapper) Encrypt(_ context.Context, plaintext, aad []byte) (blob *wrapping.EncryptedBlobInfo, err error)

Encrypt is used to encrypt the master key using the the AliCloud CMK. This returns the ciphertext, and/or any errors from this call. This should be called after the KMS client has been instantiated.

func (*Wrapper) Finalize

func (k *Wrapper) Finalize(_ context.Context) error

Finalize is called during shutdown. This is a no-op since AliCloudKMSWrapper doesn't require any cleanup.

func (*Wrapper) HMACKeyID

func (k *Wrapper) HMACKeyID() string

HMACKeyID returns nothing, it's here to satisfy the interface

func (*Wrapper) Init

func (k *Wrapper) Init(_ context.Context) error

Init is called during core.Initialize. No-op at the moment.

func (*Wrapper) KeyID

func (k *Wrapper) KeyID() string

KeyID returns the last known key id

func (*Wrapper) SetConfig

func (k *Wrapper) SetConfig(config map[string]string) (map[string]string, error)

SetConfig sets the fields on the AliCloudKMSWrapper object based on values from the config parameter.

Order of precedence AliCloud values: * Environment variable * Value from Vault configuration file * Instance metadata role (access key and secret key)

func (*Wrapper) Type

func (k *Wrapper) Type() string

Type returns the type for this particular wrapper implementation

Directories

Path Synopsis
module

Jump to

Keyboard shortcuts

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