secrets

package
v2.16.21 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(data, passphrase []byte) ([]byte, error)

Decrypt decrypts the received data with a passphrase using AES GCM

func Encrypt

func Encrypt(data, passphrase []byte) ([]byte, error)

Encrypt encrypts the received data with a passphrase using AES GCM

Types

type Cypher

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

Cypher is a structure able to encrypt and decrypt messages with an encrypted key. Before encrypting or decrypting the message, the encrypted key is decrypted with the help of the wrapped secrets.Keeper

func New

func New(ctx context.Context, url string) (*Cypher, error)

New returns a Cypher wrapping a secrets.Keeper accesing the secret stored at the given url. The url depends on the secrets driver required (awskms, azurekeyvault, gcpkms, hashivault and localsecrets). See the URLOpener documentation in gocloud.dev/secrets driver subpackages for details on supported URL formats, and https://gocloud.dev/concepts/urls for more information.

func (*Cypher) Close

func (c *Cypher) Close()

Close releases any resources used for the Cypher

func (*Cypher) Decrypt

func (c *Cypher) Decrypt(ctx context.Context, cipherText, cipheredKey []byte) ([]byte, error)

Decrypt decrypts an encrypted text using a encrypted key, returning a plain message. Before using the given key, it decrypts the key with the secrets.Keeper

func (*Cypher) Encrypt

func (c *Cypher) Encrypt(ctx context.Context, plainText, cipheredKey []byte) ([]byte, error)

Encrypt encrypts a plain text using a encrypted key, returning a cipher message. Before using the given key, it decrypts the key with the secrets.Keeper

func (*Cypher) EncryptKey

func (c *Cypher) EncryptKey(ctx context.Context, plainKey []byte) ([]byte, error)

EncryptKey encrypts the given plain key with the secrets.Keeper

Jump to

Keyboard shortcuts

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