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() 锟斤拷取证锟斤拷签锟斤拷锟斤拷锟斤拷(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');
?>

锟轿硷拷

  • openssl_csr_export() - 锟斤拷CSR锟斤拷为锟街凤拷锟斤拷锟斤拷锟斤拷
  • openssl_csr_new() - 锟斤拷锟斤拷一锟斤拷 CSR
  • openssl_csr_sign() - 锟斤拷锟斤拷一锟斤拷证锟斤拷签锟斤拷 CSR (锟斤拷锟竭憋拷锟斤拷) 锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷证锟斤拷