@@ -752,63 +752,17 @@ mod decode_value {
752
752
753
753
/// Custom derive test cases for the `DecodeValue` + `EncodeValue` macro combo.
754
754
mod decode_encode_value {
755
- use der:: {
756
- DecodeValue , EncodeValue , Header , IsConstructed , Length , SliceReader , SliceWriter , Tag ,
757
- TagNumber ,
758
- } ;
755
+ use der:: { DecodeValue , EncodeValue , IsConstructed } ;
759
756
760
757
/// Example of a structure, that does not have a tag and is not a sequence
758
+ /// but can be encoded as `[0] IMPLICIT`
761
759
#[ derive( DecodeValue , EncodeValue , Default , Eq , PartialEq , Debug ) ]
762
- #[ asn1( tag_mode = "IMPLICIT" ) ]
763
- struct DecodeEncodeCheck < ' a > {
764
- #[ asn1( type = "OCTET STRING" , context_specific = "5" ) ]
765
- field : & ' a [ u8 ] ,
760
+ struct DecodeEncodeCheck {
761
+ field : bool ,
766
762
}
767
- impl IsConstructed for DecodeEncodeCheck < ' _ > {
763
+ impl IsConstructed for DecodeEncodeCheck {
768
764
const CONSTRUCTED : bool = true ;
769
765
}
770
-
771
- // TODO(dishmaker): fix test after IMPLICIT/EXPLICIT trait split
772
- // #[derive(Sequence, Default, Eq, PartialEq, Debug)]
773
- // #[asn1(tag_mode = "IMPLICIT")]
774
- // struct ImplicitWrapper<'a> {
775
- // #[asn1(context_specific = "0")]
776
- // implicit_decode_encode: DecodeEncodeCheck<'a>,
777
- // }
778
-
779
- #[ test]
780
- fn sequence_decode_encode_custom_implicit ( ) {
781
- // TODO(dishmaker): fix test after IMPLICIT/EXPLICIT trait split
782
- // let obj = ImplicitWrapper {
783
- // implicit_decode_encode: DecodeEncodeCheck {
784
- // field: &[0x33, 0x44],
785
- // },
786
- // };
787
-
788
- // let der_encoded = obj.to_der().unwrap();
789
-
790
- // assert_eq!(der_encoded, hex!("80 04 85 02 33 44"));
791
- // let obj_decoded = ImplicitWrapper::from_der(&der_encoded);
792
- // assert_eq!(obj, obj_decoded);
793
-
794
- let header = Header {
795
- tag : Tag :: ContextSpecific {
796
- constructed : true ,
797
- number : TagNumber ( 0 ) ,
798
- } ,
799
- length : Length :: new ( 6u16 ) ,
800
- } ;
801
- let obj = DecodeEncodeCheck {
802
- field : & [ 0x33 , 0x44 ] ,
803
- } ;
804
-
805
- let mut buf = [ 0u8 ; 100 ] ;
806
- let mut writer = SliceWriter :: new ( & mut buf) ;
807
- obj. encode_value ( & mut writer) . unwrap ( ) ;
808
-
809
- let mut reader = SliceReader :: new ( & buf) . unwrap ( ) ;
810
- let _ = DecodeEncodeCheck :: decode_value ( & mut reader, header) ;
811
- }
812
766
}
813
767
814
768
/// Custom derive test cases for the `BitString` macro.
0 commit comments