encryptor

package
v0.0.0-...-015e77e Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncryptor

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

AESEncryptor is an encryptor that supports the following AES keyLen lengths & cipher modes:

  • AES128-CFB, AES192-CFB, AES256-CFB
  • AES128-CTR, AES192-CTR, AES256-CTR
  • AES128-GCM, AES192-GCM, AES256-GCM

func NewAESEncryptor

func NewAESEncryptor(keyLen crypto.KeyLen, mode crypto.Mode, secret crypto.Secret) *AESEncryptor

NewAESEncryptor returns a new AESEncryptor configured with an AES keyLen length and mode for a secret.

func (*AESEncryptor) Decrypt

func (e *AESEncryptor) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt returns the cipher data decrypted with the configured cipher mode and secret.

func (*AESEncryptor) Encrypt

func (e *AESEncryptor) Encrypt(plaintext []byte) ([]byte, error)

Encrypt returns the plain data encrypted with the configured cipher mode and secret.

func (*AESEncryptor) ID

func (e *AESEncryptor) ID() string

ID returns the id of the encryptor (secret) that was used to encrypt the data (for tracking).

func (*AESEncryptor) Name

func (e *AESEncryptor) Name() string

Name returns the name of the configured AES encryption cipher in following format "[cipher][keyLen length]-[mode]" e.g. "aes192-ctr".

type ChainEncryptor

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

ChainEncryptor is an encryptor that supports an chain of other Encryptors. Bytes will be encrypted by chaining the Encryptors in a FIFO order.

func NewChainEncryptor

func NewChainEncryptor(encryptors ...crypto.Encryptor) *ChainEncryptor

NewChainEncryptor creates a new ChainEncryptor consisting of a chain of the supplied Encryptors.

func (*ChainEncryptor) Decrypt

func (e *ChainEncryptor) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt returns data decrypted with the chain of Encryptors.

func (*ChainEncryptor) Encrypt

func (e *ChainEncryptor) Encrypt(plaintext []byte) ([]byte, error)

Encrypt returns data encrypted with the chain of Encryptors.

func (*ChainEncryptor) ID

func (e *ChainEncryptor) ID() string

ID returns a concatenated list of the ids of chained encryptor(s) / secrets that were used to encrypt the data (for tracking) separated by spaces.

func (*ChainEncryptor) Name

func (e *ChainEncryptor) Name() string

Name returns a concatenated list of the cipher names of the chained encryptor(s) that were used to encrypt the data separated by spaces.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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