Php/docs/function.openssl-csr-export-to-file

提供:Dev Guides
< Php
移動先:案内検索

openssl_csr_export_to_file

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

openssl_csr_export_to_fileCSR をファイルにエクスポートする


説明

openssl_csr_export_to_file ( mixed $csr , string $outfilename [, bool $notext = true ] ) : bool

openssl_csr_export_to_file() は、Certificate Signing Request csr を受け取り、 それを outfilename という名前のファイルに PEM フォーマットとして保存します。


パラメータ

csr
使用できる値の一覧は CSR パラメータ を参照ください。
outfilename
出力ファイルへのパス。
notext
オプションのパラメータ notext を設定すると、出力内容の冗長性が変化します。false を指定すると、 人間が読むための追加情報が出力に含まれるようになります。 notext のデフォルト値は 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 keyopenssl_csr_export_to_file($csr, 'example-csr.pem');?>

参考