mighq Asked: 2012-07-14 03:02:38 +0800 CST2012-07-14 03:02:38 +0800 CST 2012-07-14 03:02:38 +0800 CST extracting raw ASN.1 parts from X.509 certificate 772 I'd like to extract raw hex ASN.1 data from X.509 certificate. I know, that I can do this by using DER format and hexdumping it. I'm interested in particular parts like "subject", "issuer" and their raw hex ASN1 data. openssl x509 1 Answers Voted mighq 2012-07-15T02:50:48+08:002012-07-15T02:50:48+08:00 Determine offset of interesting part by using (number in first column): openssl x509 -in crt.pem -outform der | openssl asn1parse -inform der -i For example, if "subject" entry is at offset 119. Dump raw data of that substructure: openssl x509 -in crt.pem -outform der | openssl asn1parse -inform der -i -strparse 119 -noout -out subject.raw Now print raw hex data: cat subject.raw | od --address-radix=n --format=x1 | tr -d ' \n'
Determine offset of interesting part by using (number in first column):
For example, if "subject" entry is at offset 119. Dump raw data of that substructure:
Now print raw hex data: