crypto

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHMAC

func CreateHMAC(keyb []byte, data []byte) ([]byte, error)

CreateHMAC will generate a cryptographic hash of data supplied

func DecryptString added in v0.3.1

func DecryptString(WrappedText string, key []byte) (string, error)

func EncryptString added in v0.3.1

func EncryptString(data string, key []byte) (string, error)

func GetPassword

func GetPassword() ([]byte, error)

func JoinBytes

func JoinBytes(dst, src []byte) []byte

func RandomKey

func RandomKey(n int) []byte

RandomKey returns a number of random bytes

func RandomKeyB64

func RandomKeyB64(n int) string

RandomKeyB64 is the same as RandomKey but returns the bytes encoded in Base64

Types

type EncryptionObject

type EncryptionObject struct {
	Key         []byte
	CipherText  []byte
	PlainText   []byte
	HMAC        []byte
	WrappedData string
}

EncryptionObject contains all the variables and methods associated with encrypting and decrypting data

func (*EncryptionObject) Decrypt

func (e *EncryptionObject) Decrypt() error

Decrypt will decrypt data with specified key

func (*EncryptionObject) Encrypt

func (e *EncryptionObject) Encrypt() error

Encrypt will crypto data with specified key

func (*EncryptionObject) InlineEncryptMap added in v0.4.0

func (e *EncryptionObject) InlineEncryptMap(path string) error

func (*EncryptionObject) ReadConfigFiles

func (e *EncryptionObject) ReadConfigFiles(filename string) []byte

func (*EncryptionObject) ReadEncryptedConfigFiles

func (e *EncryptionObject) ReadEncryptedConfigFiles(filename string) []byte

func (*EncryptionObject) UnwrapCrypto

func (e *EncryptionObject) UnwrapCrypto() error

UnwrapCrypto unwraps cipher text and hmac to allow decryption

func (*EncryptionObject) WrapCrypto

func (e *EncryptionObject) WrapCrypto()

WrapCrypto wraps both cipher text and hmac into a single string to be written to disk

Jump to

Keyboard shortcuts

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