<?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 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.openssl-x509-fingerprint.php',
    1 => 'openssl_x509_fingerprint',
    2 => 'Calculates the fingerprint, or digest, of a given X.509 certificate',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'OpenSSL Functions',
  ),
  'prev' => 
  array (
    0 => 'function.openssl-x509-export-to-file.php',
    1 => 'openssl_x509_export_to_file',
  ),
  'next' => 
  array (
    0 => 'function.openssl-x509-free.php',
    1 => 'openssl_x509_free',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/openssl/functions/openssl-x509-fingerprint.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.openssl-x509-fingerprint" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_x509_fingerprint</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.6.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openssl_x509_fingerprint</span> &mdash; <span class="dc-title">Calculates the fingerprint, or digest, of a given X.509 certificate</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.openssl-x509-fingerprint-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_x509_fingerprint</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.opensslcertificate.php" class="type OpenSSLCertificate">OpenSSLCertificate</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$certificate</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$digest_algo</code><span class="initializer"> = &quot;sha1&quot;</span></span>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$binary</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</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_x509_fingerprint()</strong></span> returns the digest of
   <code class="parameter">certificate</code> as a string.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-x509-fingerprint-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>
    
 <dt><code class="parameter">certificate</code></dt>
 <dd>
  <p class="para">
   See <a href="openssl.certparams.php" class="link">Key/Certificate parameters</a> for a list of valid values.
  </p>
 </dd>

    
     <dt><code class="parameter">digest_algo</code></dt>
     <dd>
      <p class="para">
       The digest method or hash algorithm to use, e.g. &quot;sha256&quot;, one of <span class="function"><a href="function.openssl-get-md-methods.php" class="function">openssl_get_md_methods()</a></span>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">binary</code></dt>
     <dd>
      <p class="para">
      When set to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>, outputs raw binary data. <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> outputs lowercase hexits.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-x509-fingerprint-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
    Returns a string containing the calculated certificate fingerprint as lowercase hexits unless <code class="parameter">binary</code> is set to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> in which case the raw binary representation of the message digest is returned.
  </p>
  <p class="para">
    Returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.openssl-x509-fingerprint-changelog">
  <h3 class="title">Changelog</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">certificate</code> accepts an <span class="classname"><a href="class.opensslcertificate.php" class="classname">OpenSSLCertificate</a></span> instance now;
       previously, a <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> of type <code class="literal">OpenSSL X.509</code> was accepted.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>

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