File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,12 @@ fn main() {
47
47
. arg (
48
48
Arg :: with_name ( "cert" )
49
49
. long ( "cert" )
50
- . help ( "The input is a Matter-encoded Certificate" ) ,
50
+ . help ( "Decode a Matter-encoded Certificate" ) ,
51
+ )
52
+ . arg (
53
+ Arg :: with_name ( "as-asn1" )
54
+ . long ( "as-asn1" )
55
+ . help ( "Decode a Matter-encoded Certificate and encode as ASN1" ) ,
51
56
)
52
57
. arg ( Arg :: with_name ( "tlvs" ) . help ( "List of TLVs" ) . required ( true ) )
53
58
. get_matches ( ) ;
@@ -88,6 +93,11 @@ fn main() {
88
93
if m. is_present ( "cert" ) {
89
94
let cert = cert:: Cert :: new ( & tlv_list[ ..index] ) . unwrap ( ) ;
90
95
println ! ( "{}" , cert) ;
96
+ } else if m. is_present ( "as-asn1" ) {
97
+ let mut asn1_cert = [ 0_u8 ; 1024 ] ;
98
+ let cert = cert:: Cert :: new ( & tlv_list[ ..index] ) . unwrap ( ) ;
99
+ let len = cert. as_asn1 ( & mut asn1_cert) . unwrap ( ) ;
100
+ println ! ( "{:02x?}" , & asn1_cert[ ..len] ) ;
91
101
} else {
92
102
tlv:: print_tlv_list ( & tlv_list[ ..index] ) ;
93
103
}
You can’t perform that action at this time.
0 commit comments