encryption

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package encryption manages content encryption algorithms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name, description string, newEncryptor EncryptorFactory)

Register registers new encryption algorithm.

func SupportedAlgorithms

func SupportedAlgorithms() []string

SupportedAlgorithms returns the names of the supported encryption methods.

Types

type EncryptorFactory

type EncryptorFactory func(passPhrase []byte) (StreamEncryptor, error)

EncryptorFactory creates new Encryptor for given parameters.

type StreamEncryptor

type StreamEncryptor interface {
	// EncryptStream appends the encrypted bytes corresponding to the given plaintext to a given writer.
	EncryptStream(plainText io.Reader, output io.Writer) error

	// DecryptStream appends the unencrypted bytes corresponding to the given ciphertext to a given writer.
	DecryptStream(cipherText io.Reader, output io.Writer) error

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

StreamEncryptor represents an interface for encrypting and decrypting data streams.

func CreateEncryptor

func CreateEncryptor(algorithm string, passPhrase []byte) (StreamEncryptor, error)

CreateEncryptor creates an StreamEncryptor for given parameters.

func NewAES128CFB

func NewAES128CFB(passPhrase []byte) (StreamEncryptor, error)

func NewAES192CFB

func NewAES192CFB(passPhrase []byte) (StreamEncryptor, error)

func NewAES256CFB

func NewAES256CFB(passPhrase []byte) (StreamEncryptor, error)

Jump to

Keyboard shortcuts

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