encryption

package
v7.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const KeySize = 32
View Source
const NonceSize = 12

There are issues with the proof of security with other nonce sizes so we only use 0 (for convergent) or 12

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encryptedData, nonce, secretKey []byte) ([]byte, error)

func DecryptConvergent

func DecryptConvergent(encryptedData, salt, secretKey []byte) ([]byte, error)

Decrypt data that was deterministically encrypted with the provided salt

func DeriveSecretKey added in v7.1.0

func DeriveSecretKey(secret, salt []byte) ([]byte, error)

func Desalinate

func Desalinate(data []byte, length int) (desalted []byte, salt []byte)

func NewNonce added in v7.1.0

func NewNonce(n int) ([]byte, error)

func Salinate

func Salinate(data, salt []byte) []byte

Types

type Args

type Args struct {
	BlockCipherMaker BlockCipherMaker
	Nonce            []byte
	SecretKey        []byte
	AdditionalData   []byte
}

type Blob

type Blob struct {
	SecretKey     []byte
	EncryptedData []byte
}

func Encrypt

func Encrypt(data, nonce, secretKey []byte) (*Blob, error)

Encrypt data using random nonce

func EncryptConvergent

func EncryptConvergent(data, salt []byte) (*Blob, error)

Deterministically encrypt data using a supplied salt to produce a distinguished the encrypted result that will have a different content hash, secret key, and address than the same data encrypted with a different salt (or not salt). Can be used to watermark a copy of a blob shared with a particular party or to hide the fact a certain plaintext is stored.

type BlockCipherMaker

type BlockCipherMaker func(key []byte) (cipher.Block, error)

Jump to

Keyboard shortcuts

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