encdec

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCaasKmsClient added in v0.0.11

func NewCaasKmsClient(uriPrefix string) (registry.KMSClient, error)

NewCaasKmsClient returns a KMS client which will handle keys with uriPrefix prefix. keyURI must have the following format: 'caas-kms://<base64 encoded aead keyset>'.

func NewKeyURI

func NewKeyURI() (string, error)

NewKeyURI returns a new, random KMS key URI.

func RegisterCustomKMS added in v0.0.11

func RegisterCustomKMS() error

RegisterCustomKMS registers the custom KMS client with Tink's registry

Types

type CryptoHandler

type CryptoHandler interface {
	// Encrypts the plain data and returns a cipher data
	Encrypt(ctx context.Context, plain, associatedData []byte) ([]byte, error)
	// Decrypts the cipher data and returns plain data
	Decrypt(ctx context.Context, cipher, associatedData []byte) ([]byte, error)
}

Crypto provides methods for encrypting and decrypting data

type CryptoProvider

type CryptoProvider interface {
	CryptoHandler(ctx context.Context) CryptoHandler
}

type CustomKMSClient added in v0.0.11

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

CustomKMSClient implements the registry.KMSClient interface

func NewCustomKMSClient added in v0.0.11

func NewCustomKMSClient() *CustomKMSClient

NewCustomKMSClient creates a new instance of CustomKMSClient

func (*CustomKMSClient) CreateKey added in v0.0.11

func (c *CustomKMSClient) CreateKey() (string, error)

CreateKey generates a new key and returns its URI

func (*CustomKMSClient) GetAEAD added in v0.0.11

func (c *CustomKMSClient) GetAEAD(keyURI string) (tink.AEAD, error)

GetAEAD returns an AEAD primitive for the given key URI

func (*CustomKMSClient) Supported added in v0.0.11

func (c *CustomKMSClient) Supported(keyURI string) bool

Supported checks if the given key URI is supported by this KMS client

type TinkConfiguration

type TinkConfiguration struct {
	KekUri     string
	KeySetData string
}

type TinkCryptoHandler

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

func NewTinkCryptoHandler

func NewTinkCryptoHandler(c *TinkConfiguration) (*TinkCryptoHandler, error)

func (*TinkCryptoHandler) Decrypt

func (h *TinkCryptoHandler) Decrypt(ctx context.Context, cipher, associatedData []byte) ([]byte, error)

func (*TinkCryptoHandler) Encrypt

func (h *TinkCryptoHandler) Encrypt(ctx context.Context, plain, associatedData []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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