@@ -261,6 +261,10 @@ impl SimpleAsn1Writable for Null {
261261 fn write_data ( & self , _dest : & mut WriteBuf ) -> WriteResult {
262262 Ok ( ( ) )
263263 }
264+
265+ fn data_length ( & self ) -> Option < usize > {
266+ Some ( 0 )
267+ }
264268}
265269
266270impl SimpleAsn1Readable < ' _ > for bool {
@@ -357,6 +361,10 @@ impl<T: Asn1Writable> SimpleAsn1Writable for OctetStringEncoded<T> {
357361 fn write_data ( & self , dest : & mut WriteBuf ) -> WriteResult {
358362 self . 0 . write ( & mut Writer :: new ( dest) )
359363 }
364+
365+ fn data_length ( & self ) -> Option < usize > {
366+ self . 0 . encoded_length ( )
367+ }
360368}
361369
362370/// Type for use with `Parser.read_element` and `Writer.write_element` for
@@ -428,6 +436,10 @@ impl SimpleAsn1Writable for PrintableString<'_> {
428436 fn write_data ( & self , dest : & mut WriteBuf ) -> WriteResult {
429437 dest. push_slice ( self . 0 . as_bytes ( ) )
430438 }
439+
440+ fn data_length ( & self ) -> Option < usize > {
441+ Some ( self . 0 . len ( ) )
442+ }
431443}
432444
433445/// Type for use with `Parser.read_element` and `Writer.write_element` for
@@ -477,6 +489,10 @@ impl SimpleAsn1Writable for IA5String<'_> {
477489 fn write_data ( & self , dest : & mut WriteBuf ) -> WriteResult {
478490 dest. push_slice ( self . 0 . as_bytes ( ) )
479491 }
492+
493+ fn data_length ( & self ) -> Option < usize > {
494+ Some ( self . 0 . len ( ) )
495+ }
480496}
481497
482498/// Type for use with `Parser.read_element` and `Writer.write_element` for
@@ -510,6 +526,10 @@ impl SimpleAsn1Writable for Utf8String<'_> {
510526 fn write_data ( & self , dest : & mut WriteBuf ) -> WriteResult {
511527 dest. push_slice ( self . 0 . as_bytes ( ) )
512528 }
529+
530+ fn data_length ( & self ) -> Option < usize > {
531+ Some ( self . 0 . len ( ) )
532+ }
513533}
514534
515535/// Type for use with `Parser.read_element` and `Writer.write_element` for
@@ -565,6 +585,10 @@ impl SimpleAsn1Writable for VisibleString<'_> {
565585 fn write_data ( & self , dest : & mut WriteBuf ) -> WriteResult {
566586 dest. push_slice ( self . 0 . as_bytes ( ) )
567587 }
588+
589+ fn data_length ( & self ) -> Option < usize > {
590+ Some ( self . 0 . len ( ) )
591+ }
568592}
569593
570594/// Type for use with `Parser.read_element` and `Writer.write_element` for
@@ -615,6 +639,10 @@ impl SimpleAsn1Writable for BMPString<'_> {
615639 fn write_data ( & self , dest : & mut WriteBuf ) -> WriteResult {
616640 dest. push_slice ( self . as_utf16_be_bytes ( ) )
617641 }
642+
643+ fn data_length ( & self ) -> Option < usize > {
644+ Some ( self . as_utf16_be_bytes ( ) . len ( ) )
645+ }
618646}
619647
620648/// Type for use with `Parser.read_element` and `Writer.write_element` for
@@ -665,6 +693,10 @@ impl SimpleAsn1Writable for UniversalString<'_> {
665693 fn write_data ( & self , dest : & mut WriteBuf ) -> WriteResult {
666694 dest. push_slice ( self . as_utf32_be_bytes ( ) )
667695 }
696+
697+ fn data_length ( & self ) -> Option < usize > {
698+ Some ( self . as_utf32_be_bytes ( ) . len ( ) )
699+ }
668700}
669701
670702const fn validate_integer ( data : & [ u8 ] , signed : bool ) -> ParseResult < ( ) > {
@@ -1182,6 +1214,10 @@ impl SimpleAsn1Writable for UtcTime {
11821214
11831215 dest. push_byte ( b'Z' )
11841216 }
1217+
1218+ fn data_length ( & self ) -> Option < usize > {
1219+ Some ( 13 )
1220+ }
11851221}
11861222
11871223/// Used for parsing and writing ASN.1 `GENERALIZED TIME` values used in X.509.
0 commit comments