W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
openssl_csr_export_to_file — 將 CSR 導(dǎo)出到文件
openssl_csr_export_to_file(OpenSSLCertificateSigningRequest|string $csr, string $output_filename, bool $no_text = true): bool
openssl_csr_export_to_file() 獲取證書簽名請求()并將之保存在以 命名的 PEM 格式文件中。 csroutput_filename
csr
有關(guān)有效值的列表,請參閱 CSR 參數(shù)。
output_filename
輸出文件的路徑。
no_text
可選參數(shù) 影響輸出的冗余度。 如果設(shè)為 false
,輸出內(nèi)容將包含附加的人類可讀信息。 的缺省值為 true
。 notext
notext
成功時返回 true, 或者在失敗時返回 false。
版本 | 說明 |
---|---|
8.0.0 | csr 現(xiàn)在接受 OpenSSLCertificateSigningRequest 實例; 之前接受類型 的 resource。 OpenSSL X.509 CSR |
示例 #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');
?>
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: