
openssl_x509_parse 함수는 SSL/TLS 인증서를 분석하여 반환하는 associative array입니다.
'subject' 항목은 인증서의 소유자 정보를 나타냅니다. 예를 들어, 인증서의 주체는 'example.com' 이라고 가정할 때, 'subject' 항목은 다음과 같이 나타납니다.
#hostingforum.kr
php
array (
'commonName' => 'example.com',
'organizationName' => 'Example Company',
'organizationalUnitName' => 'IT Department',
'emailAddress' => 'admin@example.com',
// ...
)
'issuer' 항목은 인증서를 발급한 기관의 정보를 나타냅니다. 예를 들어, 인증서를 발급한 기관이 'VeriSign' 이라고 가정할 때, 'issuer' 항목은 다음과 같이 나타납니다.
#hostingforum.kr
php
array (
'countryName' => 'US',
'organizationName' => 'VeriSign, Inc.',
'organizationalUnitName' => 'VeriSign Trust Network',
'emailAddress' => 'verisign@verisign.com',
// ...
)
openssl_x509_parse 함수를 사용하여 인증서의 'subject'와 'issuer' 항목을 얻으려면, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$x509 = openssl_x509_parse($cert);
echo "주체 정보:n";
print_r($x509['subject']);
echo "n발급 기관 정보:n";
print_r($x509['issuer']);
이러한 코드를 실행하면, 인증서의 'subject'와 'issuer' 항목이 출력됩니다.
2025-06-26 00:43