Skip to content

Commit dcc7c61

Browse files
committed
Fix #65176: openssl_pkey_new / openssl_pkey_get_public
1 parent e169e63 commit dcc7c61

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

reference/openssl/functions/openssl-pkey-new.xml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: e41806c30bf6975e452c0d4ce35ab0984c2fa68c Maintainer: hirokawa Status: ready -->
3+
<!-- EN-Revision: b316a70fec35440b51c158395ecc5ac3a6e0f538 Maintainer: hirokawa Status: ready -->
44
<!-- CREDITS: takagi,mumumu -->
55
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.openssl-pkey-new">
66
<refnamediv>
@@ -16,8 +16,8 @@
1616
</methodsynopsis>
1717
<para>
1818
<function>openssl_pkey_new</function> は、
19-
新しい秘密鍵と公開鍵の鍵ペアを作成します。鍵の公開部は、
20-
<function>openssl_pkey_get_public</function> を使用して取得可能です
19+
新しい秘密鍵を生成します。
20+
鍵の公開部を取得する方法は、以下の例に示します
2121
</para>
2222
&note.openssl.cnf;
2323
</refsect1>
@@ -70,6 +70,39 @@
7070
</informaltable>
7171
</refsect1>
7272

73+
<refsect1 role="examples">
74+
&reftitle.examples;
75+
<example xml:id="function.openssl-pkey-new.example.public-key">
76+
<title>秘密鍵から、公開鍵を取得する</title>
77+
<programlisting role="php">
78+
<![CDATA[
79+
<?php
80+
$private_key = openssl_pkey_new();
81+
$public_key_pem = openssl_pkey_get_details($private_key)['key'];
82+
echo $public_key_pem;
83+
$public_key = openssl_pkey_get_public($public_key_pem);
84+
var_dump($public_key);
85+
?>
86+
]]>
87+
</programlisting>
88+
&example.outputs.similar;
89+
<screen>
90+
<![CDATA[
91+
-----BEGIN PUBLIC KEY-----
92+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArZFsmN2P6rx1Xt7YV95o
93+
gcdlal0k3ryiIhFNzjwtRNNTXfEfBr6lUuaIJYQ8/XqEBX0hpcfuuF6tTRlonA3t
94+
WLME0QFD93YVsAaXcy76YqjjqcRRodIBphAbYyyMI/lXkQAdn7kbAmr7neSOsMYJ
95+
El9Wo4Hl4oG6e52ZnYHyqW9dxh4hX93eupR2TmcCdVf+r9xoHewP0KJYSHt7vDUX
96+
AQlWYcQiWHIadFsmL0orr6mutlXFReoHbesgKY9/3YLOu0JfxflSjIZ2JeL1NTl1
97+
MsmODsUwgAUrwnWKKx+eQUP5g3GnSB3dPkRh9zRVRiLNWbCugyjrf3e6DgQWrW7j
98+
pwIDAQAB
99+
-----END PUBLIC KEY-----
100+
resource(5) of type (OpenSSL key)
101+
]]>
102+
</screen>
103+
</example>
104+
</refsect1>
105+
73106
</refentry>
74107

75108
<!-- Keep this comment at the end of the file

0 commit comments

Comments
 (0)