whatsmeowgo.mau.fi/whatsmeow/util/cbcutil Index | Files

package cbcutil

import "go.mau.fi/whatsmeow/util/cbcutil"

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.

Index

Functions

func Decrypt

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

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

func DecryptFile

func DecryptFile(key, iv []byte, file File) error

func Encrypt

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

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

func EncryptStream

func EncryptStream(key, iv, macKey []byte, plaintext io.Reader, ciphertext io.Writer) ([]byte, []byte, uint64, uint64, error)

Types

type File

type File interface {
	io.Reader
	io.WriterAt
	Truncate(size int64) error
	Stat() (os.FileInfo, error)
}

Source Files

cbc.go

Version
v0.0.0-20250326122532-6680c9a6e9a7 (latest)
Published
Mar 26, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
5 hours ago

Tools for package owners.