@@ -7,7 +7,7 @@ use cryptography_x509::{
7
7
} ;
8
8
use cryptography_x509_verification:: {
9
9
ops:: { CryptoOps , VerificationCertificate } ,
10
- policy:: { ExtensionPolicy , Policy , Subject } ,
10
+ policy:: { Policy , Subject } ,
11
11
trust_store:: Store ,
12
12
types:: { DNSName , IPAddress } ,
13
13
} ;
@@ -22,7 +22,6 @@ use crate::x509::sign;
22
22
23
23
use super :: parse_general_names;
24
24
25
- #[ derive( Clone ) ]
26
25
pub ( crate ) struct PyCryptoOps { }
27
26
28
27
impl CryptoOps for PyCryptoOps {
@@ -74,8 +73,6 @@ pub(crate) struct PolicyBuilder {
74
73
time : Option < asn1:: DateTime > ,
75
74
store : Option < pyo3:: Py < PyStore > > ,
76
75
max_chain_depth : Option < u8 > ,
77
- ca_ext_policy : Option < ExtensionPolicy < PyCryptoOps > > ,
78
- ee_ext_policy : Option < ExtensionPolicy < PyCryptoOps > > ,
79
76
}
80
77
81
78
impl PolicyBuilder {
@@ -84,8 +81,6 @@ impl PolicyBuilder {
84
81
time : self . time . clone ( ) ,
85
82
store : self . store . as_ref ( ) . map ( |s| s. clone_ref ( py) ) ,
86
83
max_chain_depth : self . max_chain_depth ,
87
- ca_ext_policy : self . ca_ext_policy . clone ( ) ,
88
- ee_ext_policy : self . ee_ext_policy . clone ( ) ,
89
84
}
90
85
}
91
86
}
@@ -98,8 +93,6 @@ impl PolicyBuilder {
98
93
time : None ,
99
94
store : None ,
100
95
max_chain_depth : None ,
101
- ca_ext_policy : None ,
102
- ee_ext_policy : None ,
103
96
}
104
97
}
105
98
@@ -311,24 +304,22 @@ impl PyClientVerifier {
311
304
py_chain. append ( c. extra ( ) ) ?;
312
305
}
313
306
314
- // NOTE: The `unwrap()` cannot fail, since the underlying policy
315
- // enforces the well-formedness of the extension set.
316
- let subjects = match & chain[ 0 ]
307
+ // NOTE: These `unwrap()`s cannot fail, since the underlying policy
308
+ // enforces the presence of a SAN and the well-formedness of the
309
+ // extension set.
310
+ let leaf_san = & chain[ 0 ]
317
311
. certificate ( )
318
312
. extensions ( )
319
313
. ok ( )
320
314
. unwrap ( )
321
315
. get_extension ( & SUBJECT_ALTERNATIVE_NAME_OID )
322
- {
323
- Some ( leaf_san) => {
324
- let leaf_gns = leaf_san. value :: < SubjectAlternativeName < ' _ > > ( ) ?;
325
- Some ( parse_general_names ( py, & leaf_gns) ?)
326
- }
327
- None => None ,
328
- } ;
316
+ . unwrap ( ) ;
317
+
318
+ let leaf_gns = leaf_san. value :: < SubjectAlternativeName < ' _ > > ( ) ?;
319
+ let py_gns = parse_general_names ( py, & leaf_gns) ?;
329
320
330
321
Ok ( PyVerifiedClient {
331
- subjects,
322
+ subjects : Some ( py_gns ) ,
332
323
chain : py_chain. unbind ( ) ,
333
324
} )
334
325
}
0 commit comments