Documentation
¶
Overview ¶
Package aes provides legacy AES helpers kept for backward compatibility.
AesEncrypt and AesDecrypt implement AES-CBC with PKCS#7 padding. CBC provides confidentiality only and does not authenticate the ciphertext, so a tampered message can decrypt to attacker-influenced plaintext and the padding check can be abused as a padding oracle. These functions exist only to read data produced by older releases.
New formats must use an authenticated encryption mode such as AES-GCM (see keypair.EncryptWithCustomScrypt) instead of the raw CBC helpers here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
AesDecrypt decrypts an AES-CBC ciphertext produced by AesEncrypt.
The ciphertext is not authenticated, so a successful return does not prove the data was not modified. Prefer an AEAD for new formats.
func AesEncrypt ¶
AesEncrypt encrypts plaintext with AES-CBC and PKCS#7 padding.
The returned ciphertext is NOT authenticated. Do not use this function for new formats; use an AEAD instead.
func PKCS5Padding ¶
func PKCS5UnPadding ¶
PKCS5UnPadding validates and removes PKCS#7 padding from src. It rejects empty input, a padding length outside [1, blockSize], a length larger than the buffer and buffers whose length is not a multiple of the block size, and verifies that every padding byte carries the same value.
Types ¶
This section is empty.