reference/openssl/functions/openssl-csr-get-subject.xml
497c40ac164d5873fd87f622dfdeb5206392b446
...
...
@@ -1,23 +1,136 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.openssl-csr-get-subject">
3
+
<refentry xml:id="function.openssl-csr-get-subject" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>openssl_csr_get_subject</refname>
6
-
<refpurpose>Returns the subject of a CERT</refpurpose>
6
+
<refpurpose>Returns the subject of a <acronym>CSR</acronym></refpurpose>
7
7
</refnamediv>
8
8

9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>array</type><methodname>openssl_csr_get_subject</methodname>
13
-
<methodparam><type>mixed</type><parameter>csr</parameter></methodparam>
14
-
<methodparam choice="opt"><type>bool</type><parameter>use_shortnames</parameter><initializer>true</initializer></methodparam>
12
+
<type class="union"><type>array</type><type>false</type></type><methodname>openssl_csr_get_subject</methodname>
13
+
<methodparam><type class="union"><type>OpenSSLCertificateSigningRequest</type><type>string</type></type><parameter>csr</parameter></methodparam>
14
+
<methodparam choice="opt"><type>bool</type><parameter>short_names</parameter><initializer>&true;</initializer></methodparam>
15
15
</methodsynopsis>
16
-
&warn.undocumented.func;
16
+
<para>
17
+
<function>openssl_csr_get_subject</function> returns subject
18
+
distinguished name information encoded in the <parameter>csr</parameter>
19
+
including fields commonName (CN), organizationName (O), countryName (C) etc.
20
+
</para>
17
21
</refsect1>
18
22

19
-
</refentry>
23
+
<refsect1 role="parameters">
24
+
&reftitle.parameters;
25
+
<para>
26
+
<variablelist>
27
+
&openssl.param.csr;
28
+
<varlistentry>
29
+
<term><parameter>short_names</parameter></term>
30
+
<listitem>
31
+
<para>
32
+
<parameter>shortnames</parameter> controls how the data is indexed in the
33
+
array - if <parameter>shortnames</parameter> is &true; (the default) then
34
+
fields will be indexed with the short name form, otherwise, the long name
35
+
form will be used - e.g.: CN is the shortname form of commonName.
36
+
</para>
37
+
</listitem>
38
+
</varlistentry>
39
+
</variablelist>
40
+
</para>
41
+
</refsect1>
42
+

43
+
<refsect1 role="returnvalues">
44
+
&reftitle.returnvalues;
45
+
<para>
46
+
Returns an associative array with subject description, &return.falseforfailure;.
47
+
</para>
48
+
</refsect1>
49
+
50
+
<refsect1 role="changelog">
51
+
&reftitle.changelog;
52
+
<informaltable>
53
+
<tgroup cols="2">
54
+
<thead>
55
+
<row>
56
+
<entry>&Version;</entry>
57
+
<entry>&Description;</entry>
58
+
</row>
59
+
</thead>
60
+
<tbody>
61
+
<row>
62
+
<entry>8.0.0</entry>
63
+
<entry>
64
+
<parameter>csr</parameter> accepts an <classname>OpenSSLCertificateSigningRequest</classname> instance now;
65
+
previously, a &resource; of type <literal>OpenSSL X.509 CSR</literal> was accepted.
66
+
</entry>
67
+
</row>
68
+
</tbody>
69
+
</tgroup>
70
+
</informaltable>
71
+
</refsect1>
20
72

73
+
<refsect1 role="examples">
74
+
&reftitle.examples;
75
+
<para>
76
+
<example>
77
+
<title>openssl_csr_get_subject() example</title>
78
+
<programlisting role="php">
79
+
<![CDATA[
80
+
<?php
81
+
$subject = array(
82
+
"countryName" => "CA",
83
+
"stateOrProvinceName" => "Alberta",
84
+
"localityName" => "Calgary",
85
+
"organizationName" => "XYZ Widgets Inc",
86
+
"organizationalUnitName" => "PHP Documentation Team",
87
+
"commonName" => "Wez Furlong",
88
+
"emailAddress" => "wez@example.com",
89
+
);
90
+
$private_key = openssl_pkey_new(array(
91
+
"private_key_bits" => 2048,
92
+
"private_key_type" => OPENSSL_KEYTYPE_RSA,
93
+
));
94
+
$configargs = array(
95
+
'digest_alg' => 'sha512WithRSAEncryption'
96
+
);
97
+
$csr = openssl_csr_new($subject, $privkey, $configargs);
98
+
print_r(openssl_csr_get_subject($csr));
99
+
?>
100
+
]]>
101
+
</programlisting>
102
+
&example.outputs.similar;
103
+
<screen>
104
+
<![CDATA[
105
+
Array
106
+
(
107
+
[C] => CA
108
+
[ST] => Alberta
109
+
[L] => Calgary
110
+
[O] => XYZ Widgets Inc
111
+
[OU] => PHP Documentation Team
112
+
[CN] => Wez Furlong
113
+
[emailAddress] => wez@example.com
114
+
)
115
+
]]>
116
+
</screen>
117
+

118
+
</example>
119
+
</para>
120
+
</refsect1>
121
+

122
+
<refsect1 role="seealso">
123
+
&reftitle.seealso;
124
+
<para>
125
+
<simplelist>
126
+
<member><function>openssl_csr_new</function></member>
127
+
<member><function>openssl_csr_get_public_key</function></member>
128
+
<member><function>openssl_x509_parse</function></member>
129
+
</simplelist>
130
+
</para>
131
+
</refsect1>
132
+

133
+
</refentry>
21
134
<!-- Keep this comment at the end of the file
22
135
Local variables:
23
136
mode: sgml
24
137