首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

openssl_pkcs12_read

(PHP 5 >= 5.2.2, PHP 7)

openssl_pkcs12_read - 将 PKCS#12证书存储解析为数组

描述

代码语言:javascript
复制
bool openssl_pkcs12_read ( string $pkcs12 , array &$certs , string $pass )

openssl_pkcs12_read()将提供的 PKCS#12证书存储解析pkcs12到名为certs的数组中。

参数

pkcs12

证书存储内容,而不是其文件名。

certs

成功时,这将保存证书存储数据。

pass

用于解锁 PKCS#12文件的加密密码。

返回值

成功时返回TRUE或失败时返回FALSE

示例

示例 #1 openssl_pkcs12_read()示例

代码语言:javascript
复制
<?php
if (!$cert_store = file_get_contents("/certs/file.p12")) {
    echo "Error: Unable to read the cert file\n";
    exit;
}

if (openssl_pkcs12_read($cert_store, $cert_info, "my_secret_pass")) {
    echo "Certificate Information\n";
    print_r($cert_info);
} else {
    echo "Error: Unable to read the cert store.\n";
    exit;
}
?>

← openssl_pkcs12_export

openssl_pkcs7_decrypt →

扫码关注腾讯云开发者

领取腾讯云代金券