@@ -8,8 +8,8 @@ use pyo3::types::{PyAnyMethods, PyListMethods};
88use crate :: asn1:: big_byte_slice_to_py_int;
99use crate :: declarative_asn1:: types:: {
1010 check_size_constraint, is_tag_valid_for_type, is_tag_valid_for_variant, AnnotatedType ,
11- Annotation , BitString , Encoding , GeneralizedTime , IA5String , PrintableString , Type , UtcTime ,
12- Variant ,
11+ Annotation , BitString , Encoding , GeneralizedTime , IA5String , Null , PrintableString , Type ,
12+ UtcTime , Variant ,
1313} ;
1414use crate :: error:: CryptographyError ;
1515
@@ -161,6 +161,15 @@ fn decode_bitstring<'a>(
161161 ) ?)
162162}
163163
164+ fn decode_null < ' a > (
165+ py : pyo3:: Python < ' a > ,
166+ parser : & mut Parser < ' a > ,
167+ encoding : & Option < pyo3:: Py < Encoding > > ,
168+ ) -> ParseResult < pyo3:: Bound < ' a , Null > > {
169+ read_value :: < asn1:: Null > ( parser, encoding) ?;
170+ Ok ( pyo3:: Bound :: new ( py, Null { } ) ?)
171+ }
172+
164173// Utility function to handle explicit encoding when parsing
165174// CHOICE fields.
166175fn decode_choice_with_encoding < ' a > (
@@ -302,6 +311,7 @@ pub(crate) fn decode_annotated_type<'a>(
302311 Type :: UtcTime ( ) => decode_utc_time ( py, parser, encoding) ?. into_any ( ) ,
303312 Type :: GeneralizedTime ( ) => decode_generalized_time ( py, parser, encoding) ?. into_any ( ) ,
304313 Type :: BitString ( ) => decode_bitstring ( py, parser, annotation) ?. into_any ( ) ,
314+ Type :: Null ( ) => decode_null ( py, parser, encoding) ?. into_any ( ) ,
305315 } ;
306316
307317 match & ann_type. annotation . get ( ) . default {
0 commit comments