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-review3description: 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).4---56# Crypto Review78## Purpose9Review cryptographic implementations for algorithm choice correctness, key management soundness, side-channel resistance, and crypto agility readiness.1011## Scope Constraints1213Reads 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.1415## Inputs16- System or component using cryptographic operations17- Cryptographic algorithms and modes in use18- Key management architecture (generation, storage, rotation, destruction)19- Data sensitivity classification and compliance requirements20- Performance constraints and target platforms2122## Input Sanitization2324No user-provided values are used in commands or file paths. All inputs are treated as read-only analysis targets.2526## Procedure2728### Step 1: Inventory Crypto Operations29Enumerate all cryptographic operations in the system:30- Symmetric encryption (algorithm, mode, key size)31- Asymmetric operations (signing, key exchange, encryption)32- Hashing (algorithm, usage context — integrity, commitment, password)33- Key derivation (KDF, parameters, input entropy)34- Random number generation (source, seeding, reseeding)3536### Step 2: Check Algorithm Choices37For each crypto operation, verify:38- Algorithm is current and not deprecated (no MD5, SHA-1 for security, DES, RC4)39- Mode is appropriate (AEAD preferred: AES-GCM, ChaCha20-Poly1305; no ECB, no unauthenticated CBC)40- Key size provides adequate security margin (AES-256 for long-term, AES-128 minimum)41- Parameters are correct (IV/nonce size, tag length, iteration counts for KDFs)42- Construction is standard (no custom padding, no hand-rolled MAC-then-encrypt)4344### Step 3: Review Key Management45Assess the full key lifecycle:46- **Generation**: Keys generated from cryptographically secure RNG? Sufficient entropy?47- **Storage**: Keys stored in HSM/TPM/keystore? Never in plaintext config files or source code?48- **Distribution**: Key exchange uses authenticated channels? No key material in logs or error messages?49- **Rotation**: Rotation policy defined? Rotation does not cause service disruption?50- **Destruction**: Keys securely erased after use? Memory not swapped to disk with key material?5152### Step 4: Assess Side-Channel Resistance53For security-critical crypto operations, check:54- Constant-time comparison for MACs and signatures (no early-exit on mismatch)55- Constant-time table lookups (no cache-timing-dependent S-box access)56- No branching on secret data57- Memory access patterns independent of key material58- Adequate blinding for RSA/ECC operations5960### Step 5: Check Crypto Agility61Assess the system's ability to migrate algorithms:62- Are algorithm identifiers negotiated or hardcoded?63- Can algorithms be swapped without architectural changes?64- Is there a version/algorithm field in encrypted data formats?65- Can the system support hybrid mode (classical + PQC)?6667> **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.6869## Output Format7071### Crypto Operations Inventory7273| Operation | Algorithm | Mode | Key Size | Context | Status |74|-----------|-----------|------|----------|---------|--------|75| Data encryption | AES | GCM | 256-bit | Storage at rest | OK |76| ... | ... | ... | ... | ... | ... |7778### Finding Table7980| ID | Category | Description | Severity | Recommendation |81|----|----------|-------------|----------|----------------|82| C1 | Algorithm | SHA-1 used for integrity check | High | Migrate to SHA-256 |83| ... | ... | ... | ... | ... |8485### Key Management Assessment86- **Generation**: [Assessment]87- **Storage**: [Assessment]88- **Rotation**: [Assessment]89- **Destruction**: [Assessment]9091### Crypto Agility Score92- [ ] Algorithm identifiers negotiated: [Yes/No]93- [ ] Format supports versioning: [Yes/No]94- [ ] Hybrid mode possible: [Yes/No]9596## Handoff9798- Hand off to protocol-analysis if protocol-level vulnerabilities are identified during crypto review.99- Hand off to pqc-readiness if quantum migration planning is needed based on algorithm inventory.100101## Quality Checks102- [ ] All crypto operations are inventoried103- [ ] No deprecated algorithms in security-critical paths104- [ ] AEAD mode used for all authenticated encryption105- [ ] Key management covers full lifecycle (generate, store, rotate, destroy)106- [ ] Side-channel resistance assessed for security-critical operations107- [ ] Nonce/IV management verified (uniqueness guaranteed)108- [ ] Crypto agility path exists for future algorithm migration109110## Evolution Notes111<!-- Observations appended after each use -->