(PHP 5 >= 5.2.0, PHP 7)
openssl_csr_get_subject — ����CSR������
openssl_csr_get_subject() ����csr
��ר��������Ϣ�����⣬���а�����ͨ������ (CN), �������� (O), ������ (C) ���ֶΡ�
csr
See CSR parameters for a list of valid values.
use_shortnames
shortnames
������������������������ - ��� shortnames
Ϊ TRUE
(Ĭ��) ��ʹ�ü����ʽ���ֶν�������������ʹ��ȫ����ʽ - ���磺 CN ���� commonName �ļ����ʽ��
�ɹ�ʱ���� TRUE
�� ������ʧ��ʱ���� FALSE
��
Example #1 openssl_csr_get_subject() ����
<?php
$subject = array(
"countryName" => "CA",
"stateOrProvinceName" => "Alberta",
"localityName" => "Calgary",
"organizationName" => "XYZ Widgets Inc",
"organizationalUnitName" => "PHP Documentation Team",
"commonName" => "Wez Furlong",
"emailAddress" => "wez@example.com",
);
$private_key = openssl_pkey_new(array(
"private_key_bits" => 2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
));
$configargs = array(
'digest_alg' => 'sha512WithRSAEncryption'
);
$csr = openssl_csr_new($subject, $privkey, $configargs);
print_r(openssl_csr_get_subject($csr));
?>
�������̵���������ڣ�
Array ( [C] => CA [ST] => Alberta [L] => Calgary [O] => XYZ Widgets Inc [OU] => PHP Documentation Team [CN] => Wez Furlong [emailAddress] => wez@example.com )