name: crypto-analyzer
description: 加密算法、密钥大小和证书管理的加密实现分析与验证
allowed-tools:
- Bash
- Read
- Write
- Glob
- Grep
- WebFetch
加密分析器技能
目的
分析和验证加密实现,确保算法使用正确、密钥大小合规、证书有效,并符合加密最佳实践和标准。
能力
加密实现分析
- 分析对称加密使用情况(AES、ChaCha20)
- 审查非对称加密实现(RSA、ECDSA)
- 检查加密模式选择(GCM、CBC、CTR)
- 验证初始化向量(IV)处理
- 验证填充方案
- 识别不安全的加密模式
算法强度验证
- 检查算法弃用状态
- 根据NIST建议进行验证
- 与FIPS 140-3要求对比
- 评估量子抵抗准备情况
- 标记弱算法或已弃用算法
- 推荐算法升级
密钥大小验证
- 验证RSA密钥长度(最小2048位)
- 检查ECC曲线选择
- 验证对称密钥大小
- 评估密钥派生函数
- 检查PBKDF2/scrypt/bcrypt参数
- 验证密钥拉伸实现
已弃用算法检测
- 识别MD5和SHA-1使用
- 标记DES和3DES使用
- 检测RC4流密码
- 发现弱随机数生成
- 识别出口级加密
- 标记自定义/自研加密
证书分析
- 验证证书有效期
- 检查证书链完整性
- 验证证书密钥用法
- 检测通配符证书风险
- 检查证书透明度日志
- 监控证书过期情况
加密建议
- 建议算法替换
- 推荐密钥大小升级
- 提供实施指导
- 映射合规要求
- 生成迁移计划
- 优先处理修复工作
算法评估
对称加密
| 算法 |
状态 |
建议 |
| AES-256-GCM |
已批准 |
首选 |
| AES-128-GCM |
已批准 |
可接受 |
| ChaCha20-Poly1305 |
已批准 |
移动端首选 |
| AES-CBC |
谨慎 |
与HMAC一起使用 |
| 3DES |
已弃用 |
立即替换 |
| DES |
禁止 |
高风险 |
非对称加密
| 算法 |
最小密钥大小 |
建议 |
| RSA |
2048位 |
3072+ 首选 |
| ECDSA |
P-256 |
P-384 首选 |
| Ed25519 |
不适用 |
推荐 |
哈希函数
| 算法 |
状态 |
使用场景 |
| SHA-256/384/512 |
已批准 |
通用用途 |
| SHA-3 |
已批准 |
高安全性 |
| BLAKE2 |
已批准 |
性能优先 |
| SHA-1 |
已弃用 |
仅限遗留系统 |
| MD5 |
禁止 |
永不使用 |
集成
- OpenSSL:加密库分析
- testssl.sh:TLS配置测试
- SSL Labs API:证书和TLS分析
- 加密库:特定语言加密审查
- HSM接口:硬件安全模块验证
目标流程
- 加密和密钥管理流程
- 安全代码审查
- TLS配置加固
- 证书生命周期管理
输入模式
{
"type": "object",
"properties": {
"analysisType": {
"type": "string",
"enum": ["code-review", "tls-config", "certificate", "implementation", "compliance"],
"description": "加密分析类型"
},
"targetPath": {
"type": "string",
"description": "要分析的代码或配置路径"
},
"endpoints": {
"type": "array",
"items": { "type": "string" },
"description": "要分析的TLS端点"
},
"certificates": {
"type": "array",
"items": { "type": "string" },
"description": "要分析的证书文件或URL"
},
"languages": {
"type": "array",
"items": { "type": "string" },
"description": "要分析的编程语言"
},
"complianceFrameworks": {
"type": "array",
"items": {
"type": "string",
"enum": ["NIST", "FIPS-140-3", "PCI-DSS", "HIPAA", "FedRAMP"]
}
},
"includeQuantumAssessment": {
"type": "boolean",
"description": "包含后量子准备评估"
}
},
"required": ["analysisType"]
}
输出模式
{
"type": "object",
"properties": {
"analysisId": {
"type": "string"
},
"analysisType": {
"type": "string"
},
"timestamp": {
"type": "string",
"format": "date-time"
},
"summary": {
"type": "object",
"properties": {
"totalFindings": { "type": "integer" },
"critical": { "type": "integer" },
"high": { "type": "integer" },
"medium": { "type": "integer" },
"low": { "type": "integer" }
}
},
"algorithmFindings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"algorithm": { "type": "string" },
"usage": { "type": "string" },
"status": { "type": "string", "enum": ["approved", "caution", "deprecated", "prohibited"] },
"location": { "type": "string" },
"recommendation": { "type": "string" }
}
}
},
"keySizeFindings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"algorithm": { "type": "string" },
"currentSize": { "type": "string" },
"minimumRequired": { "type": "string" },
"recommendation": { "type": "string" }
}
}
},
"certificateFindings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"subject": { "type": "string" },
"issuer": { "type": "string" },
"validFrom": { "type": "string" },
"validTo": { "type": "string" },
"keySize": { "type": "string" },
"issues": { "type": "array" }
}
}
},
"tlsFindings": {
"type": "array",
"items": {
"type": "object",
"properties": {
"endpoint": { "type": "string" },
"protocols": { "type": "array" },
"cipherSuites": { "type": "array" },
"grade": { "type": "string" },
"issues": { "type": "array" }
}
}
},
"complianceStatus": {
"type": "object"
},
"quantumReadiness": {
"type": "object",
"properties": {
"atRiskAlgorithms": { "type": "array" },
"migrationPriority": { "type": "string" },
"recommendations": { "type": "array" }
}
},
"remediationPlan": {
"type": "array",
"items": {
"type": "object",
"properties": {
"finding": { "type": "string" },
"action": { "type": "string" },
"priority": { "type": "string" },
"effort": { "type": "string" }
}
}
}
}
}
使用示例
skill: {
name: 'crypto-analyzer',
context: {
analysisType: 'code-review',
targetPath: './src',
languages: ['Java', 'Python'],
complianceFrameworks: ['NIST', 'PCI-DSS'],
includeQuantumAssessment: true
}
}