filecrypt

package module
v0.0.0-...-72ce11d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Simple command line tools to encrypt files or folders, and optionally compress them as well.

It acts similarly to a compression command line, where the output file is different from the input file.

It should work well for smaller files or folders (max 1GB) that can fit into system RAM.

Future improvements could be to create a stream encryption protocol to support encrypting file content as it's read out of the file. Doing this, we'd loose the simplicity of the current encryption protocol, but it would allow for any file size to be supported. Perhaps for a future version.

Usage example

$ ls
plaintext.txt

$ fencrypt plaintext.txt encrypted
Enter password:
$ ls
encrypted  plaintext.txt

$ fdecrypt encrypted out/
Enter password:
$ ls -R
.:
encrypted  out/  plaintext.txt

./out:
plaintext.txt

Supported options

Usage of fencrypt:

fencrypt [OPTIONS]... [INPUT FILE]... [OUTPUT FILE]...

Parameters:
-c    Compress the content before encrypting it.
-password string
		Specify the encryption password instead of prompting the std input (optional).
-salt string
		Specify a custom password salt (optional). The salt must be compatible with encrypt.GenerateSalt() format.
-v    Verbose mode.

Usage of fdecrypt:

fdecrypt [OPTIONS]... [INPUT FILE]... [OUTPUT FILE]...

Parameters:
-password string
		Specify the encryption password instead of prompting the std input (optional).
-v    Verbose mode.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptFile

func DecryptFile(cypherFilepath string, outputDir string, decrypter *encrypt.Decrypter) error

DecryptFile will decrypt the file at cypherFilepath and put the content in the file at outputDir. If outputDir already exists, it will overwrite its content. Otherwise it will create it and any subdir required.

func EncryptDir

func EncryptDir(dirPath string, cipherFilepath string, encrypter *encrypt.Encrypter, compress bool) error

EncryptDir will encrypt the whole directory at dirPath and put the content in the file at cipherFilepath. If cipherFilepath already exists, it will overwrite its content. Otherwise it will create it and any subdirectory required.

func EncryptFile

func EncryptFile(plainFilepath string, cipherFilepath string, encrypter *encrypt.Encrypter, compress bool) error

EncryptFile will encrypt the file at plainFilepath and put the content in the file at cipherFilepath. If cipherFilepath already exists, it will overwrite its content. Otherwise it will create it and any subdirectory required.

Types

type LoggerProxy

type LoggerProxy struct {
	*log.Logger
	// contains filtered or unexported fields
}

LoggerProxy adds services to the regular logger such as a verbosity flag.

func NewLoggerProxy

func NewLoggerProxy(out io.Writer, prefix string, flag int, verbose bool) *LoggerProxy

NewLoggerProxy will return a new logger.

func (*LoggerProxy) Print

func (l *LoggerProxy) Print(v ...interface{})

Print calls l.Output to print to the logger if verbosity is set.

func (*LoggerProxy) Printf

func (l *LoggerProxy) Printf(format string, v ...interface{})

Printf calls l.Output to print to the logger if verbosity is set.

func (*LoggerProxy) Println

func (l *LoggerProxy) Println(msg string)

Println calls l.Output to print to the logger if verbosity is set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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