当前位置:网站首页>PHP gets the certificate number. There is no serialnumberhex, but only the serialnumber processing method
PHP gets the certificate number. There is no serialnumberhex, but only the serialnumber processing method
2022-07-23 09:12:00 【Muzi Li 0531】
php No certificate number obtained serialNumberHex Only serialNumber processing method
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;
}
}边栏推荐
- UGUI源码解析——MaskableGraphic
- Sort out 55 MySQL interview questions (including answers)
- 在线抠图和换背景及擦除工具
- php获取证书编号没有serialNumberHex只有serialNumber处理方法
- 【并发编程】第二章:从核心源码深入ReentrantLock锁
- IDM下载器免费高质量的Win下载工具无使用限制
- 驱动单片机硬件调试器的一些开源库总结(包含stlink调试器)
- UGUI源码解析——IClippable
- Unity3d learning note 9 - loading textures
- 砥砺前行新征程,城链科技狂欢庆典在厦门隆重举行
猜你喜欢

UGUI源码解析——MaskableGraphic

万物互联时代,看IoT测试如何应对“芯”挑战

Summary of some open source libraries that drive MCU hardware debugger (including stlink debugger)

UGUI源码解析——Mask

砥砺前行新征程,城链科技狂欢庆典在厦门隆重举行

IDM下载器免费高质量的Win下载工具无使用限制

数学建模——插值拟合

Found a useful data analysis tool

UGUI源码解析——IMaterialModifier

No requirement document, reject development?
随机推荐
7. Image data processing of paddlepaddle
UGUI源码解析——IMaterialModifier
SQL Server database design -- select statement
Construction of mGRE network
DOM系列之禁止选中文字和禁止右键菜单
软件测试面试思路技巧和方法分享,学到就是赚到
Internet download manager is simply a killer of downloaders
Unity中实现判断Missing还是Null
SPSS Chi-Square
Day3 POC and exp learning Pikachu brute force cracking with token
makefile中include的作用
Is it safe to open an account online? How about Galaxy Securities
驱动单片机硬件调试器的一些开源库总结(包含stlink调试器)
LiveQing直播点播流媒体OBS推流直播如何获得接口校验token视频校验streamToken及配置token有效期
正则表达式转换为相应的文字小工具
Family fraud is prevalent, and Sogou number builds a security firewall
Geely Xingrui: from product technology empowerment to cultural confidence
IDM下载器免费高质量的Win下载工具无使用限制
[try to hack] awvs installation and simple use
PMP备考心得 | 好的习惯、好的过程、好的结果