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.
View Source
const DeprecatedNoneAlgorithm = "NONE"
DeprecatedNoneAlgorithm is the name of the algorithm that does not encrypt.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(name, description string, deprecated bool, newEncryptor EncryptorFactory)
Register registers new encryption algorithm.
func SupportedAlgorithms ¶
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(output, plainText, contentID []byte) ([]byte, 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(output, cipherText, contentID []byte) ([]byte, error)
// IsAuthenticated returns true if encryption is authenticated.
// In this case Decrypt() is expected to perform authenticity check.
IsAuthenticated() bool
// IsDeprecated returns true if encryption is not recommended for new repositories.
IsDeprecated() bool
// MaxOverhead is the maximum number of bytes of overhead added by Encrypt()
MaxOverhead() 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 ¶
Parameters encapsulates all encryption parameters.
Click to show internal directories.
Click to hide internal directories.