Crypto Tools

AES-GCM and RSA-OAEP encryption and decryption using the WebCrypto API

Uses PBKDF2 (100,000 iterations) to derive a 256-bit AES-GCM key

About this tool

The AES/RSA Encryption tool lets you encrypt and decrypt text in-browser using the Web Cryptography API. AES-GCM mode provides authenticated symmetric encryption โ€” ideal for encrypting data with a password. RSA-OAEP provides asymmetric encryption with a generated key pair, useful for understanding public-key cryptography.

When to use it

  • โ†’Encrypting sensitive notes or config values before storing them
  • โ†’Learning how AES and RSA encryption work in practice
  • โ†’Testing encrypted payloads for API security implementations
  • โ†’Generating RSA key pairs for development and testing purposes

Tips

  • โ—†AES-GCM includes authentication โ€” a tampered ciphertext will fail to decrypt, not silently produce garbage.
  • โ—†The password you provide is stretched using PBKDF2 before deriving the AES key โ€” a weak password is still a security risk.
  • โ—†RSA is for encrypting small amounts of data (like an AES key). For large data, always use hybrid encryption: RSA + AES.

Frequently asked questions

What is the difference between AES-GCM and AES-CBC?

AES-GCM (Galois/Counter Mode) is an authenticated encryption mode โ€” it simultaneously encrypts and produces an authentication tag. If the ciphertext is tampered with, decryption fails with an error. AES-CBC (Cipher Block Chaining) only encrypts โ€” it provides no authentication, so tampering can go undetected. Always prefer AES-GCM for new implementations.

How secure is browser-based encryption?

The cryptographic operations themselves are as secure as any native application โ€” this tool uses the browser's Web Crypto API, which calls the operating system's cryptographic primitives. The risk is in the environment: a compromised browser extension or XSS vulnerability could intercept your keys or plaintext. For highly sensitive data, use dedicated offline tools.

What is PBKDF2 and why is it used for password-based encryption?

PBKDF2 (Password-Based Key Derivation Function 2) turns a human-chosen password into a cryptographic key. It does this by hashing the password thousands of times (this tool uses 100,000 iterations of SHA-256), making brute-force attacks extremely slow. A password that takes 1 millisecond to hash would take 100 seconds for an attacker to test one guess at 100,000 iterations.

When should I use RSA vs AES encryption?

Use AES for encrypting data of any size with a shared secret or password. Use RSA for key exchange โ€” to securely send an AES key to someone using their public key, without a pre-shared secret. In practice, hybrid encryption (generate a random AES key, encrypt data with AES, encrypt the AES key with RSA) combines both: RSA for the key exchange, AES for the bulk data.

๐Ÿฅท ToolNinja