The OID converter is a handy little tool to convert ASN.1 OIDs from readable dotted decimal notation to binary hexadecimal Distinguished Encoding Rules (DER) representation and vice versa. If you're into x.509 certificates, this may be useful to you, too.
OID encoder/decoder - v1.3 - Matthias Gaertner 1999/2001 - Freeware Usage: OID [-c|-C] [-o] {-i |1.2.3.4} converts dotted form to ASCII HEX DER output. OID -x [-o ] {-i |hex-digits} decodes ASCII HEX DER and gives dotted form.
The OID for rsaSignatureWithripemd160 is 1.3.36.3.3.1.2 (just as an example).
>oid 1.3.36.3.3.1.2
06 06 2B 24 03 03 01 02
>oid -C 1.3.36.3.3.1.2
"\x06\x06\x2B\x24\x03\x03\x01\x02"
>oid -c 1.3.36.3.3.1.2
{ 0x06, 0x06, 0x2B, 0x24, 0x03, 0x03, 0x01, 0x02 }
>oid -o r160oid.hex 1.3.36.3.3.1.2
>oid 1.3.36.3.3.1.2 > r160oid.hex
>oid -x -i r160oid.hex
UNIVERSAL OID.1.3.36.3.3.1.2
A bug was pointed out to me recently. The original version would not correctly encode OIDs that contain the component 128. Version 1.1 fixes this. As an example, v1.0 would incorrectly encode
>oid 1.3.128
06 02 2B 00
(incorrect!)
while the corrected version will encode this as
>oid 1.3.128
06 03 2B 81 00
(Thanks to Eric Grenier of Cisco for the hint, 24Mar2006)
Another bug was reported: lack of case-insensitivity when converting from hex to dotted. Only works for capital hex digits (A-F), lowercase digits (a-f) yield bad results.
>oid -x 06 02 02 0a
UNIVERSAL OID.0.2.42
(incorrect!)
while the corrected version will decode this as
UNIVERSAL OID.0.2.10
(Thanks to Hans Hudde of Cryptovision for the hint, 22Jan2014; fixed in v1.2)
Added "C" array-style output using "-c" option.
(Thanks to Ilya V. Matveychikov who contributed this improvement via GitHub, 14Oct2014)
This code was written by me, Matthias Gärtner. It is freeware. Do with it whatever you want. Use at your own risk. No warranty of any kind.
Back to main page. Back to software page.
This page was last changed on February 18th, 2021. © Matthias Gärtner 2001 |