aes

package
v0.0.0-...-32f009b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MacError = errors.New("invalid key - message authentication failed")

Functions

This section is empty.

Types

type CipherText

type CipherText struct {
	IV         []byte `json:"iv"`
	CipherText []byte `json:"cipher_text"`
	Mac        []byte `json:"mac"`
	Version    uint8  `json:"v"`
}

func CFBEncrypt

func CFBEncrypt(plainText PlainText, key Secret) (CipherText, error)

encrypt a plain text with given secret Deprecated: use CTREncrypt instead

func CTREncrypt

func CTREncrypt(plainText PlainText, secret Secret) (CipherText, error)

encrypt plain text by given key using AES CTR 256

func Unmarshal

func Unmarshal(rawCipherText []byte) (CipherText, error)

unmarshal cipher text

func (CipherText) Marshal

func (c CipherText) Marshal() ([]byte, error)

marshal cipher text

func (CipherText) ValidMAC

func (c CipherText) ValidMAC(s Secret) (bool, error)

verify MAC of cipher text

type PlainText

type PlainText []byte

func CFBDecrypt

func CFBDecrypt(cipherText CipherText, key Secret) (PlainText, error)

decrypt a cipher text with given secret Deprecated: use CFBDecrypt instead

func CTRDecrypt

func CTRDecrypt(cipherText CipherText, key Secret) (PlainText, error)

decrypt cipher text by given key

type Secret

type Secret [32]byte

Jump to

Keyboard shortcuts

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