crypto

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DecryptErr = errors.New("message corrupt or incorrect keys")

Functions

func DecryptPathItems

func DecryptPathItems(key []byte, path string, encryptedReader io.Reader) (string, io.ReadCloser, error)

DecryptPathItems returns a decrypted path string and an io.Reader that reads the decrypted data from the encrypted reader passed into the function. To only decrypt a path, pass in an empty byte buffer as the reader and check only for the string result.

NOTE: key must be a 64 byte long key

func EncryptPathItems

func EncryptPathItems(key []byte, path string, plainReader io.Reader) (string, io.Reader, error)

EncryptPathItems returns an encrypted path and a Reader that reads the encrypted data from the plain reader passed into the function. Encrypted data is AES-CTR of data + AES-512 HMAC of encrypted data

NOTE: key must be a 64 byte long key To decrypt the result of this function use the DecryptPathItems function

func NewDecryptReader

func NewDecryptReader(r io.Reader, aesKey, iv, hmacKey []byte) (io.ReadCloser, error)

NewDecryptReader creates an io.ReadCloser wrapping an io.Reader using the keys and iv to decode the content using AES and verify HMAC.

func NewEncryptReader

func NewEncryptReader(r io.Reader, aesKey, iv, hmacKey []byte) (io.Reader, error)

NewEncryptReader returns an io.Reader wrapping the provided io.Reader.

Types

This section is empty.

Jump to

Keyboard shortcuts

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