PHP8 openssl_pkey_export_to_file

2024-03-12 12:01 更新

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

openssl_pkey_export_to_file — 將密鑰導(dǎo)出到文件中

說(shuō)明

openssl_pkey_export_to_file(
    OpenSSLAsymmetricKey|OpenSSLCertificate|array|string $key,
    string $output_filename,
    ?string $passphrase = null,
    ?array $options = null
): bool

openssl_pkey_export_to_file() 將 ascii 格式(PEM 編碼)的 key 保存到名為 output_filename 文件中。

注意: 必須安裝有效的 openssl.cnf 以保證此函數(shù)正確運(yùn)行。參考有關(guān)安裝的說(shuō)明以獲得更多信息。

參數(shù) 

key
output_filename

輸出文件的路徑。

passphrase

密鑰可以通過(guò)值為passphrase的密碼來(lái)保護(hù)。

options

options 可以用來(lái)調(diào)整導(dǎo)出流程,通過(guò)指定或者覆蓋openssl配置文件選項(xiàng)。參見(jiàn) openssl_csr_new() 獲取更多關(guān)于 options 的信息。

返回值 

成功時(shí)返回 true, 或者在失敗時(shí)返回 false。

更新日志 

版本說(shuō)明
8.0.0key 現(xiàn)在接受 OpenSSLAsymmetricKey 或 OpenSSLCertificate 實(shí)例;之前接受類型 OpenSSL key 或 OpenSSL X.509 的 resource。


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)