reference/openssl/functions/openssl-csr-get-public-key.xml
497c40ac164d5873fd87f622dfdeb5206392b446
...
...
@@ -1,23 +1,121 @@
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-public-key">
3
+
<refentry xml:id="function.openssl-csr-get-public-key" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>openssl_csr_get_public_key</refname>
6
-
<refpurpose>Returns the public key of a CERT</refpurpose>
6
+
<refpurpose>Returns the public key 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>resource</type><methodname>openssl_csr_get_public_key</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>OpenSSLAsymmetricKey</type><type>false</type></type><methodname>openssl_csr_get_public_key</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_public_key</function> extracts the public key
18
+
from <parameter>csr</parameter> and prepares it for use by other functions.
19
+
</para>
17
20
</refsect1>
18
21

19
-
</refentry>
22
+
<refsect1 role="parameters">
23
+
&reftitle.parameters;
24
+
<para>
25
+
<variablelist>
26
+
&openssl.param.csr;
27
+
<varlistentry>
28
+
<term><parameter>short_names</parameter></term>
29
+
<listitem>
30
+
<warning>
31
+
<para>
32
+
This parameter is ignored
33
+
</para>
34
+
</warning>
35
+
</listitem>
36
+
</varlistentry>
37
+
</variablelist>
38
+
</para>
39
+
</refsect1>
40
+

41
+
<refsect1 role="returnvalues">
42
+
&reftitle.returnvalues;
43
+
<para>
44
+
Returns an <classname>OpenSSLAsymmetricKey</classname> on success, or &false; on error.
45
+
</para>
46
+
</refsect1>
47
+

48
+
<refsect1 role="changelog">
49
+
&reftitle.changelog;
50
+
<informaltable>
51
+
<tgroup cols="2">
52
+
<thead>
53
+
<row>
54
+
<entry>&Version;</entry>
55
+
<entry>&Description;</entry>
56
+
</row>
57
+
</thead>
58
+
<tbody>
59
+
<row>
60
+
<entry>8.0.0</entry>
61
+
<entry>
62
+
On success, this function returns an <classname>OpenSSLAsymmetricKey</classname> instance now;
63
+
previously, a &resource; of type <literal>OpenSSL key</literal> was returned.
64
+
</entry>
65
+
</row>
66
+
<row>
67
+
<entry>8.0.0</entry>
68
+
<entry>
69
+
<parameter>csr</parameter> accepts an <classname>OpenSSLCertificateSigningRequest</classname> instance now;
70
+
previously, a &resource; of type <literal>OpenSSL X.509 CSR</literal> was accepted.
71
+
</entry>
72
+
</row>
73
+
</tbody>
74
+
</tgroup>
75
+
</informaltable>
76
+
</refsect1>
20
77
78
+
<refsect1 role="examples">
79
+
&reftitle.examples;
80
+
<para>
81
+
<example>
82
+
<title>openssl_csr_get_public_key() example</title>
83
+
<programlisting role="php">
84
+
<![CDATA[
85
+
<?php
86
+
$subject = array(
87
+
"commonName" => "example.com",
88
+
);
89
+
$private_key = openssl_pkey_new(array(
90
+
"private_key_bits" => 2048,
91
+
"private_key_type" => OPENSSL_KEYTYPE_RSA,
92
+
));
93
+
$csr = openssl_csr_new($subject, $private_key, array('digest_alg' => 'sha256') );
94
+
$public_key = openssl_csr_get_public_key($csr);
95
+
$info = openssl_pkey_get_details($public_key);
96
+
echo $info['key'];
97
+
?>
98
+
]]>
99
+
</programlisting>
100
+
</example>
101
+
</para>
102
+
</refsect1>
103
+

104
+
<refsect1 role="seealso">
105
+
&reftitle.seealso;
106
+
<para>
107
+
<simplelist>
108
+
<member><function>openssl_csr_get_subject</function></member>
109
+
<member><function>openssl_csr_new</function></member>
110
+
<member><function>openssl_pkey_get_details</function></member>
111
+
<member><function>openssl_pkey_export_to_file</function></member>
112
+
<member><function>openssl_pkey_export</function></member>
113
+
114
+
</simplelist>
115
+
</para>
116
+
</refsect1>
117
+
118
+
</refentry>
21
119
<!-- Keep this comment at the end of the file
22
120
Local variables:
23
121
mode: sgml
24
122