openssl_csr_export_to_file
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
openssl_csr_export_to_file — CSR을 파일로 내보냅니다.
설명
openssl_csr_export_to_file(OpenSSLCertificateSigningRequest|string $csr
, string $output_filename
, bool $no_text
= true
): bool
openssl_csr_export_to_file()은 csr
이 나타내는 인증서 서명 요청을 받아 output_filename
으로 명명된 파일에 PEM 형식으로 저장합니다.
매개변수
csr
- 유효한 값 목록은 CSR 매개변수를 참조하십시오.
output_filename
- 출력 파일의 경로입니다.
no_text
- 선택적 매개변수
no_text
는 출력의 자세한 정도에 영향을 줍니다.false
인 경우 사람이 읽을 수 있는 추가 정보가 출력에 포함됩니다.no_text
의 기본값은true
입니다.
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
변경 로그
버전 | 설명 |
---|---|
8.0.0 | csr 은 이제 OpenSSLCertificateSigningRequest 인스턴스를 허용합니다. 이전에는 OpenSSL X.509 CSR 유형의 리소스가 허용되었습니다. |
Examples
예제 #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에 서명하고 인증서 생성