Trinity Trust Root 三位一体信任根
版本: v3.2.0 | 状态: ✅ 生产就绪 | 5 IPC Handlers | 2 数据库表 | U-Key + SIMKey + TEE
ChainlessChain Trinity Trust Root 实现了 U-Key + SIMKey + TEE 三位一体的统一信任根体系。通过证明链验证、安全启动校验、硬件指纹绑定和跨设备密钥同步,构建从硬件到应用的完整信任链路。
概述
三位一体信任根是 ChainlessChain 的硬件级安全基础,通过 U-Key、SIMKey 和 TEE 三步证明链构建从硬件到应用的完整信任链路。系统支持设备信任等级实时监控(verified/unverified/compromised)、硬件指纹绑定防止密钥迁移攻击,以及在双方均已验证的设备之间进行加密密钥同步。
核心特性
- 🔐 证明链验证: U-Key → SIMKey → TEE 三步证明链,逐层验证硬件可信
- 🖥️ 安全启动校验: 验证设备安全启动状态,防止固件篡改
- 🔑 硬件指纹绑定: 将密钥与硬件指纹绑定,防止密钥迁移攻击
- 🔄 跨设备密钥同步: 加密传输密钥到可信设备,支持多设备协同
- 📊 信任状态监控: 实时追踪所有设备的信任等级(已验证/未验证/已妥协)
信任等级
| 等级 | 说明 | 颜色 |
|---|---|---|
verified | 三重验证通过 | 绿色 |
unverified | 待验证或部分验证 | 黄色 |
compromised | 检测到安全威胁 | 红色 |
pending | 验证进行中 | 灰色 |
验证信任链
javascript
// 执行三步证明链验证
const result = await window.electron.ipcRenderer.invoke(
"trust-root:verify-chain",
"device-001",
);
// result.attestation = {
// id: "uuid",
// device_id: "device-001",
// trust_level: "verified",
// ukey_status: "connected",
// simkey_status: "active",
// tee_status: "supported",
// attestation_chain: [
// { step: "ukey_check", passed: true },
// { step: "simkey_verify", passed: true },
// { step: "tee_attest", passed: true },
// ],
// boot_verified: 1,
// }跨设备密钥同步
javascript
const result = await window.electron.ipcRenderer.invoke(
"trust-root:sync-keys",
{
sourceDevice: "device-001",
targetDevice: "device-002",
keyType: "master", // master | signing | encryption
},
);
// result.syncRecord = { id, sync_status: "completed", verified: 1, ... }绑定硬件指纹
javascript
const result = await window.electron.ipcRenderer.invoke(
"trust-root:bind-fingerprint",
{
deviceId: "device-001",
fingerprint: "hw_fp_abc123def456",
},
);系统架构
┌──────────────────────────────────────────────────┐
│ Trinity Trust Root │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────────────┐│
│ │ U-Key │ │ SIMKey │ │ TEE ││
│ │ Check │→ │ Verify │→ │ Attest ││
│ │ │ │ │ │ ││
│ │ 硬件连接 │ │ SIM 验证 │ │ 可信环境认证 ││
│ └──────────┘ └──────────┘ └──────────────────┘│
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌────────────────────────────────────────────┐ │
│ │ Attestation Chain (证明链) │ │
│ │ trust_level: verified | unverified │ │
│ └─────────────────┬──────────────────────────┘ │
│ │ │
│ ┌─────────────────┴──────────────────────────┐ │
│ │ Cross-Device Key Sync (跨设备密钥同步) │ │
│ │ 加密传输 → 验证 → 绑定硬件指纹 │ │
│ └────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────┘配置参考
在 ~/.chainlesschain/config.json 中配置三位一体信任根参数:
json
{
"trustRoot": {
"enabled": true,
"attestationChain": {
"ukey": { "required": true, "simulationMode": false },
"simkey": { "required": true, "defaultPin": "123456" },
"tee": { "required": true, "type": "sgx" }
},
"trustLevelPolicy": {
"requiredForKeySync": "verified",
"autoDegrade": true,
"degradeOnTampering": true
},
"keySync": {
"encryptionAlgorithm": "AES-256-GCM",
"allowedKeyTypes": ["master", "signing", "encryption"],
"requireMutualVerification": true
},
"bootVerification": {
"enabled": true,
"checkInterval": 3600
}
}
}| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
attestationChain.ukey.simulationMode | boolean | false | macOS/Linux 下使用 U-Key 模拟模式 |
attestationChain.tee.type | string | "sgx" | TEE 类型:sgx / trustzone / auto |
trustLevelPolicy.requiredForKeySync | string | "verified" | 密钥同步所需最低信任等级 |
trustLevelPolicy.autoDegrade | boolean | true | 检测到威胁时是否自动降级信任等级 |
keySync.requireMutualVerification | boolean | true | 密钥同步是否要求双向 verified |
bootVerification.checkInterval | number | 3600 | 安全启动状态检查间隔(秒) |
性能指标
| 操作 | 目标 | 实际 | 状态 |
|---|---|---|---|
| 证明链三步验证(U-Key→SIMKey→TEE) | <500ms | ~380ms | ✅ |
| 硬件指纹绑定 | <100ms | ~70ms | ✅ |
| 跨设备密钥同步(加密传输) | <300ms | ~220ms | ✅ |
| 信任根状态查询 | <30ms | ~18ms | ✅ |
| 安全启动状态查询 | <50ms | ~30ms | ✅ |
| 数据库证明链记录写入 | <20ms | ~12ms | ✅ |
IPC 接口完整列表
Trust Root 操作(5 个)
| 通道 | 功能 | 说明 |
|---|---|---|
trust-root:get-status | 查询信任根状态 | 设备数、验证数、最后验证时间 |
trust-root:verify-chain | 执行证明链验证 | U-Key → SIMKey → TEE 三步 |
trust-root:sync-keys | 跨设备密钥同步 | 加密传输到可信目标设备 |
trust-root:bind-fingerprint | 绑定硬件指纹 | 将密钥与设备指纹绑定 |
trust-root:get-boot-status | 查询安全启动 | 已验证/未验证设备统计 |
数据库 Schema
2 张核心表:
| 表名 | 用途 | 关键字段 |
|---|---|---|
trust_root_attestations | 证明链记录 | id, device_id, trust_level, attestation_chain (JSON) |
cross_device_key_sync | 密钥同步记录 | id, source_device, target_device, sync_status, verified |
trust_root_attestations 表
sql
CREATE TABLE IF NOT EXISTS trust_root_attestations (
id TEXT PRIMARY KEY,
device_id TEXT NOT NULL,
trust_level TEXT DEFAULT 'unverified',
ukey_status TEXT,
simkey_status TEXT,
tee_status TEXT,
attestation_chain TEXT, -- JSON: 三步验证结果
hardware_fingerprint TEXT,
boot_verified INTEGER DEFAULT 0,
last_verified INTEGER,
created_at INTEGER DEFAULT (strftime('%s','now') * 1000)
);
CREATE INDEX IF NOT EXISTS idx_trust_attestations_device ON trust_root_attestations(device_id);
CREATE INDEX IF NOT EXISTS idx_trust_attestations_level ON trust_root_attestations(trust_level);cross_device_key_sync 表
sql
CREATE TABLE IF NOT EXISTS cross_device_key_sync (
id TEXT PRIMARY KEY,
source_device TEXT NOT NULL,
target_device TEXT NOT NULL,
key_type TEXT,
sync_status TEXT DEFAULT 'pending',
encrypted_key_data TEXT,
verified INTEGER DEFAULT 0,
created_at INTEGER DEFAULT (strftime('%s','now') * 1000)
);
CREATE INDEX IF NOT EXISTS idx_key_sync_status ON cross_device_key_sync(sync_status);前端集成
TrustRootPage 页面
功能模块:
- 统计卡片: 设备数 / 已验证 / 安全启动 / 未验证
- 验证操作: 输入设备 ID,执行信任链验证
- 错误提示: Alert 组件展示错误信息
Pinia Store (trustRoot.ts)
typescript
const useTrustRootStore = defineStore("trustRoot", {
state: () => ({
status: null,
bootStatus: null,
loading: false,
error: null,
}),
actions: {
fetchStatus, // → trust-root:get-status
verifyChain, // → trust-root:verify-chain
syncKeys, // → trust-root:sync-keys
bindFingerprint, // → trust-root:bind-fingerprint
fetchBootStatus, // → trust-root:get-boot-status
},
});关键文件
| 文件 | 职责 | 行数 |
|---|---|---|
src/main/ukey/trust-root-manager.js | 信任根核心引擎 | ~260 |
src/main/ukey/trust-root-ipc.js | IPC 处理器(5 个) | ~133 |
src/renderer/stores/trustRoot.ts | Pinia 状态管理 | ~80 |
src/renderer/pages/security/TrustRootPage.vue | 信任根页面 | ~83 |
测试覆盖率
✅ trust-root-manager.test.js - 证明链/指纹/密钥同步测试
✅ stores/trustRoot.test.ts - Store 状态管理测试
✅ e2e/security/trust-root.e2e.test.ts - 端到端用户流程测试使用示例
TPM 认证流程
bash
# 1. 执行三步证明链验证(U-Key → SIMKey → TEE)
# IPC: trust-root:verify-chain "device-001"
# → attestation_chain: [ukey_check: passed, simkey_verify: passed, tee_attest: passed]
# → trust_level: "verified"
# 2. 绑定设备硬件指纹,防止密钥迁移攻击
# IPC: trust-root:bind-fingerprint { deviceId: "device-001", fingerprint: "hw_fp_abc123" }TEE 验证与安全启动
bash
# 1. 查询所有设备的安全启动状态
# IPC: trust-root:get-boot-status
# → verified: 3, unverified: 1
# 2. 跨设备同步密钥(仅在双方均为 verified 时允许)
# IPC: trust-root:sync-keys { sourceDevice: "device-001", targetDevice: "device-002", keyType: "master" }
# → sync_status: "completed", verified: 1信任状态监控
bash
# 查看信任根整体状态
# IPC: trust-root:get-status
# → totalDevices: 4, verified: 3, unverified: 1, lastVerifiedAt: 1710000000故障深度排查
硬件不可用
- U-Key 未检测到: 确认 U-Key 硬件已插入 USB 端口;Windows 检查设备管理器中是否出现 SIMKey 设备;macOS/Linux 仅支持模拟模式
- SIMKey 状态 inactive: 检查 SIM 卡是否正确插入 U-Key 设备,默认 PIN 为
123456;多次输错 PIN 会锁定,需联系发卡方解锁 - TEE 不支持: 运行
trust-root:get-boot-status确认设备是否支持 Intel SGX 或 ARM TrustZone;BIOS 中需启用 SGX 选项 - 驱动问题: Windows 需安装 SIMKeySDK 驱动(
SIMKeySDK-20220416/),SGX 需安装 Intel SGX PSW 运行时
认证链断裂
| 现象 | 排查步骤 |
|---|---|
ukey_check: failed | U-Key 未连接或 SDK 未初始化;检查 Koffi FFI 加载是否成功 |
simkey_verify: failed | SIM 卡认证失败,确认 PIN 正确且未锁定;检查 SIM 卡有效期 |
tee_attest: failed | TEE 远程证明失败,检查 SGX 驱动版本(需 2.x+)和 BIOS 中 SGX 设置;确认 EPID 或 DCAP attestation 服务可达 |
trust_level: compromised | 检测到安全威胁,立即隔离该设备;检查固件是否被篡改,重新执行安全启动验证 |
故障排查
常见问题
| 症状 | 可能原因 | 解决方案 |
|---|---|---|
| TPM 不可用或初始化失败 | 硬件未启用或驱动未安装 | 在 BIOS 中启用 TPM,安装对应驱动程序 |
| TEE 验证失败 | 远程证明服务不可达或证书过期 | 检查证明服务连通性,更新 TEE 证书 |
| 安全启动链断裂 | 固件签名不匹配或中间证书缺失 | 重新签名固件,补全证书链 |
| 信任度评分骤降 | 检测到异常行为或硬件篡改告警 | 执行安全审计 trust audit,排除误报后重置评分 |
| 密钥封装/解封失败 | PCR 值变更或 TPM 状态异常 | 确认 PCR 策略匹配当前状态,重新封装密钥 |
常见错误修复
错误: TPM_UNAVAILABLE TPM 设备不可用
bash
# 检查 TPM 硬件状态
chainlesschain trust tpm-status
# 尝试重新初始化 TPM 连接
chainlesschain trust tpm-init --retry错误: TEE_ATTESTATION_FAILED TEE 远程证明失败
bash
# 检查证明服务连接
chainlesschain trust tee-check
# 更新 TEE 证书并重试验证
chainlesschain trust tee-renew --cert-update错误: SECURE_BOOT_CHAIN_BROKEN 安全启动链断裂
bash
# 验证启动链完整性
chainlesschain trust boot-verify --verbose
# 查看断裂位置详情
chainlesschain trust boot-chain --diagnose安全考虑
信任根保护
- 三位一体验证: U-Key + SIMKey + TEE 三步验证确保从硬件到软件的完整信任链,任一环节失败即标记为
unverified - 硬件指纹绑定: 密钥与设备硬件指纹绑定后,即使密钥文件被拷贝到其他设备也无法使用,防止密钥迁移攻击
- 跨设备同步限制: 密钥同步仅允许在双方均为
verified状态的设备之间进行,加密传输密钥数据
固件验证
- 安全启动校验: 系统启动时验证固件链完整性,检测 Bootloader 和 OS 是否被篡改
- TEE 远程证明: 定期执行 TEE 远程证明(Intel EPID/DCAP),验证可信执行环境未被破坏
- 信任等级降级: 若检测到固件异常或 TEE 被攻破,设备信任等级自动降为
compromised,阻止该设备参与敏感操作
