encryption

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Overview

Package encryption manages content encryption algorithms.

Index

Constants

View Source
const DefaultAlgorithm = "AES256-GCM-HMAC-SHA256"

DefaultAlgorithm is the name of the default encryption algorithm.

Variables

This section is empty.

Functions

func Register

func Register(name, description string, deprecated bool, newEncryptor EncryptorFactory)

Register registers new encryption algorithm.

func SupportedAlgorithms

func SupportedAlgorithms(includeDeprecated bool) []string

SupportedAlgorithms returns the names of the supported encryption methods.

Types

type Encryptor

type Encryptor interface {
	// Encrypt appends the encrypted bytes corresponding to the given plaintext to a given slice.
	// Must not clobber the input slice and return ciphertext with additional padding and checksum.
	Encrypt(plainText gather.Bytes, contentID []byte, output *gather.WriteBuffer) error

	// Decrypt appends the unencrypted bytes corresponding to the given ciphertext to a given slice.
	// Must not clobber the input slice. If IsAuthenticated() == true, Decrypt will perform
	// authenticity check before decrypting.
	Decrypt(cipherText gather.Bytes, contentID []byte, output *gather.WriteBuffer) error

	// Overhead is the number of bytes of overhead added by Encrypt()
	Overhead() int
}

Encryptor performs encryption and decryption of contents of data.

func CreateEncryptor

func CreateEncryptor(p Parameters) (Encryptor, error)

CreateEncryptor creates an Encryptor for given parameters.

type EncryptorFactory

type EncryptorFactory func(p Parameters) (Encryptor, error)

EncryptorFactory creates new Encryptor for given parameters.

type Parameters

type Parameters interface {
	GetEncryptionAlgorithm() string
	GetMasterKey() []byte
}

Parameters encapsulates all encryption parameters.

Jump to

Keyboard shortcuts

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