AES: What It Is, Symmetric Encryption Algorithm and Where It's Used

Author: IT Sectr Published: 2026-04-02 Reading time: 9 min

AES (Advanced Encryption Standard) is a symmetric block cipher algorithm adopted in 2001 by the National Institute of Standards and Technology (NIST) as the official standard. AES replaced the outdated DES and has since become the most widespread encryption algorithm in the world, used from banking systems to mobile applications. According to NIST (2023), AES provides security equivalent to 2^256 operations for a 256-bit key, making it invulnerable to modern brute-force attacks. NIST FIPS 197, 2023

Key Takeaways

  • AES is a symmetric block cipher with a fixed block size of 128 bits and keys of 128, 192 or 256 bits.
  • GCM mode is the recommended AES operation mode for mobile applications, providing authenticated encryption.
  • AES-256 is the version with maximum security level, recommended for protecting highly sensitive data.
  • Hardware acceleration — AES-NI processor instructions enable encryption at speeds up to 10 GB/s on modern devices.
  • Android and iOS provide built-in APIs for AES: Android Keystore and iOS CryptoKit with hardware acceleration support.

What is AES?

AES (Advanced Encryption Standard) is a symmetric block cipher developed by Belgian cryptographers Joan Daemen and Vincent Rijmen under the name Rijndael. In 2001, NIST selected Rijndael as the winner of the competition for a new US encryption standard after five years of public testing and analysis. AES operates on fixed-size data blocks (128 bits) and supports three key lengths: 128, 192, and 256 bits. The number of transformation rounds depends on the key length: 10 rounds for 128-bit, 12 for 192-bit, and 14 for 256-bit keys. Each round includes four operations: SubBytes (nonlinear byte substitution via S-box), ShiftRows (cyclic row shifting), MixColumns (column mixing), and AddRoundKey (round key XOR).

History of the AES Standard

The development of AES began in 1997 when NIST announced a competition to replace DES, whose 56-bit key was cracked in 22 hours in 1998 on the specialized Deep Crack device. Fifteen algorithms from various countries participated, including Serpent (UK), Twofish (USA), and RC6 (USA). By the 1999 finals, 5 candidates remained. Rijndael won due to its combination of high speed across all platforms (from 8-bit microcontrollers to 64-bit servers), resistance to cryptanalysis, and compact hardware implementation. Since 2006, AES has been used for encrypting SECRET and TOP SECRET classified data in US government systems. Today, AES is embedded in all major protocols: TLS 1.2/1.3, IPsec, SSH, Wi-Fi WPA2/WPA3, and Bluetooth BR/EDR.

How AES Encryption Works

AES processes data in blocks of 128 bits (16 bytes), organized as a 4x4 byte matrix called the state. Each encryption round performs a sequence of deterministic transformations that collectively create an avalanche effect: changing one bit of input data changes about 50% of output data bits. This effect makes AES resistant to differential and linear cryptanalysis — the primary methods for breaking block ciphers.

The process begins with AddRoundKey — XORing the initial key with the state. Then rounds are executed: SubBytes replaces each state byte with a value from the S-box (substitution table). ShiftRows cyclically shifts the second row by 1 position, the third by 2, the fourth by 3 — ensuring inter-column mixing. MixColumns multiplies each state column by a fixed matrix in the Galois field GF(2^8), creating dependency of each output byte on all four input bytes of the column. AddRoundKey XORs the next round key, derived from the original key through Key Expansion. The last round omits MixColumns. Decryption uses inverse operations InvSubBytes, InvShiftRows, InvMixColumns, and AddRoundKey in reverse order. For mobile developers, understanding AES internal structure is not required — it is enough to know how to properly call the platform's built-in APIs with correct parameters.

Avalanche Effect and Cryptographic Strength of AES

The key characteristic of AES that ensures its cryptographic strength is the avalanche effect. Changing one bit in plaintext or key results in approximately 50% of ciphertext bits changing, making AES extremely resistant to differential and linear cryptanalysis. The combination of SubBytes (nonlinearity via S-box) and MixColumns (diffusion via Galois field multiplication) creates mathematical complexity such that even knowing part of the ciphertext does not allow key recovery faster than brute force. According to NIST analysis (2018), the best known attack on AES-128 — the biclique attack — reduces effective key length by only 2 bits (to 126.2 bits), providing no practical advantage to an attacker. For AES-256, there are no practically feasible attacks exceeding brute force.

AES Key Sizes and Security Levels

AES supports three key sizes, each corresponding to a specific cryptographic strength level. Key size choice affects security, performance, and device resource requirements.

Key SizeNumber of RoundsSecurity LevelApplication
AES-12810128 bitsCommercial applications, TLS
AES-19212192 bitsGovernment systems (SECRET)
AES-25614256 bitsTOP SECRET, financial sector

Practical rule: for mobile applications use AES-256 by default. The performance difference between AES-128 and AES-256 on modern devices with AES-NI support is no more than 10–15%, but the security level doubles. According to quantum analysis (Grassl et al., 2016), cracking AES-128 would require 2^77 quantum operations via Grover's algorithm, while AES-256 would require 2^149, making AES-256 resistant to quantum attacks for the next 20–30 years. Even AES-128 provides sufficient protection for the vast majority of commercial scenarios: brute-forcing a 128-bit key would require more energy than exists in the universe according to Bruce Schneier's estimate. However, security standards (GDPR, HIPAA, PCI DSS) often explicitly require AES-256, so production projects should use the maximum key length.

AES Operation Modes

AES as a block cipher encrypts fixed-size blocks (128 bits). For encrypting arbitrary-length data, operation modes are used. Mode selection critically affects security: the wrong mode can negate AES strength.

  • ECB (Electronic Codebook) — the simplest and most insecure mode. Each block is encrypted independently with the same key. Identical plaintext blocks produce identical ciphertext blocks, allowing data structure recovery. Prohibited in all modern security standards. NEVER use ECB in mobile applications.
  • CBC (Cipher Block Chaining) — each previous ciphertext block is used as an initialization vector (IV) for the next one. Requires a random IV for each message. Vulnerable to padding oracle attacks when improperly implemented. Suitable for file encryption but requires MAC (HMAC) for data integrity.
  • GCM (Galois/Counter Mode) — the recommended mode for mobile applications. Provides authenticated encryption (AEAD): encryption + integrity verification in a single operation. Uses a counter for keystream generation and Galois field multiplication for authentication. GCM requires a unique nonce (12 bytes) for each message. Recommended by NIST, used in TLS 1.2/1.3 and Android Keystore.
  • CCM (Counter with CBC-MAC) — an alternative AEAD mode based on CTR + CBC-MAC. Slower than GCM and does not support parallel processing. Used in ZigBee and 802.11 (Wi-Fi) protocols. For mobile applications, GCM is preferred.

For mobile projects use AES-256-GCM with a 12-byte nonce. GCM solves two problems simultaneously: data encryption and authentication, preventing padding oracle and chosen ciphertext attacks. Android Keystore and iOS CryptoKit support AES-GCM out of the box without needing additional cryptographic primitives. When working with GCM, it is critical to never reuse a nonce with the same key — this completely destroys encryption security. Generate a new random nonce for each encryption and store it alongside the ciphertext.

Implementing AES in Mobile Applications

Let's look at an example of secure AES-256-GCM implementation on Android using Jetpack Security. The code below demonstrates the full cycle: creating an AES-256 key via MasterKey, encrypting and decrypting a string with additional authenticated data (AAD).

kotlin
import androidx.security.crypto.MasterKey
import androidx.security.crypto.EncryptedSharedPreferences

val masterKey = MasterKey.Builder(context)
    .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
    .build()

val securePrefs = EncryptedSharedPreferences.create(
    context,
    "secure_prefs",
    masterKey,
    EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
    EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)

fun storeSecureData(key: String, value: String) {
    securePrefs.edit().putString(key, value).apply()
}

fun readSecureData(key: String): String? {
    return securePrefs.getString(key, null)
}

The key feature of this solution is that AES-256-GCM is used at two levels: for encrypting key-value pairs (PrefValueEncryptionScheme) and for protecting the key names themselves (PrefKeyEncryptionScheme uses AES-256-SIV, resistant to nonce reuse). MasterKey is generated using the AES-256-GCM algorithm and stored in Android Keystore, which is hardware-protected on devices with Trusted Execution Environment. On devices without hardware support (TEE), the key is encrypted via Bouncy Castle, which is still safer than storing in SharedPreferences.

For direct encryption of large data volumes (e.g., images or files), use AES-256-GCM via EncryptedFile from AndroidX Security. For key export (e.g., for backup), use additional encryption with a user password via PBKDF2 with 100000+ iterations.

AES on iOS via CryptoKit

On iOS, AES operations are organized through the CryptoKit framework (Swift 5.0+). An AES-256 key is created via SymmetricKey(size: .bits256) and stored in the Secure Enclave — a hardware crypto processor isolated from the main CPU and operating system. CryptoKit provides two AES implementations: AES.GCM (recommended) and AES.CBC (for backward compatibility with legacy formats). Encryption is performed via the seal() method, which takes data, key, and nonce (12 bytes), and returns AES.GCM.SealedBox — a structure containing ciphertext and authentication tag. Decryption is via open(). Apple strongly recommends against using CommonCrypto directly: CryptoKit automatically selects optimal parameters, protects against side-channel attacks, and uses AES-NI hardware acceleration on Apple Silicon processors. On devices with Secure Enclave, keys never leave the hardware module, preventing theft even with full application compromise. For key serialization, use the withUnsafeBytes method followed by storage in Keychain via SecItemAdd with the kSecAttrAccessible = kSecAttrAccessibleWhenUnlockedThisDeviceOnly attribute.

Frequently Asked Questions

What is AES in simple terms?

AES is an algorithm that converts readable data into an unreadable set of bytes using a secret key. The same key is needed to return the data to its original form. AES is so reliable that it is used to encrypt secret documents of the US government.

How is AES-128 different from AES-256?

AES-128 uses a 128-bit key and performs 10 encryption rounds. AES-256 uses a 256-bit key and 14 rounds, making it 2^128 times harder to crack. For mobile applications, AES-256 is recommended due to minimal performance difference.

Which AES mode is the most secure?

AES-256-GCM is the most secure and recommended mode. GCM provides authenticated encryption (encryption + integrity verification). ECB mode is prohibited, CBC requires a separate MAC. GCM is the de facto standard for mobile applications.

Can AES be cracked?

Theoretically, AES can be cracked by brute force, but for AES-256 it would require 2^256 attempts — more than the number of atoms in the observable universe. No practical attacks on AES-256 exist. Side-channel attacks (Spectre, Meltdown) do not break AES but steal keys from memory, so hardware key storage is critical.

How to use AES in a mobile app on Android?

Use the AndroidX Security library: MasterKey.Builder with KeyScheme.AES256_GCM creates a protected key in Android Keystore, and EncryptedSharedPreferences automatically encrypts all data via AES-256-GCM. No manual cryptography — the API is secure by default, without risk of developer errors.

Summary

  • AES is the most widespread and proven symmetric encryption algorithm, standardized by NIST in 2001.
  • AES-256 provides maximum security with a margin against quantum attacks for the next 20–30 years.
  • GCM mode is the only recommended mode for mobile applications: encryption + authentication in a single operation.
  • Android Keystore and iOS Secure Enclave — hardware storages isolating AES keys from the application.
  • Jetpack Security (Android) and CryptoKit (iOS) provide secure AES-256-GCM implementations without manual cryptography.
  • Nonce (IV) for GCM must be unique for each encryption — reuse completely destroys security.
  • Recommendation: use AES-256-GCM via EncryptedSharedPreferences on Android and CryptoKit on iOS for all sensitive data.

We will develop a mobile application turnkey

IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.

Discuss the project

Read also