Back to

Package encrypted

Latest Go to latest

The latest major version is .

Published: Dec 10, 2019 | License: BSD-3-Clause | Module:


Package encrypted provides a simple, secure system for encrypting data symmetrically with a passphrase.

It uses scrypt derive a key from the passphrase and the NaCl secret box cipher for authenticated encryption.


func Decrypt

func Decrypt(ciphertext, passphrase []byte) ([]byte, error)

Decrypt takes a JSON-encoded ciphertext object encrypted using Encrypt and tries to decrypt it using passphrase. If successful, it returns the plaintext.

func Encrypt

func Encrypt(plaintext, passphrase []byte) ([]byte, error)

Encrypt takes a passphrase and plaintext, and returns a JSON object containing ciphertext and the details necessary to decrypt it.

func Marshal

func Marshal(v interface{}, passphrase []byte) ([]byte, error)

Marshal encrypts the JSON encoding of v using passphrase.

func Unmarshal

func Unmarshal(data []byte, v interface{}, passphrase []byte) error

Unmarshal decrypts the data using passphrase and unmarshals the resulting plaintext into the value pointed to by v.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier