Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

aescts

import "github.com/TheManticoreProject/Manticore/crypto/aescts"

Package aescts implements AES-CTS (Ciphertext Stealing) mode as used by Kerberos per RFC 3962. The variant used is CBC-CTS where the last two ciphertext blocks are swapped before output (Kerberos / CS3 style).

Index

func Decrypt

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

Decrypt decrypts ciphertext using AES-CTS with the given key and IV. ciphertext must be >= 16 bytes. Output length equals input length.

func Encrypt

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

Encrypt encrypts plaintext using AES-CTS with the given key and IV. plaintext must be >= 16 bytes (one AES block). Output length equals input length.

For plaintext of exactly one block (16 bytes), standard AES-CBC is used (no swap is possible with a single block). For two or more blocks, the last two blocks in the CBC output are swapped and the output is truncated to len(plaintext) bytes.