Skip to content

visiongaiatechnology/wpkeyvault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

 β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—    β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—    β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
 β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β• β•šβ•β•β–ˆβ–ˆβ•”β•β•β•    β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β•β•β•β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•    β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β•šβ•β•β–ˆβ–ˆβ•”β•β•β•
β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•‘       β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—   β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•     β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘
β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘       β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β•    β•šβ–ˆβ–ˆβ•”β•      β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘     β–ˆβ–ˆβ•‘
 β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•   β–ˆβ–ˆβ•‘       β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•‘        β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘
  β•šβ•β•β•β•   β•šβ•β•β•β•β•β•    β•šβ•β•       β•šβ•β•  β•šβ•β•β•šβ•β•β•β•β•β•β•   β•šβ•β•         β•šβ•β•β•β•  β•šβ•β•  β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β•β•šβ•β•

VGT Key Vault

AES-256-GCM Cryptographic API Key Manager for WordPress

License Version PHP WordPress Encryption Status

OMEGA PROTOCOL ACTIVE Β· AAD CONTEXT BINDING Β· ZERO PLAINTEXT STORAGE


Donate via PayPal VisionGaia Technology


⚠️ DISCLAIMER: EXPERIMENTAL R&D PROJECT

This project is a Proof of Concept (PoC) and part of ongoing research and development at VisionGaia Technology. It is not a certified or production-ready product.

Use at your own risk. The software may contain security vulnerabilities, bugs, or unexpected behavior. It may break your environment if misconfigured or used improperly.

Do not deploy in critical production environments unless you have thoroughly audited the code and understand the implications. For enterprise-grade, verified protection, we recommend established and officially certified solutions.

Found a vulnerability or have an improvement? Open an issue or contact us.


πŸ“‹ Changelog β€” V3.1.0

V3.1.0 is a comprehensive hardening upgrade. Every change closes a concrete gap β€” no cosmetic version bumps.

Area V3.0.0 V3.1.0
Exception Handling \RuntimeException VaultException β€” typed, catchable separately
Master Key Derivation AUTH_SALT + SECURE_AUTH_KEY only All 8 WP salts + DB-generated fallback + wp_hash() anchor
Registry Integrity No type checks is_array() + is_string() guards β€” fatal-safe on DB corruption
Admin HTTP Headers None X-Frame-Options, X-Content-Type-Options, Referrer-Policy, X-XSS-Protection
Option Name Sanitizing sanitize_text_field() (too permissive) preg_replace('/[^a-zA-Z0-9_\-]/', '') + enforced prefix namespace
Error Feedback saved, deleted, error_crypto + error_input, error_delete
Internationalization None Full esc_html_e() / __() / esc_js() coverage
API Usage get_key('vis_api_key_groq') β€” full option name required get_key('groq_api_key') β€” prefix added internally
UI Display Shows full prefix (vis_api_key_groq) Strips prefix β€” shows only identifier (groq_api_key)

πŸ” What is VGT Key Vault?

WordPress stores API keys in plaintext. Every plugin, every theme, every integration dumps credentials directly into wp_options β€” readable by anyone with database access.

VGT Key Vault closes this gap.

A cryptographic key management system that seals every API key with AES-256-GCM + AAD Context Binding before it ever touches the database. Even with full database access, an attacker retrieves nothing but cryptographically worthless ciphertext β€” mathematically bound to the key identifier.

Built as the cryptographic backbone of the VisionGaiaTechnology Sentinel ecosystem β€” and now available as a standalone open-source solution for any WordPress installation.


⚑ The Problem With Standard WordPress Key Storage

Standard WordPress Plugins:
  API Key entered         β†’ stored as plaintext in wp_options
  DB dump by attacker     β†’ all credentials compromised
  Plugin stores key_value β†’ readable by any other plugin

VGT Key Vault:
  API Key entered         β†’ AES-256-GCM encrypted with AAD
  DB dump by attacker     β†’ ciphertext only β†’ worthless
  Inter-plugin access     β†’ one authenticated API call

πŸ›οΈ Architecture β€” Three Core Kernels

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    VGT KEY VAULT PROTOCOL                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   CRYPTO KERNEL   β”‚  REGISTRY KERNEL  β”‚    ADMIN KERNEL     β”‚
β”‚                   β”‚                   β”‚                      β”‚
β”‚  AES-256-GCM      β”‚  O(1) Hash Map    β”‚  Glassmorphism UI   β”‚
β”‚  GCM Auth Tag     β”‚  Auto-Migration   β”‚  Key Injection Form β”‚
β”‚  AAD Binding      β”‚  Auto-Heal        β”‚  Vault Dashboard    β”‚
β”‚  HKDF + 8 Salts   β”‚  Type Guards      β”‚  Security Headers   β”‚
β”‚  Random IV        β”‚  Index Registry   β”‚  Delete with Nonce  β”‚
β”‚  wp_hash Anchor   β”‚                   β”‚  i18n Ready         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”‘ The AAD Context Binding β€” What Makes This Different

Standard AES-256-GCM encrypts data. VGT Key Vault goes further with AAD (Additional Authenticated Data) β€” binding every ciphertext to its identifier:

WITHOUT AAD (standard encryption):
  encrypt("sk-groq-xxx") β†’ Ciphertext_A
  Attacker copies Ciphertext_A to option "vis_api_key_other"
  decrypt(Ciphertext_A) β†’ "sk-groq-xxx" βœ“ (Ciphertext Swapping works)

WITH AAD (VGT Key Vault):
  encrypt("sk-groq-xxx", context="vis_api_key_groq") β†’ Ciphertext_A
  Attacker copies Ciphertext_A to option "vis_api_key_other"
  decrypt(Ciphertext_A, context="vis_api_key_other") β†’ FAIL βœ—
  (GCM Authentication Tag mismatch β€” manipulation mathematically impossible)

This eliminates an entire class of credential-swapping attacks that most developers have never even heard of.


πŸ”‘ Crypto Kernel β€” Crypto_Engine

// Master Key Derivation β€” HKDF-SHA256 over ALL 8 WordPress salts
// Fallback: DB-generated salt if constants missing
// Final anchor: wp_hash() β€” plugin never fails on hardened configs
hash_hkdf('sha256', $combined_salts, 0, 'vgt_vault_master_domain', $auth_salt);

// Encryption with AAD Context Binding
Crypto_Engine::encrypt($api_key, $option_name);

// Decryption β€” verified against AAD (tamper detection built-in)
// Throws VaultException on mismatch β€” catchable separately from generic errors
Crypto_Engine::decrypt($ciphertext, $option_name);

Key Architecture (V3.1.0):

  • Master key derived via HKDF-SHA256 from all 8 WordPress salts β€” never stored
  • DB-generated fallback salt β€” plugin functions even when wp-config.php constants are absent or weak
  • wp_hash() anchor β€” last-resort safety net on any hosting configuration
  • Every encryption uses a fresh random IV (random_bytes)
  • GCM Authentication Tag appended β€” detects any modification
  • AAD Context ID binds ciphertext to its exact storage location
  • Typed VaultException β€” catchable independently of generic \Exception handlers

πŸ“¦ Registry Kernel β€” Vault_Registry

O(1) Hash Map instead of O(n) Array scan:

  [ "vis_api_key_groq"   => true ]   ← isset() lookup: O(1)
  [ "vis_api_key_openai" => true ]
  [ "vis_api_key_stripe" => true ]

Type Guards (V3.1.0):
  is_array() check before iteration   β€” fatal-safe on DB corruption
  is_string() check on each entry     β€” no PHP warnings on malformed data

Auto-Migration: Old array format detected β†’ silently upgraded
Auto-Heal:      Option missing from DB β†’ removed from index automatically

πŸ›‘οΈ Admin Kernel β€” Admin_Dashboard

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  VGT Crypto Vault                                    β”‚
β”‚  AES-256-GCM Β· Context-Aware AAD Binding             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Key Injection       β”‚  Active Cryptonodes (O(1))    β”‚
β”‚                      β”‚                               β”‚
β”‚  Identifier          β”‚  groq_api_key        [Term.]  β”‚
β”‚  [groq_api_key]      β”‚  Hash: K7mX9pQr2nZ...         β”‚
β”‚                      β”‚                               β”‚
β”‚  Plaintext Token     β”‚  openai_api_key      [Term.]  β”‚
β”‚  [sk-...]            β”‚  Hash: Lp4vN8kJhFm...         β”‚
β”‚                      β”‚                               β”‚
β”‚  [In Vault versiegeln]β”‚                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

V3.1.0 Admin Hardening:

  • Security Headers injected on every admin page render: X-Frame-Options: DENY, X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer, X-XSS-Protection: 0
  • Strict option name sanitization: preg_replace('/[^a-zA-Z0-9_\-]/', '') β€” special characters and injection attempts rejected at input
  • Enforced prefix namespace: all keys stored under vis_api_key_ internally β€” cross-namespace overwrites structurally impossible
  • UI strips prefix: dashboard displays groq_api_key, not vis_api_key_groq β€” cleaner, less error-prone
  • Extended error codes: error_input (invalid identifier) and error_delete (deletion failed) in addition to error_crypto
  • Full i18n coverage: all output via esc_html_e() / __() / esc_js() β€” translation-ready, XSS-safe
  • Nonce verification on all POST requests
  • manage_options capability check before any operation
  • Confirmation dialog before key termination

πŸ”Œ Inter-Plugin API β€” One Line Access

V3.1.0 simplifies the API. Pass only the identifier β€” the prefix is handled internally.

use VGT\Vault\API;

// V3.0.0 (deprecated pattern β€” full option name required)
$api_key = API::get_key('vis_api_key_groq');

// V3.1.0 (current β€” identifier only, prefix added internally)
$api_key = API::get_key('groq_api_key');

// VaultException β€” typed, catchable separately
try {
    $key = API::get_key('stripe_api_key');
} catch (\VGT\Vault\VaultException $e) {
    // Key missing, tampered, or decryption failed
}

No plaintext ever stored. No raw option access. One secure interface.


πŸš€ Installation

Requirements

PHP:        8.0+
WordPress:  6.0+
OpenSSL:    enabled (standard on all hosting)

Setup in 3 Steps

1. Upload & Activate:

WordPress Admin β†’ Plugins β†’ Upload Plugin β†’ ZIP β†’ Install β†’ Activate

2. Store your first API key:

WordPress Admin β†’ VGT Vault β†’ Key Injection
Identifier:      groq_api_key
Plaintext Token: sk-your-key-here
β†’ [In Vault versiegeln]

3. Use in your plugin:

$key = \VGT\Vault\API::get_key('groq_api_key');

πŸ“Š Security Comparison

Feature Standard wp_options VGT Key Vault
Database encryption ❌ Plaintext βœ… AES-256-GCM
Ciphertext Swapping protection ❌ βœ… AAD Context Binding
Key derivation ❌ Raw storage βœ… HKDF-SHA256 over all 8 WP salts
Fallback on missing salts ❌ Fatal / empty key βœ… DB salt + wp_hash() anchor
Tamper detection ❌ βœ… GCM Auth Tag
O(1) Registry lookup ❌ βœ… Hash Map
CSRF protection ❌ βœ… wp_verify_nonce
Option name injection prevention ❌ βœ… Strict regex + prefix namespace
Admin clickjacking protection ❌ βœ… X-Frame-Options: DENY
MIME sniffing protection ❌ βœ… X-Content-Type-Options: nosniff
Typed exception handling ❌ βœ… VaultException
Registry fatal-safety ❌ βœ… Type guards on DB read
Inter-plugin API ❌ βœ… Typed facade, prefix-transparent
i18n / translation ready ❌ βœ… Full __() / esc_html_e() coverage
DB dump resistance ❌ Full compromise βœ… Ciphertext only

πŸ“ File Structure

vgt-key-vault/
β”œβ”€β”€ vgt-key-vault.php          ← single-file plugin
β”‚
└── Inline Kernels:
    β”œβ”€β”€ Crypto_Engine          ← AES-256-GCM + AAD + HKDF (8 salts + fallback)
    β”œβ”€β”€ Vault_Registry         ← O(1) Hash Map + Type Guards + Auto-Migration
    β”œβ”€β”€ Admin_Dashboard        ← UI + Security Headers + i18n + nonce handlers
    β”œβ”€β”€ VaultException         ← Typed exception class
    └── API                    ← inter-plugin facade (prefix-transparent)

No external dependencies. No composer. No build step. One PHP file. Drop it in and it works.


⚠️ Important Security Notice

⚠️  VGT Key Vault derives its master key from all 8 WordPress salts.

    If you change any salt constant in wp-config.php,
    ALL stored ciphertexts become permanently unreadable.

    Before migration or salt rotation:
    1. Decrypt and export all keys from the Vault Dashboard
    2. Rotate salts in wp-config.php
    3. Re-import keys into the new Vault instance

    Note: If wp-config.php constants are absent or empty,
    V3.1.0 automatically falls back to a DB-stored salt and wp_hash().
    The plugin will not crash on hardened or non-standard configurations.

🀝 Contributing

Pull requests are welcome. For major changes, please open an issue first.

git clone https://github.com/VisionGaiaTechnology/wpkeyvault
cd vgt-key-vault

Found a vulnerability? Report via the VGT Sentinel Operative Registry β€” responsible disclosure is rewarded.


β˜• Support the Project

VGT Key Vault is free and open-source under AGPLv3. If it saved you time, money, or a security incident β€” consider supporting:

Donate via PayPal


πŸ“„ License

AGPLv3 License Β· Β© 2026 VisionGaia Technology Β· Cologne, Germany

Anyone using and modifying this plugin must publish changes under AGPLv3. Commercial use permitted. Attribution required.


Built as part of the VisionGaiaTechnology Security Ecosystem

VisionGaia Technology Sentinel

No plaintext. No compromise. No exceptions.

VISIONGAIATECHNOLOGY – WE ARCHITECT THE FUTURE OF SECURITY.

About

A cryptographic key management system that seals every API key with AES-256-GCM + AAD Context Binding

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages