openssl_csr_export_to_file
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
openssl_csr_export_to_file - 将 CSR 导出到文件
描述
bool openssl_csr_export_to_file ( mixed $csr , string $outfilename [, bool $notext = true ] )
openssl_csr_export_to_file()采用由csr
PEM 格式表示的证书签名请求并将其保存为名为outfilename
的文件。
参数
csr
请参阅 CSR 参数以获取有效值列表。
outfilename
输出文件的路径。
notext
可选参数notext
影响输出的详细程度; 如果是FALSE
,则输出中会包含额外的人类可读信息。notext
is 的默认值TRUE
。
返回值
TRUE
成功或FALSE
失败时返回。
例子
示例#1 openssl_csr_export_to_file()示例
<?php
$subject?=?array(
????"commonName"?=>?"example.com",
);
$private_key?=?openssl_pkey_new(array(
????"private_key_bits"?=>?2048,
????"private_key_type"?=>?OPENSSL_KEYTYPE_RSA,
));
$csr?=?openssl_csr_new($subject,?$private_key,?array('digest_alg'?=>?'sha384')?);
openssl_pkey_export_to_file($private_key,?'example-priv.key');
//?Along?with?the?subject,?the?CSR?contains?the?public?key?corresponding?to?the?private?key
openssl_csr_export_to_file($csr,?'example-csr.pem');
?>
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com