Expand description
Key backup and recovery mechanisms for secure key management.
This module provides secure backup and recovery of cryptographic keys using Shamir’s Secret Sharing for threshold-based recovery and encrypted backup files.
§Features
- Shamir Secret Sharing Backup: Split keys into N shares requiring M to recover
- Encrypted Backup: Password-based encryption for backup files
- Multiple Key Types: Support for signing keys, encryption keys, and generic secrets
- Versioning: Track backup versions for key rotation
- Metadata: Include timestamps, labels, and key types in backups
§Example
use chie_crypto::key_backup::*;
use chie_crypto::signing::KeyPair;
// Create a signing key
let keypair = KeyPair::generate();
// Create a backup with 3-of-5 threshold
let backup_config = BackupConfig::new(3, 5)
.with_label("my-signing-key")
.with_description("Main signing key for node");
let shares = backup_key_shamir(&keypair, &backup_config).unwrap();
// Distribute shares to different locations/devices
// Later, recover with any 3 shares
let recovered_keypair = recover_key_shamir(&shares[0..3]).unwrap();
// Verify recovery
assert_eq!(keypair.public_key(), recovered_keypair.public_key());Structs§
- Backup
Config - Configuration for key backup
- Backup
Share - A single backup share with metadata
- Encrypted
Backup - Encrypted backup file containing a key
Enums§
- Backup
Error - Errors that can occur during backup and recovery
- KeyType
- Type of key being backed up
Functions§
- backup_
key_ encrypted - Create an encrypted backup of a key using password-based encryption
- backup_
key_ shamir - Backup a key using Shamir’s Secret Sharing
- backup_
secret_ encrypted - Create an encrypted backup of a generic secret
- backup_
secret_ shamir - Backup a generic secret using Shamir’s Secret Sharing
- recover_
key_ encrypted - Recover a key from an encrypted backup
- recover_
key_ shamir - Recover a key from Shamir shares
- recover_
secret_ encrypted - Recover a generic secret from an encrypted backup
- recover_
secret_ shamir - Recover a generic secret from Shamir shares