2024 年 PHP 日本研討會

openssl_pkey_export_to_file

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

openssl_pkey_export_to_file將金鑰的可匯出表示形式寫入檔案

說明

openssl_pkey_export_to_file(
    #[\SensitiveParameter] OpenSSLAsymmetricKey|OpenSSLCertificate|陣列|字串 $key,
    字串 $output_filename,
    #[\SensitiveParameter] ?字串 $passphrase = null,
    ?陣列 $options = null
): 布林值

openssl_pkey_export_to_file() 將 ASCII 裝甲(PEM 編碼)格式的 key 儲存至名為 output_filename 的檔案中。

注意 您需要安裝有效的 openssl.cnf 檔案才能使此函式正常運作。詳情請參閱安裝章節下的注意事項。

參數

key

output_filename

輸出檔案的路徑。

passphrase

金鑰可以選擇性地使用 passphrase 保護。

options

options 可用於透過指定和/或覆寫 openssl 設定檔中的選項來微調匯出過程。有關 options 的詳細資訊,請參閱 openssl_csr_new()

傳回值

成功時傳回 true,失敗時傳回 false

更新日誌

版本 說明
8.0.0 key 現在接受 OpenSSLAsymmetricKeyOpenSSLCertificate 實例;先前接受類型為 OpenSSL keyOpenSSL X.509資源
新增註釋

使用者貢獻的註釋

此頁面沒有使用者貢獻的註釋。
To Top