@@ -13,9 +13,10 @@ use cryptography_x509::certificate::Certificate as RawCertificate;
1313use cryptography_x509:: common:: { AlgorithmParameters , Asn1ReadableOrWritable } ;
1414use cryptography_x509:: extensions:: {
1515 AuthorityKeyIdentifier , BasicConstraints , DisplayText , DistributionPoint ,
16- DistributionPointName , IssuerAlternativeName , KeyUsage , MSCertificateTemplate , NameConstraints ,
17- PolicyConstraints , PolicyInformation , PolicyQualifierInfo , Qualifier , RawExtensions ,
18- SequenceOfAccessDescriptions , SequenceOfSubtrees , UserNotice ,
16+ DistributionPointName , DuplicateExtensionsError , IssuerAlternativeName , KeyUsage ,
17+ MSCertificateTemplate , NameConstraints , PolicyConstraints , PolicyInformation ,
18+ PolicyQualifierInfo , Qualifier , RawExtensions , SequenceOfAccessDescriptions ,
19+ SequenceOfSubtrees , UserNotice ,
1920} ;
2021use cryptography_x509:: extensions:: { Extension , SubjectAlternativeName } ;
2122use cryptography_x509:: { common, oid} ;
@@ -129,18 +130,14 @@ impl Certificate {
129130
130131 #[ getter]
131132 fn issuer < ' p > ( & self , py : pyo3:: Python < ' p > ) -> pyo3:: PyResult < & ' p pyo3:: PyAny > {
132- Ok (
133- x509:: parse_name ( py, & self . raw . borrow_dependent ( ) . tbs_cert . issuer )
134- . map_err ( |e| e. add_location ( asn1:: ParseLocation :: Field ( "issuer" ) ) ) ?,
135- )
133+ Ok ( x509:: parse_name ( py, self . raw . borrow_dependent ( ) . issuer ( ) )
134+ . map_err ( |e| e. add_location ( asn1:: ParseLocation :: Field ( "issuer" ) ) ) ?)
136135 }
137136
138137 #[ getter]
139138 fn subject < ' p > ( & self , py : pyo3:: Python < ' p > ) -> pyo3:: PyResult < & ' p pyo3:: PyAny > {
140- Ok (
141- x509:: parse_name ( py, & self . raw . borrow_dependent ( ) . tbs_cert . subject )
142- . map_err ( |e| e. add_location ( asn1:: ParseLocation :: Field ( "subject" ) ) ) ?,
143- )
139+ Ok ( x509:: parse_name ( py, self . raw . borrow_dependent ( ) . subject ( ) )
140+ . map_err ( |e| e. add_location ( asn1:: ParseLocation :: Field ( "subject" ) ) ) ?)
144141 }
145142
146143 #[ getter]
@@ -160,7 +157,7 @@ impl Certificate {
160157 let val = self . raw . borrow_dependent ( ) ;
161158 let mut tbs_precert = val. tbs_cert . clone ( ) ;
162159 // Remove the SCT list extension
163- match val. tbs_cert . extensions ( ) {
160+ match val. extensions ( ) {
164161 Ok ( extensions) => {
165162 let ext_count = extensions
166163 . as_raw ( )
@@ -185,10 +182,10 @@ impl Certificate {
185182 let result = asn1:: write_single ( & tbs_precert) ?;
186183 Ok ( pyo3:: types:: PyBytes :: new ( py, & result) )
187184 }
188- Err ( oid) => {
185+ Err ( DuplicateExtensionsError ( oid) ) => {
189186 let oid_obj = oid_to_py_oid ( py, & oid) ?;
190187 Err ( exceptions:: DuplicateExtension :: new_err ( (
191- format ! ( "Duplicate {} extension found" , oid) ,
188+ format ! ( "Duplicate {} extension found" , & oid) ,
192189 oid_obj. into_py ( py) ,
193190 ) )
194191 . into ( ) )
0 commit comments