略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: openssl_pkcs12_export_to_file

2024-04-29

openssl_pkcs12_export_to_file

(PHP 5 >= 5.2.2, PHP 7, PHP 8)

openssl_pkcs12_export_to_file输出一个 PKCS#12 兼容的证书存储文件

说明

openssl_pkcs12_export_to_file(
    mixed $x509,
    string $filename,
    mixed $priv_key,
    string $pass,
    array $args = ?
): bool

openssl_pkcs12_export_to_file() 函数以 PKCS#12 格式将 x509 保存至文件名为 filename 的文件中。

参数

x509

参见密钥/证书参数以获取有效值列表。

filename

输出文件的路径。

priv_key

PKCS#12文件的私钥部分。 参见 公/私钥参数 获取可用值的列表。

pass

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

args

可选数组,其他主键将被忽略。

Key 说明
"extracerts" PKCS#12 文件中包含的额外证书或单个证书的数组。
"friendlyname" 被证书和密钥使用的字符串

返回值

成功时返回 true, 或者在失败时返回 false

add a noteadd a note

User Contributed Notes 2 notes

up
0
greejd
3 years ago
please note
the key 'friendlyname' should be 'friendly_name' in args

$args = array(
        'friendly_name'=> 'www.example.com'
);
up
0
lampacz at gmail dot com
12 years ago
[, array $args ]  can contain only: extracerts, friendly_name

extracerts - additional certificates (can be file or string)
friendly_name - "friendly name" for the certificate and private key. This name is typically displayed in list boxes by software importing the file.

based on source code version 5.2.8 and pkcs12 man page

官方地址:https://www.php.net/manual/en/function.openssl-pkcs12-export-to-file.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3