File tree Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Expand file tree Collapse file tree 1 file changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -578,6 +578,22 @@ impl Default for CertificateParams {
578
578
}
579
579
580
580
impl CertificateParams {
581
+ /// Generate certificate parameters with reasonable defaults
582
+ pub fn new ( subject_alt_names : impl Into < Vec < String > > ) -> Self {
583
+ let subject_alt_names = subject_alt_names
584
+ . into ( )
585
+ . into_iter ( )
586
+ . map ( |s| match s. parse ( ) {
587
+ Ok ( ip) => SanType :: IpAddress ( ip) ,
588
+ Err ( _) => SanType :: DnsName ( s) ,
589
+ } )
590
+ . collect :: < Vec < _ > > ( ) ;
591
+ CertificateParams {
592
+ subject_alt_names,
593
+ ..Default :: default ( )
594
+ }
595
+ }
596
+
581
597
/// Parses an existing ca certificate from the ASCII PEM format.
582
598
///
583
599
/// See [`from_ca_cert_der`](Self::from_ca_cert_der) for more details.
@@ -1208,24 +1224,6 @@ pub enum BasicConstraints {
1208
1224
Constrained ( u8 ) ,
1209
1225
}
1210
1226
1211
- impl CertificateParams {
1212
- /// Generate certificate parameters with reasonable defaults
1213
- pub fn new ( subject_alt_names : impl Into < Vec < String > > ) -> Self {
1214
- let subject_alt_names = subject_alt_names
1215
- . into ( )
1216
- . into_iter ( )
1217
- . map ( |s| match s. parse ( ) {
1218
- Ok ( ip) => SanType :: IpAddress ( ip) ,
1219
- Err ( _) => SanType :: DnsName ( s) ,
1220
- } )
1221
- . collect :: < Vec < _ > > ( ) ;
1222
- CertificateParams {
1223
- subject_alt_names,
1224
- ..Default :: default ( )
1225
- }
1226
- }
1227
- }
1228
-
1229
1227
/// The [NameConstraints extension](https://tools.ietf.org/html/rfc5280#section-4.2.1.10)
1230
1228
/// (only relevant for CA certificates)
1231
1229
#[ derive( Debug , PartialEq , Eq , Clone ) ]
You can’t perform that action at this time.
0 commit comments