Documentation Index
Fetch the complete documentation index at: https://mintlify.com/lamassuiot/lamassuiot/llms.txt
Use this file to discover all available pages before exploring further.
Key Management
Lamassu’s Key Management Service (KMS) provides cryptographic key lifecycle management through pluggable crypto engines, supporting software-based keys, cloud HSMs, and hardware security modules.Architecture Overview
The KMS architecture separates key management logic from cryptographic operations:Pluggable Crypto Engines
Crypto engines implement the cryptographic operations interface while providing different storage and security guarantees.All crypto engines expose the same API, allowing seamless switching between implementations based on security requirements and deployment environment.
Crypto Engine Types
Lamassu supports five crypto engine types:Golang (Software)
Type:GOLANGSecurity Level: SL0 (Software) Characteristics:
- Pure Go implementation using standard crypto libraries
- Keys stored in software (database or file system)
- No external dependencies
- Fast cryptographic operations
- Development and testing
- Non-production environments
- Low-security requirements
- Air-gapped deployments without HSM access
PKCS#11
Type:PKCS11Security Level: SL2 (Hardware HSM) Characteristics:
- Industry standard interface (PKCS#11)
- Keys stored in hardware security modules
- FIPS 140-2 Level 2/3 compliance (depends on HSM)
- Tamper-resistant key storage
- Thales Luna HSM
- Gemalto SafeNet HSM
- Utimaco HSM
- SoftHSM (software HSM for testing)
- nCipher nShield
- Production root and intermediate CAs
- High-security deployments
- Compliance requirements (PCI-DSS, FIPS)
- On-premises infrastructure
AWS KMS
Type:AWS_KMSSecurity Level: SL1 (Cloud HSM) Characteristics:
- Managed service by AWS
- Keys stored in AWS CloudHSM clusters
- FIPS 140-2 Level 3 validated
- Integrated IAM access control
- Multi-region key replication
- AWS-native deployments
- Cloud-first architectures
- Multi-region PKI
- Managed HSM without hardware procurement
- AWS region
- IAM credentials or instance profile
- Optional KMS key aliases
AWS Secrets Manager
Type:AWS_SECRETS_MANAGERSecurity Level: SL0 (Software) Characteristics:
- Managed secret storage by AWS
- Keys stored encrypted at rest
- Automatic rotation support
- IAM access control
- Versioning and audit logging
- Non-CA keys (device keys, application keys)
- Development and testing in AWS
- Key storage without HSM requirements
AWS Secrets Manager provides software-level security (SL0) despite being a managed service. Use AWS KMS for hardware-backed key protection.
Azure Key Vault
Type:AZURE_KEY_VAULTSecurity Level: SL1 (Cloud HSM) Characteristics:
- Managed service by Microsoft Azure
- HSM-backed key storage (Premium tier)
- FIPS 140-2 Level 2 validated
- Azure AD access control
- Multi-region replication
- Azure-native deployments
- Multi-cloud with Azure presence
- Managed HSM in Azure
- Azure subscription and resource group
- Key Vault name
- Azure AD service principal credentials
HashiCorp Vault KV v2
Type:HASHICORP_VAULT_KV_V2Security Level: SL0 (Software) or SL1 (if Vault uses HSM backend) Characteristics:
- Self-hosted or HCP Vault
- Versioned secret storage
- Policy-based access control
- Audit logging
- Can be backed by HSM (Auto Unseal)
- Multi-cloud deployments
- Organizations already using Vault
- Advanced policy and RBAC requirements
- Hybrid cloud/on-premises
- Vault address
- Authentication method (token, AppRole, Kubernetes)
- KV v2 mount path
Security Levels
Crypto engines are classified by security level:SL0 — Software
Protection level: Software-based encryption Engines: Golang, AWS Secrets Manager, Vault KV v2 (without HSM backend) Guarantees:- Keys encrypted at rest
- Access control via application layer
- No hardware tamper protection
- Device private keys (ephemeral)
- Application keys
- Development and testing
SL1 — Cloud HSM
Protection level: Cloud-managed HSM Engines: AWS KMS, Azure Key Vault (Premium) Guarantees:- Keys stored in FIPS 140-2 validated HSMs
- Keys never leave HSM in plaintext
- Cloud provider manages HSM infrastructure
- Production intermediate and issuing CAs
- Cloud-native deployments
- Managed security without hardware procurement
SL2 — Hardware HSM
Protection level: On-premises HSM Engines: PKCS#11 Guarantees:- Keys stored in organization-controlled HSMs
- FIPS 140-2 Level 2/3 compliance
- Physical tamper protection
- Complete control over key lifecycle
- Root CAs
- High-security compliance requirements
- Air-gapped environments
- Maximum control and sovereignty
Choose security level based on the criticality of the keys and compliance requirements. Root CAs should always use SL2, while device keys can use SL0.
Key Data Model
Key Fields
KeyID
Unique identifier for the key within the crypto engine. Examples:key-ca-root-01device-key-12345- UUID
Name and Aliases
Name: Primary human-readable identifierAliases: Alternative names for key lookup Use case: Alias
ca-root might point to key-ca-root-01-v2 after rotation
EngineID
Identifier of the crypto engine storing this key. Examples:golang-defaultpkcs11-prod-hsmaws-kms-us-east-1
Algorithm and Size
Algorithm: Cryptographic algorithmRSAECDSAEd25519DSA(legacy)
- RSA: 2048, 3072, 4096
- ECDSA: 224, 256, 384, 521 (P-curves)
- Ed25519: 256 (fixed)
HasPrivateKey
Indicates whether the private key is available in the crypto engine. true: Can perform signing operationsfalse: Public key only, used for verification
PublicKey
PEM-encoded public key portion. Uses:- Certificate generation
- Signature verification
- Public key distribution
PKCS11URI
PKCS#11 URI automatically computed for PKCS#11 keys:Supported Key Types
Each crypto engine supports a subset of key types:Typical Support Matrix
| Engine | RSA | ECDSA | Ed25519 |
|---|---|---|---|
| Golang | ✓ 2048-4096 | ✓ P-256/384/521 | ✓ |
| PKCS#11 | ✓ 2048-4096 | ✓ P-256/384/521 | Depends on HSM |
| AWS KMS | ✓ 2048-4096 | ✓ P-256/384/521 | ✗ |
| Azure KV | ✓ 2048-4096 | ✓ P-256/384/521 | ✗ |
| Vault | ✓ 2048-4096 | ✓ P-256/384/521 | ✓ |
Query the
/v2/kms/engines/{engineId} endpoint to get the exact supported key types for a specific crypto engine instance.Key Operations
Create Key
Generate a new key pair in the crypto engine: Request:Import Key
Import an existing key pair: Use cases:- Migrate keys from another system
- Import externally generated keys
- Disaster recovery from backup
- Not all engines support key import
- HSMs may require special procedures for key import
Sign
Sign data with a private key: Input: Message digest or raw dataOutput: Digital signature Used for:
- Certificate signing
- CRL signing
- Message authentication
Verify
Verify a signature using the public key: Input: Message, signature, public keyOutput: Valid/Invalid
Delete Key
Permanently delete a key from the crypto engine: Considerations:- Revoke associated certificates first
- Verify no active references
- Document deletion reason
- Follow key escrow/backup policies
Key Strength Metadata
Lamassu computes key strength metrics:Strength Classification
HIGH:- RSA ≥ 3072 bits
- ECDSA ≥ 384 bits (P-384, P-521)
- Ed25519
- RSA 2048 bits
- ECDSA 256 bits (P-256)
- RSA < 2048 bits
- ECDSA < 256 bits
- DSA (any size)
Crypto Engine Provider
Crypto engines are registered as providers:Default Engine
One crypto engine can be marked as default:- Used when no engine is specified in API calls
- Typically the primary production engine
- Can be changed dynamically
Multiple Engines
Lamassu supports multiple concurrent crypto engines: Use cases:- Different security levels for different CA tiers
- Migration between engines
- Multi-cloud deployments
- Development vs. production separation
Key Statistics
KMS Bind Resources
Keys can be bound to specific resources:- Key:
lamassu.io/kms/binded-resources - Value: Array of
KMSBindResourceobjects
- Track key usage
- Prevent accidental deletion of in-use keys
- Audit key-resource relationships
Related API Endpoints
GET /v2/kms/engines— List crypto enginesPOST /v2/kms/engines— Register a crypto engineGET /v2/kms/engines/{engineId}— Get engine detailsDELETE /v2/kms/engines/{engineId}— Unregister engineGET /v2/kms/keys— List keysPOST /v2/kms/keys— Create keyGET /v2/kms/keys/{keyId}— Get key detailsDELETE /v2/kms/keys/{keyId}— Delete keyPOST /v2/kms/keys/{keyId}/sign— Sign operationPOST /v2/kms/keys/{keyId}/verify— Verify operationGET /v2/stats/kms— Get KMS statistics
Best Practices
Engine Selection
- Root CAs: SL2 (PKCS#11 with hardware HSM)
- Intermediate CAs: SL1 (AWS KMS, Azure Key Vault) or SL2
- Issuing CAs: SL1 (cloud HSM) for production
- Device keys: SL0 acceptable if generated on-device
- Development: SL0 (Golang engine)
Key Size Selection
- Root CA: RSA 4096 or ECDSA P-521 (20+ year lifetime)
- Intermediate CA: RSA 3072 or ECDSA P-384 (10 year lifetime)
- Issuing CA: RSA 2048 or ECDSA P-256 (5 year lifetime)
- Device certificates: RSA 2048 or ECDSA P-256 (1-2 year lifetime)
Algorithm Selection
- ECDSA — Smaller keys, faster operations, modern choice
- RSA — Better compatibility, widely supported
- Ed25519 — Fastest, smallest signatures, limited HSM support
Key Lifecycle
- Generate keys in HSM when possible (don’t import)
- Back up root CA keys to offline secure storage
- Rotate keys based on policy and compliance requirements
- Delete keys only after certificate expiration and retention period
- Audit key operations using crypto engine logs
High Availability
- Redundant HSMs for PKCS#11 engines
- Multi-region replication for cloud engines (AWS KMS, Azure KV)
- Multiple crypto engines for failover capability
- Regular backup and recovery testing
Security
- Least privilege access to crypto engines
- Separate engines for different security domains
- Monitor key operations for anomalies
- Rotate engine credentials regularly
- Enable audit logging on all crypto engines
Next Steps
Crypto Engines
Configure and deploy crypto engines
Certificate Authorities
Learn how CAs use KMS for key storage
KMS API
Explore the Key Management API
Security Best Practices
Harden your PKI infrastructure
