cmek

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cmek holds the seam GCP services use to validate a customer-managed encryption key against Cloud KMS.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("crypto key not found")
	ErrDisabled = errors.New("crypto key has no enabled primary version")
	ErrPurpose  = errors.New("crypto key purpose is not ENCRYPT_DECRYPT")
	ErrLocation = errors.New("crypto key location does not match")
	ErrState    = errors.New("crypto key is not in a usable state")
)

The Err* values are returned by a Checker; callers map them to their service's error.

Functions

func Check

func Check(c Checker, keyName, location string) error

Check runs c when it is set; an unset checker accepts every key.

func Location

func Location(keyName string) string

Location returns the location segment of projects/*/locations/*/keyRings/*/cryptoKeys/*.

func VersionName

func VersionName(c Checker, keyName string) string

VersionName returns the primary version of keyName when c can name it, else keyName itself.

Types

type Checker

type Checker interface {
	CheckKey(keyName, location string) error
}

Checker validates a Cloud KMS crypto key name; a non-empty location must equal the key's location.

type KeyChecker

type KeyChecker interface {
	CheckKey(ctx context.Context, keyRef string) error
}

KeyChecker validates an AWS KMS key reference (key ID, ARN or alias); it returns ErrNotFound, ErrDisabled, ErrState or ErrPurpose when the key cannot encrypt.

type KeyResolver

type KeyResolver interface {
	ResolveKeyARN(ctx context.Context, keyRef string) (string, error)
}

KeyResolver is implemented by KeyCheckers that can turn a key reference (ID, alias or ARN) into its ARN.

type Versioner

type Versioner interface {
	PrimaryVersion(keyName string) string
}

Versioner is implemented by checkers that can name a key's primary version.

Jump to

Keyboard shortcuts

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