1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Key generation strategies and implementations.
//!
//! This module provides the core trait and implementations for generating
//! Data Encryption Keys (DEKs). It includes:
//!
//! - Fixed-length random key generation
//! - String-based keys for testing
//! - Custom generation strategies
//! - Common interfaces and traits
use crateGenerateKeyError;
/// A trait for generating Data Encryption Keys (DEK).
///
/// This trait defines the core interface for key generation, allowing
/// different strategies to be implemented while maintaining a consistent
/// interface. Implementations should ensure:
///
/// - Appropriate key lengths
/// - Sufficient entropy
/// - Proper error handling
/// - Thread safety where needed
///
/// # Security
///
/// Implementations should consider:
/// - Using cryptographically secure random number generators
/// - Maintaining key confidentiality
/// - Following cryptographic best practices
/// - Proper handling of sensitive data
///
/// # Example
/// ```no_run
/// use hyokashi::{DEKKeyGenerator, GenerateKeyError};
///
/// struct MyGenerator;
///
/// impl DEKKeyGenerator for MyGenerator {
/// fn generate_key(&self) -> Result<Vec<u8>, GenerateKeyError> {
/// // Implement secure key generation...
/// # Ok(vec![])
/// }
/// }
/// ```