This repository was archived by the owner on Oct 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ impl ResolvesServerCert for CertificateResolver {
51
51
}
52
52
53
53
impl Config {
54
- pub fn rustls_certificate ( & self , cert_id : & str ) -> super :: Result < Certificate > {
55
- certs ( & mut Cursor :: new ( self . file_contents ( (
54
+ pub fn rustls_certificate ( & self , cert_id : & str ) -> super :: Result < Vec < Certificate > > {
55
+ let certs = certs ( & mut Cursor :: new ( self . file_contents ( (
56
56
"certificate" ,
57
57
cert_id,
58
58
"cert" ,
@@ -62,8 +62,15 @@ impl Config {
62
62
} ) ?
63
63
. into_iter ( )
64
64
. map ( Certificate )
65
- . next ( )
66
- . ok_or_else ( || format ! ( "No certificates found in \" certificate.{cert_id}.cert\" ." ) )
65
+ . collect :: < Vec < _ > > ( ) ;
66
+
67
+ if !certs. is_empty ( ) {
68
+ Ok ( certs)
69
+ } else {
70
+ Err ( format ! (
71
+ "No certificates found in \" certificate.{cert_id}.cert\" ."
72
+ ) )
73
+ }
67
74
}
68
75
69
76
pub fn rustls_private_key ( & self , cert_id : & str ) -> super :: Result < PrivateKey > {
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ impl Config {
116
116
value,
117
117
match self . value ( ( prefix, "certificate" ) ) {
118
118
Some ( sni_cert_id) if sni_cert_id != cert_id => CertifiedKey {
119
- cert : vec ! [ self . rustls_certificate( sni_cert_id) ?] ,
119
+ cert : self . rustls_certificate ( sni_cert_id) ?,
120
120
key : any_supported_type ( & self . rustls_private_key ( sni_cert_id) ?)
121
121
. map_err ( |err| {
122
122
format ! (
@@ -127,7 +127,7 @@ impl Config {
127
127
sct_list : None ,
128
128
} ,
129
129
_ => CertifiedKey {
130
- cert : vec ! [ cert. clone( ) ] ,
130
+ cert : cert. clone ( ) ,
131
131
key :
132
132
any_supported_type ( & pki) . map_err ( |err| {
133
133
format ! (
@@ -147,7 +147,7 @@ impl Config {
147
147
148
148
// Add default certificate
149
149
let default_cert = Some ( Arc :: new ( CertifiedKey {
150
- cert : vec ! [ cert ] ,
150
+ cert,
151
151
key : any_supported_type ( & pki)
152
152
. map_err ( |err| format ! ( "Failed to sign certificate id {cert_id:?}: {err}" ) ) ?,
153
153
ocsp : None ,
You can’t perform that action at this time.
0 commit comments