chris01
chris01

Reputation: 12431

OID: value is hex-coded

I try to parse a X509-issuer-string. For reasons I do not know some attributes are coded in OID.

E.g.

CN=TEST,DN=my.test.com,O=My State,C=MS,2.5.4.97=#130e414141505050

My question is about the last one. I am perfectly fine that it is not named but with the OID.

But I have no idea how to interpret the value. I expect it to be 2-digit-hex per character. But what about the first 4 numbers? That would be some control-characters.

414141505050 would be the value I expect (AAAPPP).

But what is the meaning of the first 4 bytes (130e)??

I did not find any definition of the coding of a hex-value for an OID.

I faked the values for privacy - so if it is a form of checksum it will be corrupt.

Thanks for help!

Upvotes: 1

Views: 1593

Answers (1)

bartonjs
bartonjs

Reputation: 33256

2.5.4.97 is the OID for organizationIdentifier (http://oid-info.com/get/2.5.4.97), which OpenSSL is printing as the OID because it doesn't have that in the OID to name map.

One presumes that the # is OpenSSL-ese for "this is the raw data, hex encoded". The raw value is a DER encoded value. 0x13 identifies that this is a (primitive encoding) Printable String. The next byte (0x0E) says that it is 14 bytes long.

Since your 414141505050 is only 6 bytes long, one assumes that you originally had a longer value.

Upvotes: 2

Related Questions