encio

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 14 Imported by: 1

README

encio - machine dependent encryption

Package encio provides input/output functions that write encrypted using AES-256-CFB data.

The encryption key is the machine identifier, unique to the operating system.

This makes file non-transferrable between devices.

Encrypted container structure is the following:

|__...__|____________...
0  ^   16   ^
   |        +-- encrypted data
   +----------- 16 bytes IV

Documentation

Overview

Package encio provides input/output functions that write encrypted using AES-256-CFB data.

The encryption key is the machine identifier, unique to the operating system.

This makes file non-transferrable between devices.

Encrypted container structure is the following:

|__...__|____________...
 0  ^   16   ^
    |        +-- encrypted data
    +----------- 16 bytes IV

Index

Constants

This section is empty.

Variables

View Source
var ErrDecrypt = errors.New("decryption error")

Functions

func Create

func Create(filename string) (io.WriteCloser, error)

Create creates an encrypted file container.

func NewReader

func NewReader(r io.Reader) (io.Reader, error)

NewReader wraps the ciphertext reader, and returns the reader that a plaintext can be read from.

func NewWriter

func NewWriter(w io.Writer) (io.WriteCloser, error)

NewWriter wraps the writer and returns the WriteCloser. Any information written to the writer is encrypted with the hashed machineID. WriteCloser must be closed to flush any buffered data.

func Open

func Open(filename string) (io.ReadCloser, error)

Open opens an encrypted file container.

func SetAppID

func SetAppID(s string) error

SetAppID allows to set the appID, that is used to hash the value of machineID.

Types

This section is empty.

Jump to

Keyboard shortcuts

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