Skip to content
Back to skills

Collection

ASecurity

暗号化と鍵ライフサイクル管理スキル。暗号化アルゴリズム選定、 鍵生成、保管、ローテーション、廃棄の全フェーズを網羅します。 保存時・転送時・使用時の暗号化戦略を提供します。 使用タイミング: - 暗号化方式を選択する時 - 鍵生成・保管方法を設計する時 - Secret Rotationプロセスを実装する時 - 鍵の廃棄・無効化手順を定義する時 - データ保護要件を評価する時 Use when selecting encryption algorithms, designing key management, implementing rotation processes, or establishing data protection. 📚 リソース参照: このスキルには以下のリソースが含まれています。 必要に応じて該当するリソースを参照してください: - `.claude/skills/encryption-key-lifecycle/resources/rotation-procedures.md`: 暗号化鍵のローテーション手順とゼロダウンタイム移行戦略 - `.c...

  • 24 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
securitytypescriptrustgonodegitapisecurity

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-41de3ab3/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-41de3ab3)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: .claude/skills/encryption-key-lifecycle/SKILL.md
description: |
    暗号化と鍵ライフサイクル管理スキル。暗号化アルゴリズム選定、
    鍵生成、保管、ローテーション、廃棄の全フェーズを網羅します。
    保存時・転送時・使用時の暗号化戦略を提供します。
    使用タイミング:
    - 暗号化方式を選択する時
    - 鍵生成・保管方法を設計する時
    - Secret Rotationプロセスを実装する時
    - 鍵の廃棄・無効化手順を定義する時
    - データ保護要件を評価する時
    Use when selecting encryption algorithms, designing key management,
    implementing rotation processes, or establishing data protection.

  📚 リソース参照:
  このスキルには以下のリソースが含まれています。
  必要に応じて該当するリソースを参照してください:

  - `.claude/skills/encryption-key-lifecycle/resources/rotation-procedures.md`: 暗号化鍵のローテーション手順とゼロダウンタイム移行戦略
  - `.claude/skills/encryption-key-lifecycle/scripts/generate-keys.mjs`: 暗号化鍵生成スクリプト

  Use proactively when implementing .claude/skills/encryption-key-lifecycle/SKILL.md patterns or solving related problems.
version: 1.0.0
---

# Encryption & Key Lifecycle Management

## 概要

機密情報の保護には、適切な暗号化技術と鍵の全ライフサイクル管理が不可欠です。
このスキルは、保存時、転送時、使用時の各段階での暗号化方式選択と、
鍵の生成から廃棄までの完全なライフサイクル管理を提供します。

## 暗号化レベルの選択

### レベル 1: 保存時暗号化(Encryption at Rest)

**対象**: ディスク、データベース、バックアップ

**推奨アルゴリズム**:

- **AES-256-GCM**: 標準的な対称鍵暗号化(高速、安全)
- **ChaCha20-Poly1305**: モバイル・組み込みデバイス向け

**基本実装**:

```typescript
import crypto from "crypto";

class EncryptionService {
  private algorithm = "aes-256-gcm";
  private key: Buffer;

  encrypt(plaintext: string): { encrypted: string; iv: string; tag: string } {
    const iv = crypto.randomBytes(16);
    const cipher = crypto.createCipheriv(this.algorithm, this.key, iv);
    let encrypted = cipher.update(plaintext, "utf8", "hex");
    encrypted += cipher.final("hex");
    return {
      encrypted,
      iv: iv.toString("hex"),
      tag: cipher.getAuthTag().toString("hex"),
    };
  }
}
```

**詳細**: `resources/symmetric-encryption-guide.md`

### レベル 2: 転送時暗号化(Encryption in Transit)

**必須要件**:

- **TLS 1.3**: すべての HTTP 通信(HTTPS)
- **SSH**: Git 操作、サーバーアクセス

**実装**:

```typescript
const apiClient = axios.create({
  baseURL: "https://api.example.com",
  httpsAgent: new https.Agent({
    rejectUnauthorized: true,
    minVersion: "TLSv1.3",
  }),
});
```

### レベル 3: 使用時暗号化(Encryption in Use)

**手法**: Secret 使用後の即座メモリクリア

**実装**:

```typescript
class SecureString {
  private buffer: Buffer;

  use<T>(callback: (secret: string) => T): T {
    try {
      return callback(this.buffer.toString("utf8"));
    } finally {
      this.buffer.fill(0); // ゼロクリア
    }
  }
}
```

## 鍵ライフサイクル管理

### Phase 1: 鍵生成(Generation)

**要件**:

- 暗号学的に安全な乱数生成器(CSRNG)使用
- 十分な鍵長(AES-256、RSA-4096)

**実装**:

```typescript
// 対称鍵生成
function generateSymmetricKey(): Buffer {
  return crypto.randomBytes(32); // 256 bits
}

// 非対称鍵ペア生成
function generateAsymmetricKeyPair() {
  return crypto.generateKeyPairSync("rsa", {
    modulusLength: 4096,
  });
}
```

**詳細**: `resources/key-generation-guide.md`

### Phase 2: 鍵保管(Storage)

**保管方式選択**:

| 鍵タイプ               | 重要度   | 推奨保管方式    |
| ---------------------- | -------- | --------------- |
| マスター暗号化キー     | Critical | HSM, KMS        |
| データベースパスワード | Critical | Secrets Manager |
| API キー               | High     | Secrets Manager |
| セッション Secret      | High     | 環境変数        |

**詳細**: `resources/key-storage-strategies.md`

### Phase 3: 鍵使用(Usage)

**原則**:

- 最小権限でのみアクセス
- すべてのアクセスをログ記録
- 使用後のメモリクリア

### Phase 4: 鍵ローテーション(Rotation)

**ゼロダウンタイム Rotation(5 段階)**:

1. 新鍵生成
2. 両方の鍵を有効化(新旧並存)
3. アプリケーションを新鍵に移行
4. 旧鍵を無効化(読み取り専用)
5. 監視期間後、旧鍵を完全削除

**詳細**: `resources/rotation-procedures.md`

### Phase 5: 鍵廃棄(Disposal)

**要件**:

- セキュアな上書き・ゼロ化
- ストレージとバックアップから完全削除
- 廃棄の監査証跡

**実装**:

```typescript
async function disposeKey(key: Buffer): Promise<void> {
  // 複数回上書き
  for (let i = 0; i < 3; i++) {
    key.fill(0);
    key.fill(255);
  }
  key.fill(0); // 最終ゼロクリア
}
```

## 暗号化アルゴリズム選択

### 対称鍵暗号

| アルゴリズム      | 鍵長    | 用途          | 推奨度     |
| ----------------- | ------- | ------------- | ---------- |
| AES-256-GCM       | 256-bit | データ暗号化  | ⭐⭐⭐⭐⭐ |
| ChaCha20-Poly1305 | 256-bit | モバイル・IoT | ⭐⭐⭐⭐   |

**推奨**: AES-256-GCM

### 非対称鍵暗号

| アルゴリズム | 鍵長     | 用途         | 推奨度     |
| ------------ | -------- | ------------ | ---------- |
| RSA-4096     | 4096-bit | 鍵交換、署名 | ⭐⭐⭐⭐   |
| Ed25519      | 256-bit  | SSH、署名    | ⭐⭐⭐⭐⭐ |

**推奨**: Ed25519

### ハッシュ関数

| アルゴリズム | 用途               | 推奨度     |
| ------------ | ------------------ | ---------- |
| SHA-256      | 汎用ハッシュ       | ⭐⭐⭐⭐⭐ |
| Argon2       | パスワードハッシュ | ⭐⭐⭐⭐⭐ |

## Rotation スケジューリング

### 頻度の決定

| Secret 重要度 | Rotation 頻度 | 自動化     |
| ------------- | ------------- | ---------- |
| Critical      | 30 日毎       | 推奨       |
| High          | 90 日毎       | 推奨       |
| Medium        | 180 日毎      | オプション |
| Low           | 不定期        | 不要       |

### 自動化実装

```typescript
import cron from "node-cron";

class AutoRotation {
  setup(): void {
    // Critical: 毎月1日
    cron.schedule("0 0 1 * *", () => this.rotateCritical());

    // High: 四半期初日
    cron.schedule("0 0 1 */3 *", () => this.rotateHigh());
  }
}
```

**詳細**: `resources/rotation-automation.md`

## 実装チェックリスト

### 暗号化設計

- [ ] 保存時・転送時・使用時の各段階で暗号化されているか?
- [ ] 適切なアルゴリズムが選択されているか?
- [ ] 鍵長が十分か?(AES-256、RSA-4096)

### 鍵管理

- [ ] 鍵生成に CSRNG が使用されているか?
- [ ] 鍵と暗号化データが分離保管されているか?
- [ ] 鍵のバージョニングが実装されているか?

### Rotation プロセス

- [ ] Rotation 手順がダウンタイムを発生させないか?
- [ ] ロールバック手順が明確か?
- [ ] Rotation 頻度が適切か?

## 関連スキル

- `.claude/skills/secret-management-architecture/SKILL.md` - Secret 管理
- `.claude/skills/zero-trust-security/SKILL.md` - アクセス制御

## リソースファイル

- `resources/rotation-procedures.md` - Rotation 手順詳細

## スクリプト

- `scripts/generate-keys.mjs` - 鍵生成スクリプト

Files in this skill

  • 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.