使用 openssl API 解析证书签名请求 (CSR) [英] Parse a certificate signing request (CSR) with openssl API

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

问题描述

我在一个项目中工作,在该项目中我收到了一个 pem 格式的 .csr 文件,我需要对其进行签名以创建 x509v3 签名证书.我无法在 openssl 中使用 X509_sign() 方法,因为我需要使用第三方签名服务,我需要将数据发送到签名(在这种情况下为 .csr)文件,它会返回签名(sha256 和 rsa).

Im working in a project in which I receive a .csr file in pem format and I need to sign it in order to create a x509v3 signed certificate. I cant use the X509_sign() method in openssl because I need to use a third party signing service, I need to send the data to sign(in this case the .csr) file and it will return me the signature (sha256 with rsa).

我的主要问题是我不知道如何在内存中打开 CSR,我的意思是,我知道如何使用 openssl API 创建或加载 x509 证书,但我找不到如何加载 CSR 以便使用所有方法从 CSR 检索所有数据并将其发送到我的第三方工具进行签名.如果我可以加载 csr,我将能够对其进行签名并创建一个全新的 x509.

My main problem is that I can not figure out how to open a CSR in memory, I mean, I know how to create or load an x509 certificate using the openssl API but I cant find how to load a CSR in order to use all the methods to retrieve all the data from the CSR and send it to my third party tool to sign it. If I can load the csr, i will be able to sign it and create a brand new x509.

推荐答案

我想我找到了答案:http://www.umich.edu/~x509/ssleay/x509_reqs.html

函数为:PEM_read_X509_REQ().我还没有尝试过,但我很确定使用此函数您可以访问 CSR 数据结构,就像 PEM_read_X509() 允许您访问 x509 证书的数据结构一样.

The function is: PEM_read_X509_REQ(). I didn't try it yet, but Im pretty sure that with this function you can access to the CSR data structure as the same way as PEM_read_X509() allows you to access to the data structure of a x509 certificate.

最好的问候.

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

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