cipher

package
v0.0.0-...-53561ed Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

CBC describes a block cipher mode. In cryptography, a block cipher mode of operation is an algorithm that uses a block cipher to provide an information service such as confidentiality or authenticity. A block cipher by itself is only suitable for the secure cryptographic transformation (encryption or decryption) of one fixed-length group of bits called a block. A mode of operation describes how to repeatedly apply a cipher's single-block operation to securely transform amounts of data larger than a block.

This package simplifies the usage of AES-256-CBC.

Package cipher is a package for common encrypt/decrypt of symmetric key messages.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidBlockSize indicates hash blocksize <= 0.
	ErrInvalidBlockSize = errors.New("invalid blocksize")

	// ErrInvalidPKCS7Data indicates bad input to PKCS7 pad or unpad.
	ErrInvalidPKCS7Data = errors.New("invalid PKCS7 data (empty or not padded)")

	// ErrInvalidPKCS7Padding indicates PKCS7 unpad fails to bad input.
	ErrInvalidPKCS7Padding = errors.New("invalid padding on input")
)

PKCS7 errors.

Functions

func Decrypt

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

Decrypt will use the given key, iv, and ciphertext and return the plaintext bytes.

func DecryptCbc

func DecryptCbc(iv, key, ciphertext []byte) ([]byte, error)

Decrypt is a function that decrypts a given cipher text with a provided key and initialization vector(iv).

func Encrypt

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

Encrypt will use the given iv, key, and plaintext bytes and return ciphertext bytes.

func EncryptCbc

func EncryptCbc(iv, key, plaintext []byte) ([]byte, error)

Encrypt is a function that encrypts plaintext with a given key and an optional initialization vector(iv).

Types

This section is empty.

Jump to

Keyboard shortcuts

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