Zum Inhalt springen
uencoder

Speichern Verschlüsselung Schlüssel securely

Schlüssel muss niemals sein hardcoded oder committed in source control. Lernen HSM, KMS, envelope Verschlüsselung, und Schlüssel derivation Muster für sicher Schlüssel storage.

  1. 1

    The golden rule: never store encryption keys in plaintext alongside the data they encrypt. Options from most to least secure: HSM (hardware), KMS (cloud service), envelope encryption (master key wraps data keys), key derivation (derive from a password/passphrase).

  2. 2
    PBKDF2-Schlüsselableitung →

    Derive an encryption key from a user password using PBKDF2 with a high iteration count (100,000+). The salt must be random and stored separately. This is for user-controlled keys where no server-side storage exists.

  3. 3
    bcrypt-Hash-Generator →

    Hash a master password with bcrypt for authentication. Note: bcrypt output is not suitable as an encryption key directly — use PBKDF2/scrypt for key derivation, bcrypt for password verification.

  4. 4
    AES-Verschlüsseler →

    Use the derived key to encrypt data. The key never touches disk in plaintext — it exists only in memory during the encryption operation and is zeroed afterward.

  5. 5

    For server-side applications, use a KMS (AWS KMS, GCP KMS, Azure Key Vault) or HSM. The master key never leaves the hardware; you call an API to encrypt/decrypt. For client-side, derive keys from user passwords with a strong KDF and store only the salt.

Häufige Fragen

Can I store a key in an environment variable?
Environment variables are better than hardcoding but still visible to anyone with process access (e.g., /proc/pid/environ on Linux). Use a KMS or secrets manager (Vault, AWS Secrets Manager) for production. Environment variables are acceptable for development only.
What is the difference between PBKDF2 and bcrypt?
PBKDF2 is a KDF that produces a key of any length — use it for encryption keys. bcrypt is a password hashing function with a fixed output — use it for password verification. They serve different purposes and are not interchangeable.

Workflows, die diese Aufgabe lösen

Verwandte Tools