Overview
Proper key management is critical for maintaining the confidentiality and security of your transactions. This guide covers best practices for generating, storing, and managing encryption keys used with the Solana ZK SDK.Key Generation
Use Strong Entropy
Always generate keys using thesolana-zk-keygen tool, which uses cryptographically secure random number generation:
BIP39 Passphrases
Consider using a BIP39 passphrase for additional security:- Adds an extra layer of security beyond the seed phrase
- Protects against physical theft of the seed phrase
- Allows plausible deniability (different passphrases generate different keys)
If you use a passphrase, you MUST remember it. Without the passphrase, you cannot recover your keys even with the seed phrase.
Seed Phrase Word Count
Use at least 12 words for your seed phrase. For higher security requirements, use 24 words:| Word Count | Entropy Bits | Security Level |
|---|---|---|
| 12 words | 128 bits | Standard |
| 15 words | 160 bits | Enhanced |
| 18 words | 192 bits | High |
| 21 words | 224 bits | Very High |
| 24 words | 256 bits | Maximum |
Secure Storage
Seed Phrase Storage
Your seed phrase is the master key to your encryption keys. Follow these guidelines: DO:- Write the seed phrase on paper and store it in a secure location (safe, safety deposit box)
- Use metal backup devices that are fire and water resistant
- Consider splitting the seed phrase using Shamir’s Secret Sharing
- Store backups in multiple geographic locations
- Use a password manager with strong encryption for digital backups
- Store seed phrases in plain text files on your computer
- Take screenshots or photos of seed phrases
- Store seed phrases in cloud storage without encryption
- Share seed phrases via email, messaging apps, or any digital communication
- Store seed phrases near your computer or on the same device
Key File Storage
The JSON key files generated bysolana-zk-keygen should be protected:
- Store key files on encrypted filesystems
- Use hardware security modules (HSMs) for high-value applications
- Never commit key files to version control systems
- Regularly audit access to directories containing keys
- Use environment-specific keys (development, staging, production)
Hardware Wallet Integration
For maximum security, consider using hardware wallets:- Keys never leave the secure hardware device
- Resistant to malware and keyloggers
- Physical confirmation required for transactions
Key Rotation
When to Rotate Keys
Rotate your encryption keys if:- You suspect the key has been compromised
- The key has been used for an extended period (annually for high-security applications)
- An employee with key access leaves your organization
- Security vulnerabilities are discovered in key handling procedures
How to Rotate Keys
- Generate a new keypair:
- Update your application to use the new key
- Gradually phase out the old key
- Securely delete the old key file:
Key Recovery
Testing Recovery Procedures
Regularly test your key recovery process:Recovery Scenarios
Lost key file but have seed phrase:recover command to regenerate it.
Multi-Signature and Access Control
Organizational Key Management
For teams and organizations:- Implement multi-signature schemes where multiple parties must approve key usage
- Use role-based access control (RBAC) for key access
- Maintain an audit log of key usage and access
- Implement separation of duties (different people generate, store, and use keys)
Key Escrow
Consider key escrow for business continuity:- Store encrypted key backups with a trusted third party
- Use multi-party computation (MPC) to split key control
- Document key recovery procedures in your disaster recovery plan
Operational Security
Environment Isolation
Use separate keys for different environments:Access Monitoring
Monitor and log access to key files:Secure Key Generation Environment
Generate keys on a secure, air-gapped machine when possible:- Use a clean operating system installation
- Disconnect from the internet
- Verify the integrity of the
solana-zk-keygenbinary - Transfer keys to operational systems using encrypted, authenticated channels
Compliance Considerations
Regulatory Requirements
Depending on your jurisdiction and use case, you may need to:- Maintain key usage audit trails
- Implement key management policies (NIST, ISO 27001)
- Support key recovery for legal or regulatory purposes
- Comply with data residency requirements for key storage
Documentation
Maintain documentation for:- Key generation procedures
- Key storage locations and access controls
- Key rotation schedules
- Recovery procedures
- Incident response plans for key compromise
Emergency Procedures
Key Compromise Response
If you suspect a key has been compromised:- Immediately stop using the compromised key
- Generate a new keypair
- Update all systems to use the new key
- Investigate the scope of the compromise
- Notify affected parties if required
- Review and improve security procedures
Secure Key Deletion
When permanently deleting keys:Checklist
Use this checklist to ensure proper key management:- Keys generated using
solana-zk-keygenwith strong entropy - Seed phrases backed up in multiple secure locations
- Key files have restrictive file permissions (600 or stricter)
- BIP39 passphrase documented and stored securely (if used)
- Key recovery procedures tested and documented
- Separate keys used for development and production environments
- Key rotation schedule established and followed
- Access to keys monitored and logged
- Incident response plan prepared for key compromise
- Compliance requirements documented and met