AES Encryption Tool
AES-256-GCMとPBKDF2でテキストをブラウザ内暗号化・復号します。外部送信なし。
How to Use the AES Encryption Tool
Switch to "暗号化" (Encrypt) mode, enter a passphrase and plaintext, and select "暗号化". A fresh random salt and IV are generated for every encryption, and the result is shown as a single string in the format aesgcm256$<salt>$<IV>$<ciphertext>that you can copy and store. Switch to "復号" (Decrypt) mode, enter the same passphrase and the encoded string, and select "復号" to recover the original text.
What Is AES-GCM?
AES-GCM (Galois/Counter Mode) is an authenticated encryption mode: it provides confidentiality and, via a built-in authentication tag, detects whether the wrong key was used or the ciphertext was tampered with. This makes it a safer default than unauthenticated modes like plain CBC, which silently produce garbage output on the wrong key.
Why PBKDF2 Key Derivation?
A passphrase typed by a person is not directly usable as an AES key. This tool derives a 256-bit key from your passphrase using PBKDF2-HMAC-SHA-256 with 600,000 iterations and a random 16-byte salt, matching OWASP's current recommendation for PBKDF2-HMAC-SHA-256 (this site's PBKDF2 Hash Generator lets you pick a different hash algorithm, so its iteration count is independently adjustable). The salt is stored alongside the ciphertext (it is not secret) so the same key can be re-derived at decryption time.
AES暗号化・復号ツールについて
パスフレーズとPBKDF2(反復回数600,000回、SHA-256。OWASPが示すPBKDF2-HMAC-SHA256の推奨値)から256ビットのAES鍵を導出し、AES-256-GCMでテキストを暗号化・復号します。ソルト・IV・暗号文をまとめたaesgcm256$<ソルト>$<IV>$<暗号文>という1つの文字列として扱うため、保存・共有がしやすい設計です。
実務での活用例
- アプリ実装のクロスチェック -- 自作のAES-GCM実装が期待通りの暗号文・鍵導出をしているか、テスト値で突き合わせて確認できます
- 設定ファイルの一時的な難読化 -- ローカル環境でのみ使うテスト用シークレットを、平文のまま置いておきたくない場合の簡易的な保護に使えます
- 暗号化フォーマットの学習 -- ソルト・IV・認証タグの役割を実際に手を動かして理解できます
よくある落とし穴と対処 / Common Pitfalls
| 落とし穴 / Pitfall | 問題 / Problem | 対処 / Fix |
|---|---|---|
| IVを固定・使い回す Reusing or fixing the IV | AES-GCMの安全性が根本から崩れる This breaks AES-GCM's core security guarantee | 本ツールは暗号化のたびに新しいIVを自動生成する This tool generates a fresh IV on every encryption |
| 短い・推測されやすいパスフレーズ Short or guessable passphrases | PBKDF2を通しても総当たりに弱くなる Weak even after PBKDF2 stretching | 長くユニークなパスフレーズを使う(Password Generator推奨) Use a long, unique passphrase (see Password Generator) |
| 暗号化済み文字列の一部を編集・改行を挿入 Editing the encoded string or adding line breaks | Base64が破損し復号に失敗する Corrupts the Base64 data, causing decryption to fail | 1行のまま改変せずコピー&ペーストする Copy and paste the whole string unmodified on one line |
| 復号失敗を「バグ」と誤解する Assuming a decryption failure is a bug | AES-GCMは認証付きのため、鍵違い・改ざんは意図的に失敗する AES-GCM is designed to fail on the wrong key or tampered data | パスフレーズと文字列全体が正しいか再確認する Double-check the passphrase and the full encoded string |
| 本番の機密情報をこのツールで扱う Using this tool for real production secrets | ブラウザタブや履歴に平文・鍵が残るリスクがある Plaintext or keys may linger in the browser tab or history | 本番用途は専用のシークレット管理基盤を使う Use a dedicated secrets manager for production use |
言語別コード例 / Code Examples
JavaScript (Web Crypto)
const ciphertext = await crypto.subtle.encrypt(
{ name: "AES-GCM", iv },
key,
new TextEncoder().encode(plaintext)
);Python (cryptography)
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
aesgcm = AESGCM(key) # key: 32 bytes
ciphertext = aesgcm.encrypt(iv, plaintext.encode(), None)Node.js
const crypto = require("node:crypto");
const cipher = crypto.createCipheriv("aes-256-gcm", key, iv);
const encrypted = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]);
const authTag = cipher.getAuthTag();Go
block, _ := aes.NewCipher(key)
gcm, _ := cipher.NewGCM(block)
ciphertext := gcm.Seal(nil, iv, plaintext, nil)生成例 / Before & After
入力: passphrase = "correct horse battery staple"
plaintext = "Hello, World!"
出力(例。ソルト・IVは毎回ランダムなため実行のたびに変わります):
aesgcm256$c2FsdGJ5dGVzMTIzNA==$aXZieXRlczEyMzQ1Ng==$8x3kP2mQ...(暗号文+認証タグ)Why browser-only?
Whatever you type here — a passphrase or the plaintext you want to protect — is sensitive by definition. This tool performs key derivation, encryption, and decryption entirely with the Web Crypto API inside your browser tab: nothing is transmitted to a server. Open DevTools and watch the Network tab while encrypting or decrypting — zero requests. That said, browser-only processing does not make an untrusted device safe; for real production secrets, use a proper secrets manager instead of this tool.
ここに入力するパスフレーズ・平文はいずれも機密情報です。本ツールは鍵導出・暗号化・復号の全てをブラウザ内のWeb Crypto APIで完結し、外部送信は一切ありません。ただし、ブラウザで完結すること自体が安全な端末を保証するものではないため、本番の機密情報は専用のシークレット管理基盤で扱ってください。
関連ツール / Related Tools
開発をもっと効率的に
PR
レンタルサーバー
エックスサーバー
国内シェアNo.1の高速レンタルサーバー(エックスサーバー社調べ)。WordPressも簡単セットアップ。
詳しく見る →レンタルサーバー
ConoHa WING
国内最速クラスのレンタルサーバー。独自ドメイン永久無料特典付き(特典内容は変更される場合があります)。
詳しく見る →レンタルサーバー
mixhost
高速SSD・HTTP/3対応のクラウド型レンタルサーバー。
詳しく見る →VPS
シンVPS
メモリ単価が国内最安水準・オールNVMe SSD搭載の高性能VPS(大容量メモリプラン利用時)。開発・検証環境の構築に。
詳しく見る →Windows VPS
ConoHa for Windows Server
Windows環境のVPS。リモートデスクトップで開発・検証環境を構築。
詳しく見る →