使用openssl api从证书解析签名算法 [英] Parsing signature algorithm from certificate using openssl api

查看:1608
本文介绍了使用openssl api从证书解析签名算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用OpenSSL API解析此证书,而且sig_alg给我带来麻烦。

I am trying to parse this certificate using OpenSSL API and sig_alg is giving me trouble.

整个证书通过PEM_read_bio_X509调用提供给OpenSSL库,但cert-> sig_alg-> algor-> algorithm的NID,SN和LN字段都为NULL,而长度为8,数据指向8个字节,我假设持有OID。

Entire certificate is supplied to OpenSSL library via PEM_read_bio_X509 call, however NID, SN and LN fields of cert->sig_alg->algor->algorithm are all NULL, while length is 8 and data points to 8 bytes which I presume hold the OID.

所以我的问题是这个。我可以使用什么函数从OID中提取NID?

So my question is this. What function can I use to extract NID from OID?

我想我可以用 d2i_ASN1_OBJECT 认为这只是将数据复制到新的或提供的asn1对象,并不解释数据。我不相信我必须构造我自己的知名OID列表,像我认为它是做的

I thought I could do it with d2i_ASN1_OBJECT, but I think this just copies the data aray to new or supplied asn1 object and does not interpret the data. And I do not believe that I have to construct my own list of well known OIDs like i think it was done here (not actually proficient in PHP).

在一个侧面的注释中,此网站指示用户从cert-> cert_info-> key->算法。我试图从那里得到数据,但我有相同的结果。数据中的一些数据,其他位置为零。此外,这信息真的签名吗?

On a side note, this site is instructing users to extract signature from cert->cert_info->key->algor->algorithm. I have tried to get the data from there but I have the same result. Some data in data, zeroes everywhere else. Also, is this information really on signature? Judging by the names there is information about the public key in there.

推荐答案


所以我的问题是这个。我可以使用什么函数从OID中提取NID?

So my question is this. What function can I use to extract NID from OID?

我相信你正在寻找的函数是 OBJ_nid2obj OBJ_obj2nid OBJ_txt2nid 它们可以在< openssl src dir> /crypto/objects/objects.h 中找到。

I believe the functions you are looking for are OBJ_nid2obj, OBJ_obj2nid, OBJ_txt2nid and friends. They can be found in <openssl src dir>/crypto/objects/objects.h.

OpenSSL其文档位于 OBJ_nid2obj(3)

The OpenSSL docs on them are located at OBJ_nid2obj(3).

这篇关于使用openssl api从证书解析签名算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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