从ASN.1格式的证书获取DN [英] Get DN from certificate in ASN.1 format

查看:388
本文介绍了从ASN.1格式的证书获取DN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从ASN.1/DER格式的证书中获取DN.我已经搜索过OpenSSL,但仍然找不到确切的功能来获取DN.

I'm trying to get the DN from a certificate in ASN.1/DER format. I have searched OpenSSL but still cannot find the exact function to get the DN.

是否有人对此有任何经验,或者可以将我指向书籍或任何网站?

Does anyone have any experience regarding this or can point me to books or any website?

推荐答案

我已经找到了一种方法.如果有人要这样做,我就放在这里.

I already found a way to do this. I just put here if anyone want to do the same.

X509_NAME * cert_entry = X509_get_issuer_name(cert);    
unsigned char buff[100] = {0};
unsigned char * p = buff;
int i = i2d_X509_NAME(cert_entry,&p);

for(int b = 0;b<i;b++)
{       
    printf("%02X ",buff[b]);
}

这将打印六进制格式.

这篇关于从ASN.1格式的证书获取DN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆