@@ -6,7 +6,7 @@ pub mod sequence {
6
6
7
7
use const_oid:: ObjectIdentifier ;
8
8
use der:: {
9
- AnyRef , ClarifyFlavor , EncodeClarifyExt , Sequence , ValueOrd ,
9
+ AnyRef , ClarifyFlavor , Decode , EncodeClarifyExt , Sequence , ValueOrd ,
10
10
asn1:: { OctetString , SetOf } ,
11
11
} ;
12
12
use hex_literal:: hex;
@@ -38,7 +38,7 @@ pub mod sequence {
38
38
39
39
#[ test]
40
40
fn clarify_simple_octetstring_javacomments ( ) {
41
- let obj = OctetString :: new ( & [ 0xAA , 0xBB , 0xCC ] ) . unwrap ( ) ;
41
+ let obj = OctetString :: new ( hex ! ( "AA BB CC" ) ) . unwrap ( ) ;
42
42
43
43
let clarified = obj
44
44
. to_der_clarify ( ClarifyFlavor :: JavaComments )
@@ -52,7 +52,7 @@ pub mod sequence {
52
52
53
53
#[ test]
54
54
fn clarify_simple_octetstring_rusthex ( ) {
55
- let obj = OctetString :: new ( & [ 0xAA , 0xBB , 0xCC ] ) . unwrap ( ) ;
55
+ let obj = OctetString :: new ( hex ! ( "AA BB CC" ) ) . unwrap ( ) ;
56
56
57
57
let clarified = obj
58
58
. to_der_clarify ( ClarifyFlavor :: RustHex )
@@ -66,10 +66,12 @@ pub mod sequence {
66
66
67
67
#[ test]
68
68
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
+ ) )
73
75
. unwrap ( ) ;
74
76
75
77
let clarified = obj
@@ -81,13 +83,5 @@ pub mod sequence {
81
83
clarified,
82
84
"\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 "
83
85
) ;
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
- ) ;
92
86
}
93
87
}
0 commit comments