@@ -127,7 +127,7 @@ pub struct AutoTlsCa {
127
127
/// The algorithm used to generate a keypair and required configuration settings.
128
128
/// Currently only RSA and a key length of 2048, 3072 or 4096 bits can be configured.
129
129
#[ serde( default ) ]
130
- pub key_generation : TlsKeyGeneration ,
130
+ pub key_generation : CertificateKeyGeneration ,
131
131
}
132
132
133
133
impl AutoTlsCa {
@@ -138,19 +138,19 @@ impl AutoTlsCa {
138
138
139
139
#[ derive( Serialize , Deserialize , Clone , Debug , PartialEq , JsonSchema ) ]
140
140
#[ serde( rename_all = "camelCase" ) ]
141
- pub enum TlsKeyGeneration {
141
+ pub enum CertificateKeyGeneration {
142
142
Rsa {
143
143
/// The amount of bits used for key or certs. Currently, `2048`, `3072` and `4096` are
144
144
/// supported. Defaults to `2048` bits.
145
- #[ schemars( schema_with = "TlsKeyGeneration ::tls_key_length_schema" ) ]
145
+ #[ schemars( schema_with = "CertificateKeyGeneration ::tls_key_length_schema" ) ]
146
146
length : u32 ,
147
147
} ,
148
148
}
149
149
150
- impl TlsKeyGeneration {
151
- pub const TLS_RSA_KEY_LENGTH_2048 : u32 = 2048 ;
152
- pub const TLS_RSA_KEY_LENGTH_3072 : u32 = 3072 ;
153
- pub const TLS_RSA_KEY_LENGTH_4096 : u32 = 4096 ;
150
+ impl CertificateKeyGeneration {
151
+ pub const RSA_KEY_LENGTH_2048 : u32 = 2048 ;
152
+ pub const RSA_KEY_LENGTH_3072 : u32 = 3072 ;
153
+ pub const RSA_KEY_LENGTH_4096 : u32 = 4096 ;
154
154
155
155
// Could not get a "standard" enum with assigned values/discriminants to work as integers in the schema
156
156
// The following was generated and requires the length to be provided as string (we want an integer)
@@ -174,19 +174,19 @@ impl TlsKeyGeneration {
174
174
serde_json:: from_value ( serde_json:: json!( {
175
175
"type" : "integer" ,
176
176
"enum" : [
177
- Self :: TLS_RSA_KEY_LENGTH_2048 ,
178
- Self :: TLS_RSA_KEY_LENGTH_3072 ,
179
- Self :: TLS_RSA_KEY_LENGTH_4096
177
+ Self :: RSA_KEY_LENGTH_2048 ,
178
+ Self :: RSA_KEY_LENGTH_3072 ,
179
+ Self :: RSA_KEY_LENGTH_4096
180
180
]
181
181
} ) )
182
182
. expect ( "Failed to parse JSON of custom tls key length schema" )
183
183
}
184
184
}
185
185
186
- impl Default for TlsKeyGeneration {
186
+ impl Default for CertificateKeyGeneration {
187
187
fn default ( ) -> Self {
188
188
Self :: Rsa {
189
- length : Self :: TLS_RSA_KEY_LENGTH_2048 ,
189
+ length : Self :: RSA_KEY_LENGTH_2048 ,
190
190
}
191
191
}
192
192
}
@@ -446,8 +446,8 @@ mod test {
446
446
} ,
447
447
auto_generate: false ,
448
448
ca_certificate_lifetime: DEFAULT_CA_CERT_LIFETIME ,
449
- key_generation: TlsKeyGeneration :: Rsa {
450
- length: TlsKeyGeneration :: TLS_RSA_KEY_LENGTH_3072
449
+ key_generation: CertificateKeyGeneration :: Rsa {
450
+ length: CertificateKeyGeneration :: RSA_KEY_LENGTH_3072
451
451
}
452
452
} ,
453
453
max_certificate_lifetime: DEFAULT_MAX_CERT_LIFETIME ,
@@ -485,7 +485,7 @@ mod test {
485
485
} ,
486
486
auto_generate: true ,
487
487
ca_certificate_lifetime: Duration :: from_days_unchecked( 100 ) ,
488
- key_generation: TlsKeyGeneration :: default ( )
488
+ key_generation: CertificateKeyGeneration :: default ( )
489
489
} ,
490
490
max_certificate_lifetime: Duration :: from_days_unchecked( 31 ) ,
491
491
} )
0 commit comments