@@ -108,12 +108,11 @@ impl ClientCertVerifier for TrustDomainVerifier {
108
108
intermediates : & [ CertificateDer < ' _ > ] ,
109
109
now : UnixTime ,
110
110
) -> Result < ClientCertVerified , rustls:: Error > {
111
- Ok ( ClientCertVerified :: assertion ( ) )
112
- // let res = self
113
- // .base
114
- // .verify_client_cert(end_entity, intermediates, now)?;
115
- // self.verify_trust_domain(end_entity)?;
116
- // Ok(res)
111
+ let res = self
112
+ . base
113
+ . verify_client_cert ( end_entity, intermediates, now) ?;
114
+ self . verify_trust_domain ( end_entity) ?;
115
+ Ok ( res)
117
116
}
118
117
119
118
fn verify_tls12_signature (
@@ -122,8 +121,7 @@ impl ClientCertVerifier for TrustDomainVerifier {
122
121
cert : & CertificateDer < ' _ > ,
123
122
dss : & DigitallySignedStruct ,
124
123
) -> Result < HandshakeSignatureValid , rustls:: Error > {
125
- Ok ( HandshakeSignatureValid :: assertion ( ) )
126
- // self.base.verify_tls12_signature(message, cert, dss)
124
+ self . base . verify_tls12_signature ( message, cert, dss)
127
125
}
128
126
129
127
fn verify_tls13_signature (
@@ -132,8 +130,7 @@ impl ClientCertVerifier for TrustDomainVerifier {
132
130
cert : & CertificateDer < ' _ > ,
133
131
dss : & DigitallySignedStruct ,
134
132
) -> Result < HandshakeSignatureValid , rustls:: Error > {
135
- Ok ( HandshakeSignatureValid :: assertion ( ) )
136
- // self.base.verify_tls13_signature(message, cert, dss)
133
+ self . base . verify_tls13_signature ( message, cert, dss)
137
134
}
138
135
139
136
fn supported_verify_schemes ( & self ) -> Vec < SignatureScheme > {
@@ -188,31 +185,30 @@ pub struct IdentityVerifier {
188
185
189
186
impl IdentityVerifier {
190
187
fn verify_full_san ( & self , server_cert : & CertificateDer < ' _ > ) -> Result < ( ) , rustls:: Error > {
191
- Ok ( ( ) )
192
- // use x509_parser::prelude::*;
193
- // let (_, c) = X509Certificate::from_der(server_cert).map_err(|_e| {
194
- // rustls::Error::InvalidCertificate(rustls::CertificateError::BadEncoding)
195
- // })?;
196
- // let id = tls::certificate::identities(c).map_err(|_e| {
197
- // rustls::Error::InvalidCertificate(
198
- // rustls::CertificateError::ApplicationVerificationFailure,
199
- // )
200
- // })?;
201
- // trace!(
202
- // "verifying server identities {id:?} against {:?}",
203
- // self.identity
204
- // );
205
- // for ident in id.iter() {
206
- // if let Some(_i) = self.identity.iter().find(|id| id == &ident) {
207
- // return Ok(());
208
- // }
209
- // }
210
- // debug!("identity mismatch {id:?} != {:?}", self.identity);
211
- // Err(rustls::Error::InvalidCertificate(
212
- // rustls::CertificateError::Other(rustls::OtherError(Arc::new(DebugAsDisplay(
213
- // TlsError::SanError(self.identity.clone(), id),
214
- // )))),
215
- // ))
188
+ use x509_parser:: prelude:: * ;
189
+ let ( _, c) = X509Certificate :: from_der ( server_cert) . map_err ( |_e| {
190
+ rustls:: Error :: InvalidCertificate ( rustls:: CertificateError :: BadEncoding )
191
+ } ) ?;
192
+ let id = tls:: certificate:: identities ( c) . map_err ( |_e| {
193
+ rustls:: Error :: InvalidCertificate (
194
+ rustls:: CertificateError :: ApplicationVerificationFailure ,
195
+ )
196
+ } ) ?;
197
+ trace ! (
198
+ "verifying server identities {id:?} against {:?}" ,
199
+ self . identity
200
+ ) ;
201
+ for ident in id. iter ( ) {
202
+ if let Some ( _i) = self . identity . iter ( ) . find ( |id| id == & ident) {
203
+ return Ok ( ( ) ) ;
204
+ }
205
+ }
206
+ debug ! ( "identity mismatch {id:?} != {:?}" , self . identity) ;
207
+ Err ( rustls:: Error :: InvalidCertificate (
208
+ rustls:: CertificateError :: Other ( rustls:: OtherError ( Arc :: new ( DebugAsDisplay (
209
+ TlsError :: SanError ( self . identity . clone ( ) , id) ,
210
+ ) ) ) ) ,
211
+ ) )
216
212
}
217
213
}
218
214
0 commit comments