(PHP 4 >= 4.2.0, PHP 5, PHP 7)
openssl_csr_export_to_file — 锟斤拷CSR锟斤拷锟斤拷锟斤拷锟侥硷拷
openssl_csr_export_to_file() 锟斤拷取证锟斤拷签锟斤拷锟斤拷锟斤拷(csr
) 锟斤拷锟斤拷之锟斤拷锟斤拷锟斤拷锟斤拷 outfilename
锟斤拷锟斤拷锟斤拷PEM锟斤拷式锟侥硷拷锟叫★拷
csr
See CSR parameters for a list of valid values.
outfilename
锟斤拷锟斤拷募锟斤拷锟铰凤拷锟斤拷锟�
notext
锟斤拷选锟斤拷锟斤拷 notext
影锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟饺★拷锟斤拷锟斤拷锟轿�
FALSE
锟斤拷锟斤拷锟斤拷锟斤拷萁锟斤拷锟斤拷锟斤拷锟斤拷拥锟斤拷锟斤拷锟缴讹拷锟斤拷息锟斤拷notext
锟斤拷缺省值为 TRUE
锟斤拷
锟缴癸拷时锟斤拷锟斤拷 TRUE
锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE
锟斤拷
Example #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');
?>