Crypto Review
Purpose
Review cryptographic implementations for algorithm choice correctness, key management soundness, side-channel resistance, and crypto agility readiness.
Scope Constraints
Reads source code, configuration files, and documentation for cryptographic implementation analysis. Does not modify files or execute code. Does not access key material, HSMs, or cryptographic secrets directly.
Inputs
- System or component using cryptographic operations
- Cryptographic algorithms and modes in use
- Key management architecture (generation, storage, rotation, destruction)
- Data sensitivity classification and compliance requirements
- Performance constraints and target platforms
Input Sanitization
No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.
Procedure
Step 1: Inventory Crypto Operations
Enumerate all cryptographic operations in the system:
- Symmetric encryption (algorithm, mode, key size)
- Asymmetric operations (signing, key exchange, encryption)
- Hashing (algorithm, usage context — integrity, commitment, password)
- Key derivation (KDF, parameters, input entropy)
- Random number generation (source, seeding, reseeding)
Step 2: Check Algorithm Choices
For each crypto operation, verify:
- Algorithm is current and not deprecated (no MD5, SHA-1 for security, DES, RC4)
- Mode is appropriate (AEAD preferred: AES-GCM, ChaCha20-Poly1305; no ECB, no unauthenticated CBC)
- Key size provides adequate security margin (AES-256 for long-term, AES-128 minimum)
- Parameters are correct (IV/nonce size, tag length, iteration counts for KDFs)
- Construction is standard (no custom padding, no hand-rolled MAC-then-encrypt)
Step 3: Review Key Management
Assess the full key lifecycle:
- Generation: Keys generated from cryptographically secure RNG? Sufficient entropy?
- Storage: Keys stored in HSM/TPM/keystore? Never in plaintext config files or source code?
- Distribution: Key exchange uses authenticated channels? No key material in logs or error messages?
- Rotation: Rotation policy defined? Rotation does not cause service disruption?
- Destruction: Keys securely erased after use? Memory not swapped to disk with key material?
Step 4: Assess Side-Channel Resistance
For security-critical crypto operations, check:
- Constant-time comparison for MACs and signatures (no early-exit on mismatch)
- Constant-time table lookups (no cache-timing-dependent S-box access)
- No branching on secret data
- Memory access patterns independent of key material
- Adequate blinding for RSA/ECC operations
Step 5: Check Crypto Agility
Assess the system's ability to migrate algorithms:
- Are algorithm identifiers negotiated or hardcoded?
- Can algorithms be swapped without architectural changes?
- Is there a version/algorithm field in encrypted data formats?
- Can the system support hybrid mode (classical + PQC)?
Compaction resilience: If context was lost during a long session, re-read the Inputs section to reconstruct what system is being analyzed, then resume from the earliest incomplete step.
Output Format
Crypto Operations Inventory
| Operation |
Algorithm |
Mode |
Key Size |
Context |
Status |
| Data encryption |
AES |
GCM |
256-bit |
Storage at rest |
OK |
| ... |
... |
... |
... |
... |
... |
Finding Table
| ID |
Category |
Description |
Severity |
Recommendation |
| C1 |
Algorithm |
SHA-1 used for integrity check |
High |
Migrate to SHA-256 |
| ... |
... |
... |
... |
... |
Key Management Assessment
- Generation: [Assessment]
- Storage: [Assessment]
- Rotation: [Assessment]
- Destruction: [Assessment]
Crypto Agility Score
Handoff
- Hand off to protocol-analysis if protocol-level vulnerabilities are identified during crypto review.
- Hand off to pqc-readiness if quantum migration planning is needed based on algorithm inventory.
Quality Checks
Evolution Notes
1---2name: crypto-review3department: "cipher"4description: "Use when reviewing cryptographic implementations for algorithm choice correctness, key management soundness, side-channel resistance, and crypto agility readiness. Covers symmetric and asymmetric operations, key lifecycle, and construction safety. Do not use for protocol-level analysis (use protocol-analysis) or post-quantum migration planning (use pqc-readiness)."5version: 16triggers:7 - "crypto"8 - "encryption"9 - "decryption"10 - "AES"11 - "RSA"12 - "ECC"13 - "key management"14 - "AEAD"15 - "hash"16 - "HMAC"17 - "KDF"18 - "nonce"19 - "IV"20 - "digital signature"21---2223# Crypto Review2425## Purpose26Review cryptographic implementations for algorithm choice correctness, key management soundness, side-channel resistance, and crypto agility readiness.2728## Scope Constraints2930Reads source code, configuration files, and documentation for cryptographic implementation analysis. Does not modify files or execute code. Does not access key material, HSMs, or cryptographic secrets directly.3132## Inputs33- System or component using cryptographic operations34- Cryptographic algorithms and modes in use35- Key management architecture (generation, storage, rotation, destruction)36- Data sensitivity classification and compliance requirements37- Performance constraints and target platforms3839## Input Sanitization4041No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.4243## Procedure4445### Step 1: Inventory Crypto Operations46Enumerate all cryptographic operations in the system:47- Symmetric encryption (algorithm, mode, key size)48- Asymmetric operations (signing, key exchange, encryption)49- Hashing (algorithm, usage context — integrity, commitment, password)50- Key derivation (KDF, parameters, input entropy)51- Random number generation (source, seeding, reseeding)5253### Step 2: Check Algorithm Choices54For each crypto operation, verify:55- Algorithm is current and not deprecated (no MD5, SHA-1 for security, DES, RC4)56- Mode is appropriate (AEAD preferred: AES-GCM, ChaCha20-Poly1305; no ECB, no unauthenticated CBC)57- Key size provides adequate security margin (AES-256 for long-term, AES-128 minimum)58- Parameters are correct (IV/nonce size, tag length, iteration counts for KDFs)59- Construction is standard (no custom padding, no hand-rolled MAC-then-encrypt)6061### Step 3: Review Key Management62Assess the full key lifecycle:63- **Generation**: Keys generated from cryptographically secure RNG? Sufficient entropy?64- **Storage**: Keys stored in HSM/TPM/keystore? Never in plaintext config files or source code?65- **Distribution**: Key exchange uses authenticated channels? No key material in logs or error messages?66- **Rotation**: Rotation policy defined? Rotation does not cause service disruption?67- **Destruction**: Keys securely erased after use? Memory not swapped to disk with key material?6869### Step 4: Assess Side-Channel Resistance70For security-critical crypto operations, check:71- Constant-time comparison for MACs and signatures (no early-exit on mismatch)72- Constant-time table lookups (no cache-timing-dependent S-box access)73- No branching on secret data74- Memory access patterns independent of key material75- Adequate blinding for RSA/ECC operations7677### Step 5: Check Crypto Agility78Assess the system's ability to migrate algorithms:79- Are algorithm identifiers negotiated or hardcoded?80- Can algorithms be swapped without architectural changes?81- Is there a version/algorithm field in encrypted data formats?82- Can the system support hybrid mode (classical + PQC)?8384> **Compaction resilience**: If context was lost during a long session, re-read the Inputs section to reconstruct what system is being analyzed, then resume from the earliest incomplete step.8586## Output Format8788### Crypto Operations Inventory8990| Operation | Algorithm | Mode | Key Size | Context | Status |91|-----------|-----------|------|----------|---------|--------|92| Data encryption | AES | GCM | 256-bit | Storage at rest | OK |93| ... | ... | ... | ... | ... | ... |9495### Finding Table9697| ID | Category | Description | Severity | Recommendation |98|----|----------|-------------|----------|----------------|99| C1 | Algorithm | SHA-1 used for integrity check | High | Migrate to SHA-256 |100| ... | ... | ... | ... | ... |101102### Key Management Assessment103- **Generation**: [Assessment]104- **Storage**: [Assessment]105- **Rotation**: [Assessment]106- **Destruction**: [Assessment]107108### Crypto Agility Score109- [ ] Algorithm identifiers negotiated: [Yes/No]110- [ ] Format supports versioning: [Yes/No]111- [ ] Hybrid mode possible: [Yes/No]112113## Handoff114115- Hand off to protocol-analysis if protocol-level vulnerabilities are identified during crypto review.116- Hand off to pqc-readiness if quantum migration planning is needed based on algorithm inventory.117118## Quality Checks119- [ ] All crypto operations are inventoried120- [ ] No deprecated algorithms in security-critical paths121- [ ] AEAD mode used for all authenticated encryption122- [ ] Key management covers full lifecycle (generate, store, rotate, destroy)123- [ ] Side-channel resistance assessed for security-critical operations124- [ ] Nonce/IV management verified (uniqueness guaranteed)125- [ ] Crypto agility path exists for future algorithm migration126127## Evolution Notes128<!-- Observations appended after each use -->