@@ -6,7 +6,7 @@ pub mod sequence {
66
77 use const_oid:: ObjectIdentifier ;
88 use der:: {
9- AnyRef , ClarifyFlavor , EncodeClarifyExt , Sequence , ValueOrd ,
9+ AnyRef , ClarifyFlavor , Decode , EncodeClarifyExt , Sequence , ValueOrd ,
1010 asn1:: { OctetString , SetOf } ,
1111 } ;
1212 use hex_literal:: hex;
@@ -38,7 +38,7 @@ pub mod sequence {
3838
3939 #[ test]
4040 fn clarify_simple_octetstring_javacomments ( ) {
41- let obj = OctetString :: new ( & [ 0xAA , 0xBB , 0xCC ] ) . unwrap ( ) ;
41+ let obj = OctetString :: new ( hex ! ( "AA BB CC" ) ) . unwrap ( ) ;
4242
4343 let clarified = obj
4444 . to_der_clarify ( ClarifyFlavor :: JavaComments )
@@ -52,7 +52,7 @@ pub mod sequence {
5252
5353 #[ test]
5454 fn clarify_simple_octetstring_rusthex ( ) {
55- let obj = OctetString :: new ( & [ 0xAA , 0xBB , 0xCC ] ) . unwrap ( ) ;
55+ let obj = OctetString :: new ( hex ! ( "AA BB CC" ) ) . unwrap ( ) ;
5656
5757 let clarified = obj
5858 . to_der_clarify ( ClarifyFlavor :: RustHex )
@@ -66,10 +66,12 @@ pub mod sequence {
6666
6767 #[ test]
6868 fn clarify_simple_octetstring_long_rusthex ( ) {
69- let obj = OctetString :: new ( & [
70- 0x00 , 0x11 , 0x22 , 0x33 , 0x44 , 0x55 , 0x66 , 0x77 , 0x88 , 0x99 , 0xAA , 0xBB , 0xCC , 0xDD ,
71- 0xEE , 0xFF , 0x01 ,
72- ] )
69+ let obj = OctetString :: from_der ( & hex ! (
70+ "04 11" // tag: OCTET STRING len: 17 type: OctetString
71+ "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
72+ 01"
73+ "" // end: OctetString
74+ ) )
7375 . unwrap ( ) ;
7476
7577 let clarified = obj
@@ -81,13 +83,5 @@ pub mod sequence {
8183 clarified,
8284 "\n \" 04 11\" // tag: OCTET STRING len: 17 type: OctetString \n \t \" 00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF \n \t 01\" \n \" \" // end: OctetString "
8385 ) ;
84-
85- // use-case example:
86- hex ! (
87- "04 11" // tag: OCTET STRING len: 17 type: OctetString
88- "00 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF
89- 01"
90- "" // end: OctetString
91- ) ;
9286 }
9387}
0 commit comments