azure-keyvault-keys-ts
管理 Azure Key Vault 密钥
需要在 Azure 中创建、加密、签名或轮换加密密钥?此技能提供了可立即使用的 Azure Key Vault 密钥 SDK 代码片段,用于安全地处理密钥管理。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“azure-keyvault-keys-ts”。 创建名为 'signing-key' 的 EC 密钥,使用 P-256 曲线
预期结果:
```typescript
const ecKey = await keyClient.createEcKey('signing-key', {
curve: 'P-256',
enabled: true,
keyOps: ['sign', 'verify']
});
console.log('Created key:', ecKey.name);
```
正在使用“azure-keyvault-keys-ts”。 使用 RSA-OAEP 加密字符串 'secret-data'
预期结果:
```typescript
const cryptoClient = new CryptographyClient(key, credential);
const encrypted = await cryptoClient.encrypt({
algorithm: 'RSA-OAEP',
plaintext: Buffer.from('secret-data')
});
console.log('Encrypted:', encrypted.result.toString('base64'));
```
安全审计
安全Static analysis flagged 47 potential issues, but all are false positives. The file is legitimate Azure SDK documentation containing example code blocks (not actual executables), placeholder URLs (not real endpoints), and standard environment variable patterns (Azure best practice). No malicious behavior detected.
严重问题 (1)
中风险问题 (3)
质量评分
你能构建什么
云应用开发者
使用 Azure Key Vault 进行安全的密钥存储和管理,实现云应用中静态数据的加密。
DevOps 工程师
管理密钥轮换策略并在 Azure 环境中自动执行加密密钥生命周期操作。
安全工程师
实施正确的密钥管理工作流,包括备份、恢复和访问控制以满足合规性要求。
试试这些提示
在 Azure Key Vault 中创建一个名为 'my-encryption-key' 的新 RSA 密钥,大小为 2048 位。启用该密钥并设置过期日期。
请展示如何使用 Azure Key Vault 加密客户端和 RSA-OAEP 算法对用户密码进行加密。
为 'my-rotation-key' 配置自动轮换,使其每 90 天轮换一次。展示轮换策略的设置。
如何将密钥从一个 Azure Key Vault 备份并恢复到另一个保管库?包括备份和恢复操作。
最佳实践
- 在开发和生产环境中使用 DefaultAzureCredential 进行自动身份验证
- 在保管库上启用软删除以防止意外删除密钥
- 在密钥上设置过期日期并实施轮换策略以满足安全合规性要求
避免
- 在源代码中硬编码连接字符串或密钥 - 请使用 Azure Key Vault 或环境变量
- 使用没有过期日期的密钥 - 始终设置有效期限
- 禁用密钥操作日志记录 - 审计跟踪对安全合规性至关重要