openssl_csr_export_to_file
(PHP 4 >= 4.2.0, PHP 5, PHP 7)
openssl_csr_export_to_file — CSR をファイルにエクスポートする
説明
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');?>
参考
- openssl_csr_export() - CSR を文字列としてエクスポートする
- openssl_csr_new() - CSR を作成する
- openssl_csr_sign() - CSRに他の証明書(あるいは自分自身)で署名して証明書を作成する