tinycrypt

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 11 Imported by: 0

README

tinycrypt

Tiny library for encrypting files and byte streams

Installation:

go mod tidy

Testing:

  • One can test the module via utilizing the go test framework. go test tinycrypt_test.go -v

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptByteStream

func DecryptByteStream(pass string, stream []byte) (*[]byte, error)

Decrypt Byte Streams

func EncryptByteStream

func EncryptByteStream(pass string, stream []byte) (*[]byte, error)

Encrypt Byte Streams

func OpenFile

func OpenFile(FilePath string) (*os.File, *[]byte, error)

OpenFile performs a few tasks. 1. Initial validation of a files existence on disk. 2. Ensuring that the file of capable of being encrypted (binary files, cannot be) 3. The final step is obtaining the byte array from an opened file and returning this byte array to the calling process.

func ValidFile

func ValidFile(FilePath string) (*[]byte, bool)

ValidFile ensures that a file is of a valid type, using the first 4 bites of a file header to denote if the file selected is capable of encryption.

Types

type Encrypter

type Encrypter interface {
	Encrypt() error
	Decrypt() error
}

type Encryption

type Encryption struct {
	FilePath     string
	SecureString string
}

func (Encryption) Decrypt

func (e Encryption) Decrypt() error

Decrypt is the primary method used to decrypt a file on disk.

func (Encryption) Encrypt

func (e Encryption) Encrypt() error

Encrypt is the primary encryption method used to encrypt a file on disk.

Jump to

Keyboard shortcuts

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