encryption

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 5 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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