解析/验证 CSR 代码
我正在使用 trustico.com 经销商 api 来处理 ssl 证书。但有趣的是,我找不到任何工具来解析 CSR 代码以获取审批者电子邮件列表。 tructico api 中只有一个工具需要域名来获取列表。
我的问题是有没有任何工具可以解析 PHP 中的 CSR 代码以获得关联的域名?或者 trustico api 给我一个获得它的机会吗?
预先感谢
编辑:(我无法将此写为答案,因此我编辑我的问题)
我进行了另一次搜索,找到了这个在线 csr 验证工具:
https://secure.comodo.net/utilities/decodeCSR.html
它还为您提供了一个 api,您可以在本地进行查询。文档在这里:
https://secure.comodo.net/api/pdf /DecodeCSR%20v1.06.pdf
我为自己编写了它以获得域名。如果给出的 csr 代码正确,则代码返回完整域,如果不正确,则返回“1”。我希望它能帮助有需要的人:
function ssl_getCN($csr) {
$api_url = "http://secure.comodo.net/products/!DecodeCSR";
$fields = array('csr' =>$csr,
'showCN'=>'Y',
'showErrorCodes'=>'N',
'showErrorMessages'=>'N',
'showFieldNames'=>'N',
'showEmptyFields'=>'N',
'showEmptyFields'=>'N',
'showAddress'=>'N',
'showPublicKey'=>'N',
'showKeySize'=>'N',
'showSANDNSNames'=>'N',
'showCS'=>'N'
);
// URL Encode Values
$query_string = http_build_query($fields);
// Initiate CURL POST call
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $api_url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
curl_setopt ($ch, CURLOPT_POST,count($fields));
curl_setopt ($ch, CURLOPT_POSTFIELDS,$query_string);
$result = curl_exec ($ch);
curl_close($ch);
return $result;
}
I'm using trustico.com reseller api in order to process ssl certificates. But interestingly I couldn't find any tool for parse CSR code for getting approver email list. There is only one tool in tructico api that requires domain name for getting list.
My question is there any tool for parsing CSR code in PHP in order to get associated domain name? or does trustico api give me a chance to get it?
Thanks in advance
edit: (I coulnt write this as an aswer, so I edit my question)
I make another search and I find this online csr validation tool :
https://secure.comodo.net/utilities/decodeCSR.html
it also gives you an api which you can make queries locally. documentation is here :
https://secure.comodo.net/api/pdf/DecodeCSR%20v1.06.pdf
I wrote it for myself in order to get domain. if csr code is given is correct code returns full domain, if it's not code returns "1". I hope it helps someone needs :
function ssl_getCN($csr) {
$api_url = "http://secure.comodo.net/products/!DecodeCSR";
$fields = array('csr' =>$csr,
'showCN'=>'Y',
'showErrorCodes'=>'N',
'showErrorMessages'=>'N',
'showFieldNames'=>'N',
'showEmptyFields'=>'N',
'showEmptyFields'=>'N',
'showAddress'=>'N',
'showPublicKey'=>'N',
'showKeySize'=>'N',
'showSANDNSNames'=>'N',
'showCS'=>'N'
);
// URL Encode Values
$query_string = http_build_query($fields);
// Initiate CURL POST call
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $api_url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
curl_setopt ($ch, CURLOPT_POST,count($fields));
curl_setopt ($ch, CURLOPT_POSTFIELDS,$query_string);
$result = curl_exec ($ch);
curl_close($ch);
return $result;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论