Разбор DER x509 в C или C++
Я пишу программу на C/C++ на платформе Linux для анализа X509. Сейчас самое важное - это открытый ключ, но мне может понадобиться и другая информация. Я использовал код (в Open SSL) из этого поста http://www.zedwood.com/article/c-openssl-parse-x509-certificate-pem и он отлично работает, но мои сертификаты в формате DER, и я 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.
1 ответ
Просто используйте d2i_X509_bio вместо PEM_read_bio_X509 для чтения сертификата. Посмотрите, как преобразовать строку сертификата в структуру X509. и http://www.openssl.org/docs/crypto/d2i_X509.html