<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.openssl.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.openssl-csr-get-public-key.php',
    1 => 'openssl_csr_get_public_key',
    2 => 'Returns the public key of a CSR',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'Функції OpenSSL',
  ),
  'prev' => 
  array (
    0 => 'function.openssl-csr-export-to-file.php',
    1 => 'openssl_csr_export_to_file',
  ),
  'next' => 
  array (
    0 => 'function.openssl-csr-get-subject.php',
    1 => 'openssl_csr_get_subject',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/openssl/functions/openssl-csr-get-public-key.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.openssl-csr-get-public-key" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_csr_get_public_key</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openssl_csr_get_public_key</span> &mdash; <span class="dc-title">Returns the public key of a <abbr title="Certificate Signing Request">CSR</abbr></span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-csr-get-public-key-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_csr_get_public_key</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.opensslcertificatesigningrequest.php" class="type OpenSSLCertificateSigningRequest">OpenSSLCertificateSigningRequest</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$csr</code></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$short_names</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span></span>): <span class="type"><span class="type"><a href="class.opensslasymmetrickey.php" class="type OpenSSLAsymmetricKey">OpenSSLAsymmetricKey</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>openssl_csr_get_public_key()</strong></span> extracts the public key 
   from <code class="parameter">csr</code> and prepares it for use by other functions.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-csr-get-public-key-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
     
 <dt><code class="parameter">csr</code></dt>
 <dd>
  <p class="para">
   Список можливих значень є в параграфі <a href="openssl.certparams.php" class="link">Параметри CSR</a>.
  </p>
 </dd>

    
     <dt><code class="parameter">short_names</code></dt>
     <dd>
      <div class="warning"><strong class="warning">Увага</strong>
       <p class="para">
        This parameter is ignored
       </p>
      </div>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-csr-get-public-key-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Returns an <span class="classname"><a href="class.opensslasymmetrickey.php" class="classname">OpenSSLAsymmetricKey</a></span> on success, or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on error.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.openssl-csr-get-public-key-changelog">
  <h3 class="title">Журнал змін</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версія</th>
      <th>Опис</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       On success, this function returns an <span class="classname"><a href="class.opensslasymmetrickey.php" class="classname">OpenSSLAsymmetricKey</a></span> instance now;
       previously, a <a href="language.types.resource.php" class="link">resource</a> of type <code class="literal">OpenSSL key</code> was returned.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">csr</code> accepts an <span class="classname"><a href="class.opensslcertificatesigningrequest.php" class="classname">OpenSSLCertificateSigningRequest</a></span> instance now;
       previously, a <a href="language.types.resource.php" class="link">resource</a> of type <code class="literal">OpenSSL X.509 CSR</code> was accepted.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>

 
 <div class="refsect1 examples" id="refsect1-function.openssl-csr-get-public-key-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 openssl_csr_get_public_key() example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$subject </span><span style="color: #007700">= array(<br />    </span><span style="color: #DD0000">"commonName" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"example.com"</span><span style="color: #007700">,<br />);<br /></span><span style="color: #0000BB">$private_key </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_pkey_new</span><span style="color: #007700">(array(<br />    </span><span style="color: #DD0000">"private_key_bits" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">2048</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">"private_key_type" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">OPENSSL_KEYTYPE_RSA</span><span style="color: #007700">,<br />));<br /></span><span style="color: #0000BB">$csr </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_csr_new</span><span style="color: #007700">(</span><span style="color: #0000BB">$subject</span><span style="color: #007700">, </span><span style="color: #0000BB">$private_key</span><span style="color: #007700">, array(</span><span style="color: #DD0000">'digest_alg' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'sha256'</span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">$public_key </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_csr_get_public_key</span><span style="color: #007700">(</span><span style="color: #0000BB">$csr</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$info </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_pkey_get_details</span><span style="color: #007700">(</span><span style="color: #0000BB">$public_key</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$info</span><span style="color: #007700">[</span><span style="color: #DD0000">'key'</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.openssl-csr-get-public-key-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.openssl-csr-get-subject.php" class="function" rel="rdfs-seeAlso">openssl_csr_get_subject()</a> - Returns the subject of a CSR</span></li>
    <li><span class="function"><a href="function.openssl-csr-new.php" class="function" rel="rdfs-seeAlso">openssl_csr_new()</a> - Generates a CSR</span></li>
    <li><span class="function"><a href="function.openssl-pkey-get-details.php" class="function" rel="rdfs-seeAlso">openssl_pkey_get_details()</a> - Returns an array with the key details</span></li>
    <li><span class="function"><a href="function.openssl-pkey-export-to-file.php" class="function" rel="rdfs-seeAlso">openssl_pkey_export_to_file()</a> - Gets an exportable representation of a key into a file</span></li>
    <li><span class="function"><a href="function.openssl-pkey-export.php" class="function" rel="rdfs-seeAlso">openssl_pkey_export()</a> - Gets an exportable representation of a key into a string</span></li>
   
   </ul>
  </p>
 </div>

 
</div><?php manual_footer($setup); ?>