Tk Library Source Code

View Ticket
Login
Ticket UUID: 1391776
Title: asn::asnObjectIdentifier incorrectly encodes OIDs
Type: Bug Version: None
Submitter: nobody Created on: 2005-12-28 07:31:44
Subsystem: asn Assigned To: mic42
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-12-31 01:38:38
Resolution: Accepted Closed By: mic42
    Closed on: 2005-12-30 16:24:41
Description:
I've found that routine asn::asnObjectIdentifier
produces incorrect encoding of OIDs, which is not
understandable by OpenSSL 0.9.8a ASN1 parser.

According to ITU-T recommendation X.690 subidentifiers
less than 128 should be encoded as one byte, but
asn.tcl version 1.7 as downloaded from CVS today,
encodes them as two bytes with first byte equal to
0x80. Some ASN1 parsers such as dumpasn1 utility,
understand this and some don't.

Example:

 $ tclsh
 % source asn.tcl
 % set bad [asn::asnObjectIdentifier {1 2 643 2 2 31 1}]
 %  foreach char [split $bad ""] { append hex [format "
     %02x" [scan $char %c]]}
 $puts $hex
06 0b 2a 85 03 80 02 80 02 80 1f 80 01

where correct encoding of this OID should be
06 07 2a 85 03 02 02 1f 01

Attached patch fixes this problem and also removes
debugging puts from asn::asnObjectIdentifier routine
User Comments: vbwagner added on 2005-12-31 01:38:38:
Logged In: YES 
user_id=757679

Thanks that you haven't forget to raise package version when
fixed this bug. Now I can package require asn 0.4.1 and be
sure that my code would throw an error rather than silently
produce incorrect data.

Happy New Year

nobody added on 2005-12-28 14:32:16:

File Added - 161266: asn_oid.patch

Attachments: