goenc

package module
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 7 Imported by: 0

README

goenc

GitHub Releases LICENSE CI Go Reference Go Report Card

A simple file encryption tool

Usage

$ goenc --help
Usage: goenc [OPTIONS] [INPUT] [OUTPUT]

A simple file encryption tool

Options:
  -e, --encrypt         Encrypt
  -d, --decrypt         Decrypt
  -n, --no-clobber      Do not overwrite an existing file
  -t, --time=N          Argon2 time parameter (default: 8)
  -m, --memory=N[KMG]   Argon2 memory parameter (default: 256M)
  -p, --parallelism=N   Argon2 parallelism parameter (default: 4)
  -r, --retries=N       Maximum number of attempts to enter password
                        (default: 3)
      --password-from=FILE
                        Read password from FILE
  -h, --help            Show this help message and exit
      --version         Show version information and exit

Environment Variables:
  PASSWORD              Encryption password

Installation

Download from GitHub Releases

Build from source
$ go install github.com/cions/goenc/cmd/goenc@latest

Algorithm

  • XChaCha20-Poly1305 for authenticated encryption
  • Argon2id for key derivation

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFormat     = errors.New("not a valid goenc file")
	ErrInvalidTag = errors.New("tag verification failed (password is wrong or data is corrupted)")
)

Functions

func Decrypt added in v0.5.0

func Decrypt(password, input []byte) ([]byte, error)

Decrypt decrypts input with password.

func Encrypt added in v0.5.0

func Encrypt(password, plaintext []byte, opts *Options) ([]byte, error)

Encrypt encrypts plaintext with password.

Types

type Format added in v0.5.0

type Format int

Format represents the file format.

const (
	// FormatDefault indicates that the format is not specified.
	FormatDefault Format = iota

	// FormatV1 represents the goenc version 1 format.
	//
	// Version 1 format uses XChaCha20-Poly1305 for authenticated encryption and Argon2id for key derivation.
	FormatV1
)

type Options added in v0.5.0

type Options struct {
	Format  Format // File format
	Time    uint32 // KDF time parameter
	Memory  uint32 // KDF memory parameter
	Threads uint8  // KDF parallelism parameter
}

Options are encryption parameters.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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