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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//! Client certificate handling for secure connections.
//!
//! This module provides the `Identity` struct for working with client certificates
//! in HTTPS connections, enabling mutual TLS (mTLS) authentication.
/// Represents a client certificate and its associated data for mutual TLS authentication.
///
/// `Identity` encapsulates the client certificate, its password, and an optional
/// certificate authority (CA) certificate. It's used to authenticate the client
/// to the server during the TLS handshake.
///
/// # Examples
///
/// ```
/// use deboa::cert::Identity;
///
/// // Create a new client certificate without a CA
/// let cert = Identity::new(
/// "/path/to/cert.p12".to_string(),
/// "cert-password".to_string(),
/// None
/// );
///
/// // Create a client certificate with a CA
/// let cert_with_ca = Identity::new(
/// "/path/to/cert.p12".to_string(),
/// "cert-password".to_string(),
/// Some("/path/to/ca.pem".to_string())
/// );
///
/// // Access certificate properties
/// println!("Certificate path: {}", cert.cert());
/// println!("CA path: {:?}", cert.ca());
/// ```
pub type ClientCert = Identity;