@@ -21,7 +21,9 @@ use crate::error::{DerTypeId, Error};
2121use crate :: public_values_eq;
2222use crate :: signed_data:: SignedData ;
2323use crate :: subject_name:: { GeneralName , NameIterator , WildcardDnsNameRef } ;
24- use crate :: x509:: { DistributionPointName , Extension , remember_extension, set_extension_once} ;
24+ use crate :: x509:: {
25+ DistributionPointName , Extension , ExtensionOid , remember_extension, set_extension_once,
26+ } ;
2527
2628/// A parsed X509 certificate.
2729pub struct Cert < ' a > {
@@ -263,25 +265,27 @@ fn remember_cert_extension<'a>(
263265 // all policy-related stuff. We assume that the policy-related extensions
264266 // are not marked critical.
265267
268+ use ExtensionOid :: * ;
269+
266270 remember_extension ( extension, |id| {
267271 let out = match id {
268272 // id-ce-keyUsage 2.5.29.15.
269- 15 => & mut cert. key_usage ,
273+ Standard ( 15 ) => & mut cert. key_usage ,
270274
271275 // id-ce-subjectAltName 2.5.29.17
272- 17 => & mut cert. subject_alt_name ,
276+ Standard ( 17 ) => & mut cert. subject_alt_name ,
273277
274278 // id-ce-basicConstraints 2.5.29.19
275- 19 => & mut cert. basic_constraints ,
279+ Standard ( 19 ) => & mut cert. basic_constraints ,
276280
277281 // id-ce-nameConstraints 2.5.29.30
278- 30 => & mut cert. name_constraints ,
282+ Standard ( 30 ) => & mut cert. name_constraints ,
279283
280284 // id-ce-cRLDistributionPoints 2.5.29.31
281- 31 => & mut cert. crl_distribution_points ,
285+ Standard ( 31 ) => & mut cert. crl_distribution_points ,
282286
283287 // id-ce-extKeyUsage 2.5.29.37
284- 37 => & mut cert. eku ,
288+ Standard ( 37 ) => & mut cert. eku ,
285289
286290 // Unsupported extension
287291 _ => return extension. unsupported ( ) ,
@@ -291,7 +295,7 @@ fn remember_cert_extension<'a>(
291295 extension. value . read_all ( Error :: BadDer , |value| match id {
292296 // Unlike the other extensions we remember KU is a BitString and not a Sequence. We
293297 // read the raw bytes here and parse at the time of use.
294- 15 => Ok ( value. read_bytes_to_end ( ) ) ,
298+ Standard ( 15 ) => Ok ( value. read_bytes_to_end ( ) ) ,
295299 // All other remembered certificate extensions are wrapped in a Sequence.
296300 _ => der:: expect_tag ( value, Tag :: Sequence ) ,
297301 } )
0 commit comments