Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 5502

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!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>Generate a new 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-spki-export.html">openssl_spki_export</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.openssl-spki-verify.html">openssl_spki_verify</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-new" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_spki_new</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.6.0, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_spki_new</span> &mdash; <span class="dc-title">Generate a new signed public key and challenge</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-spki-new-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>openssl_spki_new</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter reference">&$privkey</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$challenge</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$algorithm</code><span class="initializer"> = 0</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Generates a signed public key and challenge using specified hashing algorithm
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-spki-new-parameters">
  <h3 class="title">Parameters</h3>
  <dl>

   
     <dt>
<code class="parameter">privkey</code></dt>

     <dd>

      <p class="para">
       <code class="parameter">privkey</code> should be set to a private key that was
       previously generated by <span class="function"><a href="function.openssl-pkey-new.html" class="function">openssl_pkey_new()</a></span> (or
       otherwise obtained from the other openssl_pkey family of functions).
       The corresponding public portion of the key will be used to sign the
       CSR.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">challenge</code></dt>

     <dd>

      <p class="para">
       The challenge associated to associate with the SPKAC
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">algorithm</code></dt>

     <dd>

      <p class="para">
       The digest algorithm. See openssl_get_md_method().
      </p>
     </dd>

    
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-spki-new-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a signed public key and challenge string or NULL on failure.
  </p>
 </div>


  <div class="refsect1 errors" id="refsect1-function.openssl-spki-new-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Emits an <strong><code>E_WARNING</code></strong> level error if an unknown signature algorithm
   is passed via the <code class="parameter">algorithm</code> parameter.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.openssl-spki-new-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-986">
   <p><strong>Example #1 <span class="function"><strong>openssl_spki_new()</strong></span> example</strong></p>
   <div class="example-contents"><p>
     Generate a new SPKAC with the default digest (MD5)
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$pkey&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">openssl_pkey_new</span><span style="color: #007700">(</span><span style="color: #DD0000">'secret&nbsp;password'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$spkac&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">openssl_spki_new</span><span style="color: #007700">(</span><span style="color: #0000BB">$pkey</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'testing'</span><span style="color: #007700">);<br /><br />if&nbsp;(</span><span style="color: #0000BB">$spkac&nbsp;</span><span style="color: #007700">!==&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$spkac</span><span style="color: #007700">;<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"SPKAC&nbsp;generation&nbsp;failed"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
MIICRzCCAS8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDM3V3sS4o4
mB9dczziRnjGAmSp+JwPrHoYMAFGvDNmZGyiWfU586X4BKs++BAj7e/FsAfno0Hd
hN9FwpCNFSox30L03nQvLYJE7f/WqigwBeMRT7Op/xvFks4sT70xP2HRYv4KqP9a
WRcKU6cFH8VxhFhqM2txEIxZKdFLaL28yT7bEDmcglf4JLDdgNMb9rET1dkgtKE6
dOaJHPGjf1uvnOH4YwkQr7n4sLUR3Kdbh0ZJAFuQVDZulo+LLzxBBkqJJcB6FhF+
oXCdHTKZnqAhpWDz+NXYytAmevab6IYm5TWPWsJUv1YKJA5lg2mXbbloIZlN9Mgc
i9fi03bdw+crAgMBAAEWB3Rlc3RpbmcwDQYJKoZIhvcNAQEEBQADggEBALyUvP/o
pPSoWBlorFyZ2RnGwKf9qMpE0q2IJP7G3oDR4LyK/m933DUiZ+YnqThrH/CWb4Ek
y5I3OCyl3S4wCuU1ibZZwDVwYShr5ELp0J9PEf7qMQZOhNsizoC7k+Czb2xB6hYW
sKfsfTKm3cXBtH3fdgc/Z1Z7VSWnAzYo38snqm72NTf5yFRnrQdphNNXi+kn1zHA
lxXRyFDXHOcYsOnwAWfyXFA4QDHQ0ezz0UoCY8gJXovcZb4GRYqOLUAsF2HcNboy
29WN8VqE29sL9QxVZFlwMcqyoLcNnyw38GvNvAGqSvzzbnEFP2MAQXJVe0H0hdp/
MML5G2iNVgNozAo=
</pre></div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.openssl-spki-new-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><strong>openssl_spki_new()</strong></span></li>
    <li class="member"><span class="function"><a href="function.openssl-spki-export-challenge.html" class="function" rel="rdfs-seeAlso">openssl_spki_export_challenge()</a> - Exports the challenge assoicated with 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"><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-spki-export.html">openssl_spki_export</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.openssl-spki-verify.html">openssl_spki_verify</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>