加密 text with AES and decrypt it back
Symmetrically 加密消息具有 passphrase using AES-256-GCM, 然后解密 ciphertext 具有相同键 到 recover 原始.
- 1
AES 是标准 symmetric cipher: 相同键 encrypts 和 decrypts. GCM 模式 provides 已认证加密 — 它 detects tampering 的 ciphertext. 从不 use ECB 或未认证 CBC 为新 数据.
- 2 AES 加密器 →
Enter plaintext 和 passphrase. tool derives 键 (PBKDF2), generates random IV, 和输出 ciphertext + IV + salt, 通常 Base64-encoded.
- 3 AES 解密器 →
Paste ciphertext 输出和 相同 passphrase. tool recovers 原始 plaintext. 如果 passphrase 是错误, GCM 模式 fails 具有认证错误而非 returning garbage.
- 4
Store passphrase separately 从 ciphertext. IV 和 salt 是不 secret 和 travel 具有 ciphertext — 仅 passphrase needs 保护.
常见问题
- 什么 happens 如果 I use 错误 passphrase 到解密?
- 具有 GCM 模式, 解密 fails 具有认证 tag mismatch — 你 get 错误, 不 garbage 文本. 此是 为什么 GCM 是 preferred 遍历 CBC: 它 detects tampering 和错误关键 immediately.
- 是 IV 安全到 存储 alongside ciphertext?
- 是. IV (或 nonce) 是不 secret — 它仅 needs 到是 唯一 per 加密具有相同键. Storing 它具有 ciphertext 是标准实践. 仅键/passphrase 必须是 kept secret.