kmip_protocol/client/
config.rs

1use std::time::Duration;
2
3/// Certificate details in various supported formats for use with TLS client authentication.
4#[derive(Clone, Debug)]
5pub enum ClientCertificate {
6    SeparatePem {
7        cert_bytes: Vec<u8>,
8        key_bytes: Option<Vec<u8>>,
9    },
10    CombinedPkcs12 {
11        cert_bytes: Vec<u8>,
12    },
13}
14
15/// TCP and TLS settings for connecting to a KMIP server.
16#[derive(Clone, Default, Debug)]
17pub struct ConnectionSettings {
18    /// HSM host/domain name
19    pub host: String,
20
21    /// HSM port number
22    pub port: u16,
23
24    /// HSM username
25    pub username: Option<String>,
26
27    /// HSM password
28    pub password: Option<String>,
29
30    /// Disable security features such as server certificate verification
31    pub insecure: bool,
32
33    /// Client certificate authentication
34    pub client_cert: Option<ClientCertificate>,
35
36    /// Server certificate bytes in PEM format
37    pub server_cert: Option<Vec<u8>>,
38
39    /// Server CA certificate bytes in PEM format
40    pub ca_cert: Option<Vec<u8>>,
41
42    /// TCP connect timeout
43    pub connect_timeout: Option<Duration>,
44
45    /// TCP read timeout
46    pub read_timeout: Option<Duration>,
47
48    /// TCP write timeout
49    pub write_timeout: Option<Duration>,
50
51    /// Maximum number of HSM response bytes to accept
52    pub max_response_bytes: Option<u32>,
53}