com doc/ja: Fix #65176: openssl_pkey_new / openssl_pk ey_get_public: reference/openssl/functions/openssl-pkey -new.xml
[email protected] (Yoshinari Takaoka) Wed, 13 Jan 2021 16:32:16 +0000
| Newsgroups | php.doc.ja |
|---|---|
| Message-ID | <[email protected]> |
Commit: dcc7c61f89b38575affa873e5d8337aba5523670 Author: Yoshinari Takaoka <[email protected]> Thu, 14 Jan 2021 01:32:16 +0900 Parents: e169e63bcdee7b5df81f3742860d81fdb9c9cce9 Branches: master Link: http://git.php.net/?p=doc/ja.git;a=commitdiff;h=dcc7c61f89b38575affa873e5d8337aba5523670 Log: Fix #65176: openssl_pkey_new / openssl_pkey_get_public Bugs: https://bugs.php.net/65176 Changed paths: M reference/openssl/functions/openssl-pkey-new.xml Diff: diff --git a/reference/openssl/functions/openssl-pkey-new.xml b/reference/openssl/functions/openssl-pkey-new.xml index 09a51c91af..36c216c19b 100644 --- a/reference/openssl/functions/openssl-pkey-new.xml +++ b/reference/openssl/functions/openssl-pkey-new.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- $Revision$ --> -<!-- EN-Revision: e41806c30bf6975e452c0d4ce35ab0984c2fa68c Maintainer: hirokawa Status: ready --> +<!-- EN-Revision: b316a70fec35440b51c158395ecc5ac3a6e0f538 Maintainer: hirokawa Status: ready --> <!-- CREDITS: takagi,mumumu --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.openssl-pkey-new"> <refnamediv> @@ -16,8 +16,8 @@ </methodsynopsis> <para> <function>openssl_pkey_new</function> は、 - 新しい秘密鍵と公開鍵の鍵ペアを作成します。鍵の公開部は、 - <function>openssl_pkey_get_public</function> を使用して取得可能です。 + 新しい秘密鍵を生成します。 + 鍵の公開部を取得する方法は、以下の例に示します。 </para> ¬e.openssl.cnf; </refsect1> @@ -70,6 +70,39 @@ </informaltable> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <example xml:id="function.openssl-pkey-new.example.public-key"> + <title>秘密鍵から、公開鍵を取得する</title> + <programlisting role="php"> +<![CDATA[ +<?php +$private_key = openssl_pkey_new(); +$public_key_pem = openssl_pkey_get_details($private_key)['key']; +echo $public_key_pem; +$public_key = openssl_pkey_get_public($public_key_pem); +var_dump($public_key); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArZFsmN2P6rx1Xt7YV95o +gcdlal0k3ryiIhFNzjwtRNNTXfEfBr6lUuaIJYQ8/XqEBX0hpcfuuF6tTRlonA3t +WLME0QFD93YVsAaXcy76YqjjqcRRodIBphAbYyyMI/lXkQAdn7kbAmr7neSOsMYJ +El9Wo4Hl4oG6e52ZnYHyqW9dxh4hX93eupR2TmcCdVf+r9xoHewP0KJYSHt7vDUX +AQlWYcQiWHIadFsmL0orr6mutlXFReoHbesgKY9/3YLOu0JfxflSjIZ2JeL1NTl1 +MsmODsUwgAUrwnWKKx+eQUP5g3GnSB3dPkRh9zRVRiLNWbCugyjrf3e6DgQWrW7j +pwIDAQAB +-----END PUBLIC KEY----- +resource(5) of type (OpenSSL key) +]]> + </screen> + </example> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file