Skip to content

Commit 788684e

Browse files
atlas-formclaude
andcommitted
feat: implement PKI KeyStore adapter with enterprise features
* Add PKI-specific keystore adapter layer over capsula-key EnhancedKeyStore * Implement policy constraints for certificate types, validity periods, and key usage * Add certificate-key association management and bidirectional mapping * Support certificate templates with configurable defaults and extensions * Include enterprise features: statistics, policy validation, batch operations * Add comprehensive test coverage with 4 core tests passing * Support multi-algorithm keys (RSA, P-256, Ed25519) with PKI-specific policies * Integrate seamlessly with existing PKI workflows and certificate management * Add PolicyViolation error type for constraint enforcement Resolves keystore functionality gaps identified in TODO.md milestone tracking. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 364ff2f commit 788684e

File tree

3 files changed

+540
-0
lines changed

3 files changed

+540
-0
lines changed

crates/capsula-pki/src/error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ pub enum PkiError {
9595
#[error("Authentication error: {0}")]
9696
AuthError(String),
9797

98+
/// 策略违反错误
99+
#[error("Policy violation: {0}")]
100+
PolicyViolation(String),
101+
98102
/// IO错误
99103
#[error("IO error: {0}")]
100104
IoError(#[from] std::io::Error),

crates/capsula-pki/src/keystore/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ pub mod hsm;
1212
pub mod escrow;
1313
pub mod recovery;
1414
pub mod rotation;
15+
pub mod pki_adapter;
1516

1617
// 重新导出存储相关类型
1718
pub use storage::{CertificateStore, FileSystemBackend, StorageBackend};
19+
// 重新导出PKI adapter类型
20+
pub use pki_adapter::{
21+
PKIKeyStore, PKIKeyMetadata, PolicyConstraints, CertificateType,
22+
ExtendedKeyUsage, CertificateTemplate, PKIKeyStoreStatistics
23+
};
1824

1925
use crate::error::Result;
2026
use capsula_key::Key;

0 commit comments

Comments
 (0)