Key Generator Studio

Cryptographically Secure Database & Application Key Engine

CSPRNG Engine (Up to 512-bit)
Generated using client-side CSPRNG (Cryptographically Secure Pseudo-Random Number Generator). Zero network transmission.
CRITICAL

ENCRYPTION_KEY

256-bit Base64 Key for Column & Payload Encryption
Entropy: 256 bits Format: base64:...
MAXIMUM STRENGTH

MASTER_KEY_512

512-bit Ultra High-Entropy Base64 Master Key
Entropy: 512 bits Format: base64:...
DATABASE

SEARCH_KEY

Blind Index / Search Hash Salt Key
Entropy: 256 bits Format: base64:...
BACKUP

BACKUP_KEY

256-bit Key for Encrypted Database Dump Files
Entropy: 256 bits Format: base64:...
APPLICATION

APP_KEY

Session & Web Application Signing Key
Entropy: 256 bits Format: base64:...
HMAC SECRET

QR_HMAC_SECRET

256-bit Hex Key for Token & QR Signature Validation
Entropy: 256 bits Format: hex:...
AUTHENTICATION

DB_PASSWORD

High-Entropy Database Access Password (32 chars)
Entropy: ~210 bits Format: Complex String
AUTH TOKENS

JWT_SECRET

512-bit Secret Key for HS512 JWT Signature
Entropy: 512 bits Format: Hex String

Custom Key Generator Settings

.env File Generator

Safe Procedure for Changing ENCRYPTION_KEY (Key Rotation)

IMPORTANT DATA SAFETY RULE: Because database records are encrypted with your existing ENCRYPTION_KEY, do NOT simply replace ENCRYPTION_KEY in .env without re-encrypting existing data!

1

Backup Database

Save a complete backup of your database tables before performing any key rotation operations.

2

Run Migration Script

Use the provided PHP / Node key rotation script to decrypt existing records using your Old Key and re-encrypt them with your New Key.

3

Update .env File

Once data re-encryption completes, update ENCRYPTION_KEY in your .env file with the new key.

Key Rotation Re-encryption Script Template (PHP)

<?php
// Load old key and new key
$oldKey = 'base64:OLD_KEY_HERE';
$newKey = 'base64:NEW_KEY_HERE';

// Fetch database records, decrypt with $oldKey, encrypt with $newKey, update database.
// See rotate-keys.php in workspace directory for complete executable script.
          

Terminal CLI One-Liners & Scripts

You can generate keys directly inside your terminal using any of the following pre-built CLI scripts or shell commands:

PHP One-Liner (Base64)
php -r "echo 'base64:' . base64_encode(random_bytes(32)) . PHP_EOL;"
PHP One-Liner (Hex)
php -r "echo 'hex:' . bin2hex(random_bytes(32)) . PHP_EOL;"
Run PHP Script File
php generate-keys.php
Run Node.js Script File
node generate-keys.js
Run OpenSSL Bash Script
./generate-keys.sh

Complete Guide: Updating Security Keys in Your Project & Server

Follow these step-by-step instructions to safely apply generated keys to your website and application server.

1

Locate Your Project's Configuration File (.env)

Navigate to the root directory of your website on your server or local machine (e.g. /public_html, /var/www/html/site, or project folder). Look for the hidden .env file.

If .env does not exist yet, copy .env.example to .env. In Linux/macOS, use ls -a to view hidden dotfiles.
2

Paste Your New Keys Into .env

Open .env in a text editor (VS Code, Nano, Sublime, or cPanel File Manager) and update the corresponding key values:

# Security & Master Encryption Keys
APP_KEY=base64:YOUR_GENERATED_APP_KEY
ENCRYPTION_KEY=base64:YOUR_GENERATED_ENCRYPTION_KEY
MASTER_KEY_512=base64:YOUR_GENERATED_512_BIT_KEY
SEARCH_KEY=base64:YOUR_GENERATED_SEARCH_KEY
BACKUP_KEY=base64:YOUR_GENERATED_BACKUP_KEY

# HMAC & Token Secrets
QR_HMAC_SECRET=hex:YOUR_GENERATED_HEX_SECRET
JWT_SECRET=YOUR_GENERATED_JWT_SECRET
                
3

Apply Changes & Clear Application Cache

After editing your .env file, notify your application web server to load the new keys:

  • PHP / Laravel: Run php artisan config:clear and php artisan config:cache in your terminal.
  • Node.js / Express: Restart your process manager (e.g. pm2 restart all or restart your node server).
  • Python / Django / Flask: Restart your Gunicorn / Uvicorn service (e.g. sudo systemctl restart gunicorn).
  • cPanel / Shared Hosting: Restart your Python/Node app or reload PHP-FPM from cPanel.
4

How to Change Keys in this Web Dashboard

You can manage and regenerate keys in this dashboard anytime using these 3 actions:

⚡ Generate Fully Strong Keys

Click the top-right header button to regenerate a completely new set of 256-bit and 512-bit keys across all cards at once.

🔄 Single Key Regenerate

Click the 🔄 refresh icon on any specific key card to change only that single key without altering others.

📥 Download .env File

Go to the .env File Export tab and click "Download .env File" to get a ready-to-use file instantly.

5

Command Prompt Step-by-Step Instructions & Expected Outputs

Below is the complete terminal walkthrough showing exact shell commands and expected outputs at each step:

STEP A: Navigate to your website folder & check files
cd /Users/faldutarang4778gmail.com/Desktop/"NEW WEBSITE" && ls -la
Terminal Output:
total 128
drwxr-xr-x  16 staff   512 Aug 26 03:30 .
drwxr-xr-x   6 staff   192 Aug 26 03:20 ..
-rw-r--r--   1 staff   480 Aug 26 03:25 .env
-rw-r--r--   1 staff  1080 Aug 26 03:20 package.json
drwxr-xr-x  12 staff   384 Aug 26 03:22 public
                  
STEP B: Generate fresh 256-bit cryptographic keys in terminal
php generate-keys.php
Terminal Output:
==========================================================
    DATABASE & SECURITY KEY GENERATOR (Cryptographically Secure)
==========================================================

ENCRYPTION_KEY     : base64:NbCQhFkWcSqwZsPvv57kJEor9rJLBCQdXEVjCwCSUBM=
SEARCH_KEY         : base64:YHmmPF6K4UKUSkYphu60K4uNGl8yQOlor/ahjnmlBqE=
BACKUP_KEY         : base64:bXb3UE0eYBq4z0eB0Qr34OGarutE9hNgxv/VqYX6IOc=
APP_KEY            : base64:pAxkDCHIhdlCbP3riv9AEGc++XL1U/cZVsvhl+dTRw4=
QR_HMAC_SECRET     : hex:492150678fa672dfcd2a4774a4c7facfe2971a9e2cef704f3180a648d1d57b9c
DB_PASSWORD        : K#8x$mQ9!zP2vL5wN4@bT7yU0*eR3c1f
JWT_SECRET         : 5059dea1cec3916f4760c05b975a1e837cbafc4729846c0c59a99c9ef8999c23
                  
STEP C: Open .env file in terminal editor (Nano)
nano .env
Nano Editor Terminal Output:
GNU nano 7.2                               .env                                      
APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:pAxkDCHIhdlCbP3riv9AEGc++XL1U/cZVsvhl+dTRw4=

ENCRYPTION_KEY=base64:NbCQhFkWcSqwZsPvv57kJEor9rJLBCQdXEVjCwCSUBM=
SEARCH_KEY=base64:YHmmPF6K4UKUSkYphu60K4uNGl8yQOlor/ahjnmlBqE=
BACKUP_KEY=base64:bXb3UE0eYBq4z0eB0Qr34OGarutE9hNgxv/VqYX6IOc=
QR_HMAC_SECRET=hex:492150678fa672dfcd2a4774a4c7facfe2971a9e2cef704f3180a648d1d57b9c
JWT_SECRET=5059dea1cec3916f4760c05b975a1e837cbafc4729846c0c59a99c9ef8999c23

[ Press Ctrl+O then Enter to Save, Ctrl+X to Exit ]
                  
STEP D: Clear cache & restart server
php artisan config:clear && php artisan config:cache
Terminal Output:
INFO  Configuration cache cleared successfully.  
INFO  Configuration cached successfully.
                  

Important Rule: Existing Database Records

Keys like APP_KEY, SEARCH_KEY, BACKUP_KEY, and QR_HMAC_SECRET can be updated instantly in .env.
However, if your website database already contains encrypted records under ENCRYPTION_KEY, visit the Key Rotation Guide tab to run data re-encryption before replacing ENCRYPTION_KEY.

Key copied to clipboard!