Updated example usage to include <keygen> element

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@333257 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jason Gerfen 2014-04-04 11:56:55 +00:00
parent f5fd992328
commit 71ea998616
3 changed files with 51 additions and 0 deletions

View file

@ -61,6 +61,20 @@ $pkey = openssl_pkey_new('secret password');
$spkac = openssl_spki_new($pkey, 'challenge string');
$challenge = openssl_spki_export_challenge(preg_replace('/SPKAC=/', '', $spkac));
?>
]]>
</programlisting>
</example>
<example xml:id="openssl_spki_export_challenge.example.keygen">
<title><function>openssl_spki_export_challenge</function> example from &lt;keygen&gt;</title>
<para>
Extracts the associated challenge string or NULL on failure
</para>
<programlisting role="php">
<![CDATA[
<?php
$challenge = openssl_spki_export_challenge(preg_replace('/SPKAC=/, '', $_POST['spkac']));
?>
<keygen name="spkac" challenge="challenge string" keytype="RSA">
]]>
</programlisting>
</example>

View file

@ -65,6 +65,25 @@ if ($pubKey) {
echo $pubKey;
}
?>
]]>
</programlisting>
</example>
<example xml:id="openssl_spki_export.example.keygen">
<title><function>openssl_spki_export</function> example from &lt;keygen&gt;</title>
<para>
Extracts the associated PEM formatted public key or NULL on failure
</para>
<programlisting role="php">
<![CDATA[
<?php
$spkac = openssl_spki_export(preg_replace('/SPKAC=/, '', $_POST['spkac']));
if ($spkac != NULL) {
echo $spkac;
} else {
echo "Extraction of pub key failed";
}
?>
<keygen name="spkac" challenge="challenge string" keytype="RSA">
]]>
</programlisting>
</example>

View file

@ -66,6 +66,24 @@ if (openssl_spki_verify(preg_replace('/SPKAC=/', '', $spkac))) {
echo "SPKAC validation failed";
}
?>
]]>
</programlisting>
</example>
<example xml:id="openssl_spki_verify.example.keygen">
<title><function>openssl_spki_verify</function> example from &lt;keygen&gt;</title>
<para>
Validates an existing signed public key and challenge issued from the
</para>
<programlisting role="php">
<![CDATA[
<?php
if (openssl_spki_verify(preg_replace('/SPKAC=/', '', $_POST['spkac']))) {
echo $spkac;
} else {
echo "SPKAC validation failed";
}
?>
<keygen name="spkac" challenge="challenge string" keytype="RSA">
]]>
</programlisting>
</example>