mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Fix #65176: openssl_pkey_new / openssl_pkey_get_public
This commit is contained in:
parent
d278431ef5
commit
b316a70fec
1 changed files with 36 additions and 3 deletions
|
@ -13,9 +13,9 @@
|
|||
<methodparam choice="opt"><type>array</type><parameter>configargs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>openssl_pkey_new</function> generates a new private and public
|
||||
key pair. The public component of the key can be obtained using
|
||||
<function>openssl_pkey_get_public</function>.
|
||||
<function>openssl_pkey_new</function> generates a new private
|
||||
key.
|
||||
How to obtain the public component of the key is shown in an example below.
|
||||
</para>
|
||||
¬e.openssl.cnf;
|
||||
</refsect1>
|
||||
|
@ -67,6 +67,39 @@
|
|||
</informaltable>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example xml:id="function.openssl-pkey-new.example.public-key">
|
||||
<title>Obtain the public key from a private key</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
|
||||
|
|
Loading…
Reference in a new issue