encryption

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

Package encryption adds a layer to store data on disk encrypted in case a filesystem is compromised. Under the hood we use "golang.org/x/crypto/nacl/secretbox" for encryption. Secretbox uses XSalsa20 and Poly1305 to encrypt an array of bytes with secret-key cryptography.

Index

Constants

View Source
const (
	// KeyLength represents the byte size of the key.
	KeyLength = 32

	// NonceSize represents the byte size of nonce for XSalsa20 cipher used for
	// encryption.
	NonceSize = 24
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box interface {
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)
}

Box is a general interface to encrypt and decrypt an array of bytes.

func NewBox

func NewBox(key [KeyLength]byte) Box

NewBox uses XSalsa20 and Poly1305 to encrypt and decrypt the plaintext with the key.

Jump to

Keyboard shortcuts

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