AES-GCM / CBC
NIST SP 800-38DAEAD AuthenticatedZero Cloud Transmission

Client-Side AES-GCM / CBC Encryptor & Decryptor

Encrypt and decrypt strings and files using modern AES-GCM 256-bit cryptography powered by the native browser Web Crypto API. Perform secure authenticated encryption (AEAD) with PBKDF2 key derivation without exposing passwords or sensitive plaintext to any external servers.

Cryptographic Parameters & Security Specs

WebCrypto Engine
Strength:Very Strong
PBKDF2 Salt (16 Bytes Hex)
IV / Nonce (12B (96-bit) Hex)
AEAD Additional Data (AAD, Optional)Integrity-only

Input Plaintext

129 chars (129 bytes)
Client-Side Only

Encrypted Result (Ciphertext)

Click "Encrypt Plaintext" to generate encrypted ciphertext

Developer Integration Decryption Code

// Browser Native Web Crypto API Decryption
async function decryptAes(ciphertextB64, password, ivHex, saltHex, iterations = 100000) {
  const hexToBytes = (h) => new Uint8Array(h.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
  const b64ToBytes = (b) => Uint8Array.from(atob(b), c => c.charCodeAt(0));

  const salt = hexToBytes(saltHex);
  const iv = hexToBytes(ivHex);
  const ciphertext = b64ToBytes(ciphertextB64);

  const enc = new TextEncoder();
  const keyMaterial = await crypto.subtle.importKey(
    "raw", enc.encode(password), "PBKDF2", false, ["deriveKey"]
  );

  const key = await crypto.subtle.deriveKey(
    { name: "PBKDF2", salt, iterations, hash: "SHA-256" },
    keyMaterial,
    { name: "AES-GCM", length: 256 },
    false,
    ["decrypt"]
  );

  const decrypted = await crypto.subtle.decrypt(
    { name: "AES-GCM", iv, tagLength: 128 },
    key,
    ciphertext
  );

  return new TextDecoder().decode(decrypted);
}

// Example Execution:
decryptAes("YOUR_CIPHERTEXT_BASE64...", "YOUR_PASSWORD", "", "")
  .then(console.log);

Cryptographic Architecture & Security FAQ

Understanding AES-GCM (Authenticated Encryption with Associated Data) and zero-knowledge client execution.

Why AES-GCM over AES-CBC?

AES-GCM is an AEAD (Authenticated Encryption with Associated Data) mode that provides both confidentiality and data authenticity simultaneously. Unlike CBC which is vulnerable to padding oracle attacks if improperly implemented, GCM includes a 128-bit authentication tag that cryptographically guarantees ciphertext integrity.

Why are IV (Nonce) and Salt Critical?

A new random IV (Initialization Vector) MUST be generated for every encryption operation to prevent identical plaintexts from yielding identical ciphertexts and to foil replay attacks. The 16-byte random Salt ensures PBKDF2 produces distinct keys even if users share identical passphrases, nullifying rainbow table attacks.

Zero-Knowledge Client-Side Execution

All cryptographic computations are executed directly inside your browser engine via window.crypto.subtle. Zero keys, passphrases, plaintexts, or files ever transit across the internet or touch server storage.

NIST & OWASP Compliance

The implementation adheres strictly to NIST SP 800-38D recommendations (12-byte IV for GCM) and OWASP Password Storage guidelines (100,000+ iterations PBKDF2 with SHA-256), delivering enterprise-grade cryptosystem standards.