cbc

package
v0.0.0-...-811459a Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2017 License: ISC Imports: 8 Imported by: 0

Documentation

Overview

Package cbc supports cbc encryption - this implementation is authenticated with crypto/hmac using sha256

Index

Constants

View Source
const (
	// NonceSize to use for nonces
	NonceSize = aes.BlockSize
	// MACSize is the output size of HMAC-SHA-256
	MACSize = 32
	// CKeySize - Cipher key size - AES-256
	CKeySize = 32
	// MKeySize - HMAC key size - HMAC-SHA-256
	MKeySize = 32
	// KeySize is the key size for CBC
	KeySize = CKeySize + MKeySize
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key, ciphertext []byte) ([]byte, error)

Decrypt decrypts ciphertext using the given key

func Encrypt

func Encrypt(key, plaintext []byte) ([]byte, error)

Encrypt encrypts plaintext using the given key with CBC encryption

func Key

func Key() (*[KeySize]byte, error)

Key returns a random key as a pointer to an array of bytes specified by KeySize

Types

type Cipher

type Cipher struct{}

Cipher implements the BlockCipher interface

func New

func New() *Cipher

New returns a new cbc cipher

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(key, ciphertext []byte) ([]byte, error)

Decrypt implements the BlockCipher interface

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(key, plaintext []byte) ([]byte, error)

Encrypt implements the BlockCipher interface

func (*Cipher) KeySize

func (c *Cipher) KeySize() int

KeySize returns CBC KeySize and implements the BlockCipher interface

Jump to

Keyboard shortcuts

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