<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Exports the challenge assoicated with a signed public key and challenge</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-sign.html">openssl_sign</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.openssl-spki-export.html">openssl_spki_export</a></div> <div class="up"><a href="ref.openssl.html">OpenSSL Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.openssl-spki-export-challenge" class="refentry"> <div class="refnamediv"> <h1 class="refname">openssl_spki_export_challenge</h1> <p class="verinfo">(PHP 5 >= 5.6.0, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_spki_export_challenge</span> — <span class="dc-title">Exports the challenge assoicated with a signed public key and challenge</span></p> </div> <div class="refsect1 description" id="refsect1-function.openssl-spki-export-challenge-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>openssl_spki_export_challenge</strong></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$spkac</code></span> )</div> <p class="para rdfs-comment"> Exports challenge from encoded signed public key and challenge </p> </div> <div class="refsect1 parameters" id="refsect1-function.openssl-spki-export-challenge-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <code class="parameter">spkac</code></dt> <dd> <p class="para"> Expects a valid signed public key and challenge </p> </dd> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-function.openssl-spki-export-challenge-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the associated challenge string or NULL on failure. </p> </div> <div class="refsect1 errors" id="refsect1-function.openssl-spki-export-challenge-errors"> <h3 class="title">Errors/Exceptions</h3> <p class="para"> Emits an <strong><code>E_WARNING</code></strong> level error if an invalid argument is passed via the <code class="parameter">spkac</code> parameter. </p> </div> <div class="refsect1 examples" id="refsect1-function.openssl-spki-export-challenge-examples"> <h3 class="title">Examples</h3> <div class="example" id="example-982"> <p><strong>Example #1 <span class="function"><strong>openssl_spki_export_challenge()</strong></span> example</strong></p> <div class="example-contents"><p> Extracts the associated challenge string or NULL on failure. </p></div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$pkey </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_pkey_new</span><span style="color: #007700">(</span><span style="color: #DD0000">'secret password'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$spkac </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_spki_new</span><span style="color: #007700">(</span><span style="color: #0000BB">$pkey</span><span style="color: #007700">, </span><span style="color: #DD0000">'challenge string'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$challenge </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_spki_export_challenge</span><span style="color: #007700">(</span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'/SPKAC=/'</span><span style="color: #007700">, </span><span style="color: #DD0000">''</span><span style="color: #007700">, </span><span style="color: #0000BB">$spkac</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> <div class="example" id="example-983"> <p><strong>Example #2 <span class="function"><strong>openssl_spki_export_challenge()</strong></span> example from <keygen></strong></p> <div class="example-contents"><p> Extracts the associated challenge string issued from the <keygen> element </p></div> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$challenge </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_spki_export_challenge</span><span style="color: #007700">(</span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'/SPKAC=/'</span><span style="color: #007700">, </span><span style="color: #DD0000">''</span><span style="color: #007700">, </span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'spkac'</span><span style="color: #007700">]));<br /></span><span style="color: #0000BB">?><br /></span><keygen name="spkac" challenge="challenge string" keytype="RSA"></span> </code></div> </div> </div> </div> <div class="refsect1 seealso" id="refsect1-function.openssl-spki-export-challenge-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><span class="function"><a href="function.openssl-spki-new.html" class="function" rel="rdfs-seeAlso">openssl_spki_new()</a> - Generate a new signed public key and challenge</span></li> <li class="member"><span class="function"><a href="function.openssl-spki-verify.html" class="function" rel="rdfs-seeAlso">openssl_spki_verify()</a> - Verifies a signed public key and challenge</span></li> <li class="member"><span class="function"><a href="function.openssl-spki-export.html" class="function" rel="rdfs-seeAlso">openssl_spki_export()</a> - Exports a valid PEM formatted public key signed public key and challenge</span></li> <li class="member"><span class="function"><strong>openssl_md_method()</strong></span></li> <li class="member"><span class="function"><a href="function.openssl-csr-new.html" class="function" rel="rdfs-seeAlso">openssl_csr_new()</a> - Generates a CSR</span></li> <li class="member"><span class="function"><a href="function.openssl-csr-sign.html" class="function" rel="rdfs-seeAlso">openssl_csr_sign()</a> - Sign a CSR with another certificate (or itself) and generate a certificate</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-sign.html">openssl_sign</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.openssl-spki-export.html">openssl_spki_export</a></div> <div class="up"><a href="ref.openssl.html">OpenSSL Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>