Secure key manager

From wulaosiji/skills · View interactive version

Secure key manager is an AI agent skill from the GitHub repository wulaosiji/skills. 企业级AI Agent密钥管理工具,使用AES-256-GCM加密和PBKDF2HMAC密钥派生(48万轮),支持运行时解密、自动输出脱敏和严格文件权限(0600),替代TOOLS.md中的明文密钥存储。 Use when: "密钥管理", "API key加密", "密钥加密存储", "secure key storage", "API key encryption", "密钥保护", "secret management", "key rotation". 按需解密、内存中不持久化明文、输出自动脱敏,支持密钥轮换和审计。Cross-references: security-hardenin

How to use this skill

Skill file

Secure Key Manager

AES-256-GCM encrypted key storage for AI agents.

When to Use

Use this skill when:

Do NOT use this skill if:

Typical triggers:

Workflow

遵循六步推进法(探查→约束→证据→执行→验证→交付)完成操作。

  1. 探查 (Probe)

完整读取当前密钥存储状态,确认需要管理的密钥列表和现有存储方式(TOOLS.md明文、环境变量等)。

  1. 约束 (Constrain)

设定加密标准和不可降级的安全边界——AES-256-GCM、PBKDF2HMAC 48万轮、文件权限0600。受阻时换通道,不降级交付物。

  1. 证据 (Evidence)

记录密钥迁移前后的状态,每个密钥条目有名称、描述和创建时间。不记录明文密钥值。

  1. 执行 (Execute)

初始化保险库并存储密钥,先给影响与结论,再给行动和必要证据。

初始化:

cd skills/secure-key-manager
python3 key_manager.py init
# Enter a strong password when prompted

存储密钥:

python3 key_manager.py set \
  -p "your-password" \
  -n "brave-search-api-key" \
  -v "BSAxxxxx..." \
  -d "Brave Search API Key"

运行时获取:

from key_manager import SecureKeyManager

manager = SecureKeyManager()
manager.unlock("your-password")
api_key = manager.get_key("brave-search-api-key")
# Use api_key for API call, then clear from memory

输出脱敏:

from key_manager import sanitize_output
safe_output = sanitize_output(raw_output)  # Auto-redacts patterns

列出和轮换:

python3 key_manager.py list -p "your-password"
# To rotate: delete old key, set new key with same name
  1. 验证 (Verify)

用不同于生成路径的方式回读——检查加密文件权限为0600,验证解密后密钥与原始值一致,确认输出脱敏能正确识别并遮蔽密钥模式。

  1. 交付 (Deliver)

返回保险库初始化结果和密钥存储状态,设置定期轮换提醒。如怀疑泄露,立即执行事件响应流程。

Output

Guardrails

以下约束确保安全、可靠地使用本技能。

Anti-patterns

Security Layers

Incident Response

If leakage suspected:

  1. Immediately revoke exposed keys at the provider
  2. Rotate keys in the vault: set new value for same key name
  3. Review audit logs for unauthorized access patterns

Related Skills

About UniqueClub

This skill is part of the UniqueClub security toolkit.

🌐 https://uniqueclub.ai

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.