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

Client-Side AES-GCM / CBC Encryptor & Decryptor

Hardware-accelerated AES-256 authenticated encryption executed strictly in your browser via Web Crypto API. Zero server retention.

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

130 Chars: (130 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);

Zero-Knowledge Local Execution

All data processing, parsing, and compilation execute strictly inside your local browser memory. Zero external server uploads.

Instant Local Cryptography

Instant real-time reactive computation delivers immediate feedback on every keystroke with zero network latency.

Production Standards & Compliance

Follows modern browser Web Crypto and security practices for safe client-side inspection.

Technical Reference & Architecture Guide

AES Encryption Tool Developer Reference

Production guide and technical parameter reference for browser-based AES-GCM and AES-CBC symmetric encryption.

AES Encryption Tool Developer Reference — Client-Side In-Memory Architecture & Data Flow
AES Encryption Tool Developer Reference — Client-Side In-Memory Architecture & Data Flow

Key Parameters & Controls

Key Parameters & Controls
ParameterType / UnitDescriptionDefault
algorithm"AES-GCM" | "AES-CBC"Block cipher mode of operation. AES-GCM offers authenticated encryption (AEAD) with integrity validation, whereas AES-CBC provides confidentiality with PKCS#7 padding."AES-GCM"
keyLength128 | 192 | 256Cryptographic key size in bits. 256-bit keys deliver post-quantum resistance margins and require 32 bytes of raw entropy or derived key material.256
keyMode"passphrase" | "raw"Secret key provision method. 'passphrase' derives symmetric keys via PBKDF2 using a random cryptographic salt, while 'raw' expects direct hexadecimal entropy."passphrase"
iterationsnumberPBKDF2 key stretching iteration count when deriving keys from human passphrases to defend against offline dictionary and GPU brute-force attacks.100000
aadstringOptional Additional Authenticated Data for AES-GCM. AAD is authenticated into the GHASH tag alongside the ciphertext without being encrypted itself.""

Pro Tips & Best Practices

Prefer AES-GCM for Authenticity

Always default to AES-GCM over AES-CBC for application payloads. GCM creates a 128-bit authentication tag that verifies message integrity and detects tampering before plaintext decryption occurs, preventing padding oracle vulnerabilities.

Enforce Unique Nonces per Cipher

Never encrypt two distinct plaintexts with the same key and Initialization Vector (IV) in AES-GCM. Reusing an IV destroys GCM authenticity guarantees and exposes the internal GHASH key, enabling ciphertext forgery.

Tune PBKDF2 Iteration Limits

When deriving keys from passphrases, maintain at least 100,000 to 250,000 PBKDF2 iterations using SHA-256. Always persist the random salt alongside the ciphertext, as PBKDF2 cannot reproduce the identical key without it.

Common Gotchas & Troubleshooting

⚠️DOMException: The operation failed for an operation-specific reason

This Web Crypto API error indicates AES-GCM authentication tag verification failure during decryption. Verify that the ciphertext, IV, cryptographic salt, and Additional Authenticated Data (AAD) match the original encryption values exactly without byte truncation or encoding corruption.

⚠️Invalid hex string: length must be an even number of characters

The raw key or IV hexadecimal input has an odd number of nibbles or contains non-hexadecimal characters. Ensure hex strings contain only characters 0-9 and a-f, strip prefixes like '0x', and confirm length is exactly 32 chars for 128-bit or 64 chars for 256-bit.

⚠️SubtleCrypto.importKey rejected with InvalidAccessError

The supplied raw key byte length does not match the configured keyLength parameter. Provide an exact 32-character hex string for 128-bit (16 bytes), 48-character hex for 192-bit (24 bytes), or 64-character hex for 256-bit (32 bytes).

Frequently Asked Questions

Does this utility transmit plaintext or secret keys to any remote backend?▼

No. All encryption, key derivation, and decryption routines run locally in your client runtime using the native Web Cryptography API (SubtleCrypto). No plaintexts, passphrases, raw keys, or ciphertexts leave your device.

What payload structure is included in the exported JSON bundle?▼

The bundle contains the algorithm, keyLength, iteration count, Base64/Hex ciphertext, random 12-byte or 16-byte IV, and the cryptographic salt used for PBKDF2. This self-contained schema can be deserialized directly in Node.js, Python cryptography, or Go.

Why is a 12-byte (96-bit) IV recommended for AES-GCM instead of 16 bytes?▼

Per NIST SP 800-38D, a 96-bit IV is directly mapped into the initial GCM counter block (J0) without requiring an intermediate GHASH computation. Using 16-byte IVs forces an extra hash operation, reducing throughput and introducing collision risk.

How can exported AES-GCM outputs be decrypted in Node.js crypto?▼

Parse the JSON bundle, convert the hex/base64 strings to Buffer objects, instantiate a decipher via crypto.createDecipheriv('aes-256-gcm', key, iv), set the authentication tag via decipher.setAuthTag(tag), specify AAD via decipher.setAAD(aad) if used, and call decipher.update() followed by decipher.final().