当前位置:网站首页>php获取证书编号没有serialNumberHex只有serialNumber处理方法
php获取证书编号没有serialNumberHex只有serialNumber处理方法
2022-07-23 00:46:00 【木子李0531】
php获取证书编号没有serialNumberHex只有serialNumber处理方法
function getserialNumberHex($apiclient_cert_path){
$arr = glob($apiclient_cert_path);
$cert = '';
if(!empty($arr)){
foreach ($arr as $key => $val) {
$contents = file_get_contents($val);
$tempArr = openssl_x509_parse($contents);
$serial = $tempArr['serialNumber'];
$base = bcpow("2", "32");
$counter = 100;
$res = "";
$val = $serial;
while($counter > 0 && $val > 0) {
$counter = $counter - 1;
$tmpres = dechex(bcmod($val, $base)) . "";
/* adjust for 0's */
for ($i = 8-strlen($tmpres); $i > 0; $i = $i-1) {
$tmpres = "0$tmpres";
}
$res = $tmpres .$res;
$val = bcdiv($val, $base);
}
if ($counter <= 0) {
echo 'Occured failed.';
exit;
}
return strtoupper($res);
}
}else{
return false;
}
}边栏推荐
- 50道经典计算机网络面试题,你答得上几个?(上)
- Svg+js mouse hover parallax JS effect
- [zero based BLDC series] brushless DC motor control principle based on Hall sensor
- 推荐系统专题 | 推荐系统架构与单域跨域召回模型
- Svg+canvas canvas track JS special effect
- In depth explanation of CAS is necessary for interview practice
- og seo
- 正则表达式转换为相应的文字小工具
- Found a useful data analysis tool
- 【云原生】风云暗涌的时代,DBA们的利刃出鞘了
猜你喜欢

College students downloaded 2578 documents abnormally, and the IP of the University of Social Sciences of China was banned by a database

LiveQing直播点播流媒体OBS推流直播如何获得接口校验token视频校验streamToken及配置token有效期
![[cloud native] in the era of storm and cloud, the sharp edge of DBAs is out of the sheath](/img/22/5547663b5c0b4224d9a02d51b0f325.png)
[cloud native] in the era of storm and cloud, the sharp edge of DBAs is out of the sheath

超全PMP备考文档汇总

全新 IDEA 2022.2 正式发布,新特性很NICE

Kali 2022.2 installation

UGUI源码解析——IMaskable

AirServer第三方投屏软件v7.3.0中文版 (Airplay终端实用工具)

UGUI源码解析——StencilMaterial

DOM系列之禁止选中文字和禁止右键菜单
随机推荐
PMP一手资料、一手资讯获取
og seo
Detailed explanation of common ADB operation commands of "suggestions collection"
Practical exercise | a simple method for MySQL processlist table and Navicat monitor to identify slow queries
买reits基金一定赚钱吗 开户安全吗
disruptor框架无锁实现生产者消费者代码实例
.NET开发云原生应用,你只差给自己加个油
The most detailed explanation of the output of three numbers from large to small
【云原生】风云暗涌的时代,DBA们的利刃出鞘了
Online matting and background changing and erasing tools
Flutter 3.0
【Try to Hack】AWVS安装和简单使用
The concept and method of white box test
数论 —— 整除分块,常见经典例题。
Day05 MySql的基础使用
[Huawei online battle service] how can new players make up frames when the client quits reconnection or enters the game halfway?
Regular expression conversion to corresponding text gadget
The peak season of cross-border e-commerce is coming, remittance of international collection 0 rate will help you win the peak season!
为什么使用Well-Architected Framework?
解析steam与创客教育课堂的统筹规划