Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 5505

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>Checks if a private key corresponds to a certificate</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-verify.html">openssl_verify</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.openssl-x509-checkpurpose.html">openssl_x509_checkpurpose</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-x509-check-private-key" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_x509_check_private_key</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_x509_check_private_key</span> &mdash; <span class="dc-title">Checks if a private key corresponds to a certificate</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.openssl-x509-check-private-key-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>openssl_x509_check_private_key</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$cert</code></span>
   , <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$key</code></span>
   )</div>

  <p class="para rdfs-comment">
   Checks whether the given <code class="parameter">key</code> is the private key
   that corresponds to <code class="parameter">cert</code>.
  </p>
  <div class="warning"><strong class="warning">Warning</strong>
    <p class="para">
     The function does not check if <code class="parameter">key</code> is indeed a private key or not.
     It merely compares the public materials (e.g. exponent and modulus of an RSA key)
     and/or key parameters (e.g. EC params of an EC key) of a key pair.
    </p>
    <p class="para">
     This means, for example, that a public key could be given for <code class="parameter">key</code>
     and the function may return <strong><code>TRUE</code></strong>.
    </p>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-x509-check-private-key-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

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

     <dd>

      <p class="para">
       The certificate.
      </p>
     </dd>

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

     <dd>

      <p class="para">
       The private key.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-x509-check-private-key-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if <code class="parameter">key</code> is the private key that
   corresponds to <code class="parameter">cert</code>, or <strong><code>FALSE</code></strong> otherwise.
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-verify.html">openssl_verify</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.openssl-x509-checkpurpose.html">openssl_x509_checkpurpose</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>