guanghulab/persona-brain-db/schema/10-system-public-key.sql

26 lines
1.2 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ============================================================
-- 表10system_public_keyLayer 1 · 公钥注册表)
-- 用途:国家系统逻辑常驻接口 + 光湖系统密钥
-- 双面灯塔架构中的密钥验证基础设施
-- ============================================================
CREATE TABLE IF NOT EXISTS system_public_key (
key_id VARCHAR(64) PRIMARY KEY,
key_type VARCHAR(32) NOT NULL
CHECK (key_type IN ('national', 'guanghu', 'emergency', 'persona')),
key_name VARCHAR(128) NOT NULL,
public_key TEXT NOT NULL,
algorithm VARCHAR(32) NOT NULL DEFAULT 'RSA-4096',
fingerprint VARCHAR(128),
purpose TEXT NOT NULL,
status VARCHAR(16) NOT NULL DEFAULT 'active'
CHECK (status IN ('active', 'revoked', 'expired')),
valid_from TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
valid_until TIMESTAMP,
issued_by VARCHAR(64) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_spk_type ON system_public_key(key_type);
CREATE INDEX IF NOT EXISTS idx_spk_status ON system_public_key(status);