Hardware Rooted Identity
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Hardware Rooted Identity establishes device identity through cryptographic keys stored in secure hardware elements (TPM, SE, HSM). This provides tamper-resistant device authentication, secure key storage, and prevents device impersonation in IoT deployments.
Why This Matters
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
- Inputs:
- <e.g., env vars, request payload, file paths, schema>
- Entry Conditions:
- <Pre-requisites: e.g., Repo initialized, DB running, specific branch checked out>
- Outputs:
- <e.g., artifacts (PR diff, docs, tests, dashboard JSON)>
- Artifacts Required (Deliverables):
- <e.g., Code Diff, Unit Tests, Migration Script, API Docs>
- Acceptance Evidence:
- <e.g., Test Report (screenshot/log), Benchmark Result, Security Scan Report>
- Success Criteria:
- <e.g., p95 < 300ms, coverage ≥ 80%>
Skill Composition
- Depends on: security
- Compatible with: None
- Conflicts with: None
- Related Skills: authn, authz
Quick Start
Install dependencies:
pip install cryptography pyserial
Initialize secure element:
se = SecureElementManager(
element_type=SecureElementType.ATECC608A,
interface="i2c"
)
Generate key pair:
public_key, key_handle = se.generate_key_pair(
key_type=KeyType.ECC,
key_id="device-001"
)
Sign data:
signature = se.sign_data(data, key_handle)
Assumptions / Constraints / Non-goals
- Assumptions:
- Development environment is properly configured
- Required dependencies are available
- Team has basic understanding of domain
- Constraints:
- Must follow existing codebase conventions
- Time and resource limitations
- Compatibility requirements
- Non-goals:
- This skill does not cover edge cases outside scope
- Not a replacement for formal training
Compatibility & Prerequisites
- Supported Versions:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Required AI Tools:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
- Dependencies:
- Language-specific package manager
- Build tools
- Testing libraries
- Environment Setup:
.env.example keys: API_KEY, DATABASE_URL (no values)
Test Scenario Matrix (QA Strategy)
| Type |
Focus Area |
Required Scenarios / Mocks |
| Unit |
Core Logic |
Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration |
DB / API |
All external API calls or database connections must be mocked during unit tests |
| E2E |
User Journey |
Critical user flows to test |
| Performance |
Latency / Load |
Benchmark requirements |
| Security |
Vuln / Auth |
SAST/DAST or dependency audit |
| Frontend |
UX / A11y |
Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns
Software-Based Keys: Storing keys in software
- Why it's bad: Keys can be extracted, devices can be cloned
- Solution: Use hardware secure elements
No Certificate Validation: Accepting any certificate
- Why it's bad: Allows unauthorized devices
- Solution: Implement proper certificate validation
No Key Rotation: Using same keys indefinitely
- Why it's bad: Increases exposure if keys are compromised
- Solution: Implement regular key rotation
No Attestation: Not verifying device integrity
- Why it's bad: Compromised devices can authenticate
- Solution: Implement device attestation
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: hardware-rooted-identity3description: Hardware Rooted Identity establishes device identity through cryptographic Use when this capability is needed.4---56# Hardware Rooted Identity78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17Hardware Rooted Identity establishes device identity through cryptographic keys stored in secure hardware elements (TPM, SE, HSM). This provides tamper-resistant device authentication, secure key storage, and prevents device impersonation in IoT deployments.1819## Why This Matters20- **<Benefit>**: <short explanation>21- **<Benefit>**: <short explanation>22- **<Benefit>**: <short explanation>2324## Core Concepts & Rules2526### 1. Core Principles27- Follow established patterns and conventions28- Maintain consistency across codebase29- Document decisions and trade-offs3031### 2. Implementation Guidelines32- Start with the simplest viable solution33- Iterate based on feedback and requirements34- Test thoroughly before deployment353637## Inputs / Outputs / Contracts38* **Inputs**:39 - <e.g., env vars, request payload, file paths, schema>40* **Entry Conditions**:41 - <Pre-requisites: e.g., Repo initialized, DB running, specific branch checked out>42* **Outputs**:43 - <e.g., artifacts (PR diff, docs, tests, dashboard JSON)>44* **Artifacts Required (Deliverables)**:45 - <e.g., Code Diff, Unit Tests, Migration Script, API Docs>46* **Acceptance Evidence**:47 - <e.g., Test Report (screenshot/log), Benchmark Result, Security Scan Report>48* **Success Criteria**:49 - <e.g., p95 < 300ms, coverage ≥ 80%>5051## Skill Composition52* **Depends on**: security53* **Compatible with**: None54* **Conflicts with**: None55* **Related Skills**: authn, authz5657## Quick Start581. **Install dependencies:**59 ```bash60 pip install cryptography pyserial61 ```62632. **Initialize secure element:**64 ```python65 se = SecureElementManager(66 element_type=SecureElementType.ATECC608A,67 interface="i2c"68 )69 ```70713. **Generate key pair:**72 ```python73 public_key, key_handle = se.generate_key_pair(74 key_type=KeyType.ECC,75 key_id="device-001"76 )77 ```78794. **Sign data:**80 ```python81 signature = se.sign_data(data, key_handle)82 ```8384## Assumptions / Constraints / Non-goals8586* **Assumptions**:87 - Development environment is properly configured88 - Required dependencies are available89 - Team has basic understanding of domain90* **Constraints**:91 - Must follow existing codebase conventions92 - Time and resource limitations93 - Compatibility requirements94* **Non-goals**:95 - This skill does not cover edge cases outside scope96 - Not a replacement for formal training979899## Compatibility & Prerequisites100101* **Supported Versions**:102 - Python 3.8+103 - Node.js 16+104 - Modern browsers (Chrome, Firefox, Safari, Edge)105* **Required AI Tools**:106 - Code editor (VS Code recommended)107 - Testing framework appropriate for language108 - Version control (Git)109* **Dependencies**:110 - Language-specific package manager111 - Build tools112 - Testing libraries113* **Environment Setup**:114 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)115116117## Test Scenario Matrix (QA Strategy)118119| Type | Focus Area | Required Scenarios / Mocks |120| :--- | :--- | :--- |121| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |122| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |123| **E2E** | User Journey | Critical user flows to test |124| **Performance** | Latency / Load | Benchmark requirements |125| **Security** | Vuln / Auth | SAST/DAST or dependency audit |126| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |127128129## Technical Guardrails & Security Threat Model130131### 1. Security & Privacy (Threat Model)132* **Top Threats**: Injection attacks, authentication bypass, data exposure133- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII134- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager135- [ ] **Authorization**: Validate user permissions before state changes136137### 2. Performance & Resources138- [ ] **Execution Efficiency**: Consider time complexity for algorithms139- [ ] **Memory Management**: Use streams/pagination for large data140- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks141142### 3. Architecture & Scalability143- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection144- [ ] **Modularity**: Decouple logic from UI/Frameworks145146### 4. Observability & Reliability147- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`148- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`149- [ ] **Error Handling**: Standardized error codes, no bare except150- [ ] **Observability Artifacts**:151 - **Log Fields**: timestamp, level, message, request_id152 - **Metrics**: request_count, error_count, response_time153 - **Dashboards/Alerts**: High Error Rate > 5%154155156## Agent Directives & Error Recovery157*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*158159- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.160- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.161- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.162- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.163164165## Definition of Done (DoD) Checklist166167- [ ] Tests passed + coverage met168- [ ] Lint/Typecheck passed169- [ ] Logging/Metrics/Trace implemented170- [ ] Security checks passed171- [ ] Documentation/Changelog updated172- [ ] Accessibility/Performance requirements met (if frontend)173174175## Anti-patterns1761. **Software-Based Keys:** Storing keys in software177 - **Why it's bad:** Keys can be extracted, devices can be cloned178 - **Solution:** Use hardware secure elements1791802. **No Certificate Validation:** Accepting any certificate181 - **Why it's bad:** Allows unauthorized devices182 - **Solution:** Implement proper certificate validation1831843. **No Key Rotation:** Using same keys indefinitely185 - **Why it's bad:** Increases exposure if keys are compromised186 - **Solution:** Implement regular key rotation1871884. **No Attestation:** Not verifying device integrity189 - **Why it's bad:** Compromised devices can authenticate190 - **Solution:** Implement device attestation191192## Reference Links & Examples193194* Internal documentation and examples195* Official documentation and best practices196* Community resources and discussions197198199## Versioning & Changelog200201* **Version**: 1.0.0202* **Changelog**:203 - 2026-02-22: Initial version with complete template structure204205---206> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.207<!-- tomevault:4.0:skill_md:2026-04-13 -->