Closed Bug 302058 Opened 15 years ago Closed 14 years ago

make pretty print utility print hex data in case when data type was not recognized

Categories

(NSS :: Tools, defect, P3)

3.10
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: alvolkov.bgs, Assigned: alvolkov.bgs)

Details

Attachments

(2 files, 1 obsolete file)

Currently pp only issues a warning message if the supplied data type is not one
of the following: SEC_CT_CERTIFICATE, SEC_CT_CERTIFICATE_REQUEST, SEC_CT_CRL,
SEC_CT_PRIVATE_KEY, SEC_CT_PUBLIC_KEY, SEC_CT_PKCS7
Attached patch the patch (obsolete) — Splinter Review
Attachment #190431 - Flags: review?(nelson)
Comment on attachment 190431 [details] [diff] [review]
the patch

Please try to use SECU_PrintAny here, rather than SECU_PrintAsHex.  
If SECU_PrintAny cannot be used here for any reason, please explain why
not in this bug.  Thanks.

>+	SECU_PrintAsHex(outFile, &data, "Hex Info", 0);
Assignee: wtchang → alexei.volkov.bugs
Comment on attachment 190431 [details] [diff] [review]
the patch

Sorry, I should have marked this r- when I reviewed it on 7-25-05.  Please see
my review comments from that date.
Attachment #190431 - Flags: review?(nelson) → review-
My mistake. I was interested in hex info at the time, so stopped short of using
PrintAny.

No problem with the function. It actually provides more detailed analysis of
hex data, that is match better than just printing hex data.
Attachment #190431 - Attachment is obsolete: true
Attachment #193104 - Flags: review?(nelson)
Comment on attachment 193104 [details] [diff] [review]
the uses SECU_PrintAny instead of SECU_PrintHex

Alexei, please attach to this bug a text file containing the output from pp
using this latest patch and this PrintAny call.
volkov@goa1$ pp -t NONE -i ../crmftest2/test.der 
pp: don't know how to print out 'NONE' files
File contains: Sequence {
    (empty)
    41:64:64:20:4e:65:78:74:20:53:74:72:69:6e:67:00
    00:00
    31 (0x1f)
    00:00
}
volkov@goa1$ pp -t NONE -i ../asn1dg/der.0 
pp: don't know how to print out 'NONE' files
File contains:
    1e:70:5e:e5:87:5e:b1:a9:04:f5:4f:bd:f3:32:52:83:
    d3:26:0d:ec:9a:6b:85:94:91:5f:0e:17:98:9c
Printout of TestCA.ca.cert file: DER of CA certificate generated by cert.sh
Correcponded output of the same files(see comment#6) by dumpasn1.

volkov@goa1$ asn1dump ../crmftest2/test.der
   0 NDEF: SEQUENCE {
   2 NDEF:   OCTET STRING {
   4   16:     OCTET STRING 'AdNx tig'
         :     }
  24    1:   INTEGER 31
         :   }

volkov@goa1$ asn1dump ../asn1dgen/der.0
   0   15: OCTET STRING 18 0F A0 6C 85 F6 23 B7 9B CF 60 71 7D 10 25

Comment on attachment 193104 [details] [diff] [review]
the uses SECU_PrintAny instead of SECU_PrintHex

Thanks for that info.  I understand now why the output of PrintAny looked so
wrong for your test file ../crmftest2/test.der.   That file contains BER with
indefinite length encoding.  The recursive descent parser in PrintAny gets 
confused by this.  That's a bug in that parser, which is a separate issue
outside of the scope of this bug.  

Go ahead and check in the change in this patch, on the trunk.
Attachment #193104 - Flags: review?(nelson) → review+
Priority: -- → P3
Target Milestone: --- → 3.11
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.