php - 使用 PHP 从 .pfx 文件中提取序列号
问题描述
有没有一种简单的方法使用 OpenSSL 来使用 PHP 提取证书的序列号?
我尝试使用 openssl 命令将 .pfx 文件转换为 .pem 文件,但我想知道这是否可能纯粹在 PHP 内部实现。
我目前能够从 .pem/.crt 文件中读取序列号,但不能从 .pfx 文件中读取。
感谢您提供的任何帮助
解决方案
您可以使用chilkat php 扩展并使用以下代码:
include("chilkat_9_5_0.php");
$cert = new CkCert();
$pfxFilename = '/your/path/to.pfx';
$pfxPassword = 'test';
$success = $cert->LoadPfxFile($pfxFilename,$pfxPassword);
if ($success != true) {
print $cert->lastErrorText() . "\n";
exit;
}
print 'Serial Number:' . $cert->serialNumber() . "\n";
推荐阅读
- openapi - OpenAPI 规范 - 如何指定接受一系列值的输入参数
- vba - DirExist 用于 OneDrive 同步的 Sharepoint 目录
- java - Flux.subscribe(Consumer consumer>) 和 Flux.doOnNext(Consumer onNext)的区别
- java - 致命错误编译:无效标志:--release for jdk 11 on Jenkins?
- spring-boot - 如何在 Spring Boot App 中监控 HttpClientConnectionManager Metrics
- python-3.x - 用 SQLAlchemy 一次性替换大量数据?
- ios - iOS推送通知无法正常工作
- node.js - 当用户访问 expressjs 中的开放 API 路由时,有没有办法制作身份验证表单(登录弹出窗口)
- python - 了解正弦曲线的 FFT
- python - 使用具有累积值结果的另一个 dict 扩展 dict