conceal

package module
v0.0.0-...-4e1bd02 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2016 License: Apache-2.0 Imports: 5 Imported by: 2

README

Conceal

GoDoc

Conceal provides methods for encrypting and decrypting data. See godoc above for library reference

Documentation

Overview

Package conceal provides the ability to encrypt/decrypt byte slices using aes encryption. Its primary job is to encrypt and base64-encode a byte slice. It base64-decodes and decrypts data given a Cloak instantited with the same pin used to encrypt the data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CipherLengthError

type CipherLengthError struct{}

func (CipherLengthError) Error

func (err CipherLengthError) Error() string

CipherLengthError occurs when the data passed in to Unveil is shorter than the length of the 16 byte encryption key.

type Cloak

type Cloak struct {
	// contains filtered or unexported fields
}

A Cloak encrypts and decrypts []byte using Veil and Unveil.

func NewCloak

func NewCloak(key []byte) (Cloak, error)

NewCloak takes a key that is resized to 16 bytes and used as a key in AES encryption. It returns a Cloak. If the key cannot be used to create a cipherBlock, an error is returned.

func (Cloak) Unveil

func (cloak Cloak) Unveil(data []byte) ([]byte, error)

Unveil base64 decodes a slice of bytes and uses aes encryption to decrypt. It returns a decrypted slice of bytes, and an error. A CipherLengthError is returned if the data is less than 16 bytes.

func (Cloak) Veil

func (cloak Cloak) Veil(data []byte) ([]byte, error)

Veil base64 encodes a slice of bytes and uses aes encryption. It returns an encrypted slice of bytes, and an error.

type CloakInterface

type CloakInterface interface {
	Veil([]byte) ([]byte, error)
	Unveil([]byte) ([]byte, error)
}

Jump to

Keyboard shortcuts

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