Advanced Encryption Standard

0001-01-01 cryptography

Advanced Encryption Standard (AES)

AES is a symmetric-key algorithm; the same key is used for both encryption and decryption.

There are several types of AES encryption: AES128, AES192, AES256, … These types of encryption vary by their key size; AES128 has a 128-bit key, AES256 a 256-bit key and so on.

AES can use different block cipher modes of operation such as CBC or GCM. Depending on the mode, the algorithm will require an additional component to be provided alongside the key known as the Initialization Vector (IV).

AES requires 128-bit input and outputs 128-bit output blocks. Input must be 16 bytes or padded to 16 bytes.

AES can be accessed via the WinAPI bCrypt (bcrypt.h).

Cryptography Next Generation (CNG) is a replacement for the Windows CryptoAPI and provides AES functionality: https://learn.microsoft.com/en-us/windows/win32/seccng/cng-portal

A drawback of using the WinAPI or bCrypt library is that their use will be present in the Import Address Table (IAT), and these functions may be hooked, exposing the plaintext, key, and other sensitive data. To get around this, you may implement AES yourself or use an open-source implementation such as tiny-AES: https://github.com/kokke/tiny-AES-c