I am writting a program in C/C++ on a linux plattofrm to parse X509. Most importantly right now is the public key but I might need other info as well. I have used the code (in Open SSL) from this post http://www.zedwood.com/article/c-openssl-parse-x509-certificate-pem and it works fine, but my certifcates are in DER format and I therefore need to convert them prior to this (which I can do in the command prompt). What I need is to do this conversion in code, or other code that does the same on DER certificate directly. I have tried to replace som components in the code to make it DER instad of PEM but no luck (have been trying to use some id2 commands but I am not even sure if that is correct). Any help would be apprectiated.
Asked
Active
Viewed 7,187 times
1 Answers
0
simply use d2i_X509_bio instead of PEM_read_bio_X509 to read the certificate. See how to convert the Certificate String into X509 structure.? and http://www.openssl.org/docs/crypto/d2i_X509.html

Community
- 1
- 1

Steffen Ullrich
- 114,247
- 10
- 131
- 172
-
Thank you very much this lead me in the right direcion (ended up using a file pointer). – user3231095 Jan 27 '14 at 11:25