mcpField
C
configuring-hsm-for-key-storage

configuring-hsm-for-key-storage

github.com/mukul975Security35.2k87 installsUpdated 8w ago
Repository

About configuring-hsm-for-key-storage

A skill guide for security engineers configuring physical HSMs or SoftHSM2 through PKCS#11 for key management and cryptographic operations. It also covers certificate authority tasks, access controls, and cloud HSM services.

Key features

  1. 01Configure SoftHSM2 for development
  2. 02Generate and manage keys inside an HSM
  3. 03Encrypt and sign with HSM-resident keys
  4. 04Set key access policies and user authentication
  5. 05Perform HSM-backed certificate authority operations
  6. 06Interface with AWS CloudHSM and Azure

Use cases

  1. 01Set up a PKCS#11 provider for development
  2. 02Move key generation and cryptographic operations into an HSM
  3. 03Design key access controls and disaster recovery

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill configuring-hsm-for-key-storage

After installing, type/configuring-hsm-for-key-storagein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

LICENSE
assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
agent.py
process.py

Details

From the project README

Configuring HSM for Key Storage

Overview

Hardware Security Modules (HSMs) are tamper-resistant physical devices that safeguard cryptographic keys and perform cryptographic operations in a hardened environment. Keys stored in an HSM never leave the device boundary, providing the highest level of key protection. This skill covers configuring HSMs using the PKCS#11 standard interface, including key generation, signing, encryption, and key management using both physical HSMs and SoftHSM2 for development.

When to Use

  • When deploying or configuring configuring hsm for key storage capabilities in your environment
  • When establishing security controls aligned to compliance requirements
  • When building or improving security architecture for this domain
  • When conducting security assessments that require this implementation

Prerequisites

  • Familiarity with cryptography concepts and tools
  • Access to a test or lab environment for safe execution
  • Python 3.8+ with required dependencies installed
  • Appropriate authorization for any testing activities

Objectives

  • Configure SoftHSM2 as a development PKCS#11 provider
  • Generate and manage keys inside the HSM via PKCS#11
  • Perform cryptographic operations (sign, verify, encrypt, decrypt) using HSM-resident keys
  • Implement HSM-backed certificate authority operations
  • Configure key access policies and user authentication
  • Interface with cloud HSM services (AWS CloudHSM, Azure)

Key Concepts

HSM Compliance Levels
FIPS LevelProtectionUse Case
FIPS 140-2 Level 1Software onlyDevelopment
FIPS 140-2 Level 2Tamper-evident, role-based authGeneral production
FIPS 140-2 Level 3Tamper-resistant, identity-based authFinancial, government
FIPS 140-2 Level 4Physical tamper responseMilitary, classified
PKCS#11 Architecture
Application --> PKCS#11 API --> HSM Provider --> Hardware HSM
                                    |
                              (SoftHSM2 for dev)
Key Objects in PKCS#11
Object TypeDescriptionOperations
CKO_SECRET_KEYSymmetric keys (AES)Encrypt, Decrypt, Wrap
CKO_PUBLIC_KEYPublic keys (RSA, EC)Verify, Encrypt, Wrap
CKO_PRIVATE_KEYPrivate keys (RSA, EC)Sign, Decrypt, Unwrap
CKO_CERTIFICATEX.509 certificatesStorage, retrieval

Security Considerations

  • Never export private keys from HSM (use CKA_EXTRACTABLE=False)
  • Use separate slots/partitions for different applications
  • Implement multi-person key ceremony for CA root keys
  • Enable audit logging for all HSM operations
  • Implement HSM backup and disaster recovery
  • Use strong PINs and enable SO (Security Officer) PIN

Validation Criteria

  • SoftHSM2 initializes with token and user PIN
  • AES key generates inside HSM
  • RSA key pair generates inside HSM
  • Encryption/decryption uses HSM-resident keys
  • Signing/verification uses HSM-resident keys
  • Keys cannot be exported (non-extractable)
  • Key listing shows all HSM-stored objects

Comments

Markdown supported