<!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>Calculates the fingerprint, or digest, of a given X.509 certificate</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-x509-export.html">openssl_x509_export</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.openssl-x509-free.html">openssl_x509_free</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-fingerprint" class="refentry"> <div class="refnamediv"> <h1 class="refname">openssl_x509_fingerprint</h1> <p class="verinfo">(PHP 5 >= 5.6.0, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_x509_fingerprint</span> — <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="type">string</span> <span class="methodname"><strong>openssl_x509_fingerprint</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">$x509</code></span> [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$hash_algorithm</code><span class="initializer"> = "sha1"</span></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$raw_output</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span> ]] )</div> <p class="para rdfs-comment"> <span class="function"><strong>openssl_x509_fingerprint()</strong></span> returns the digest of <code class="parameter">x509</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">x509</code></dt> <dd> <p class="para"> See <a href="openssl.certparams.html" class="link">Key/Certificate parameters</a> for a list of valid values. </p> </dd> <dt> <code class="parameter">hash_algorithm</code></dt> <dd> <p class="para"> The digest method or hash algorithm to use, e.g. "sha256", one of <span class="function"><a href="function.openssl-get-md-methods.html" class="function">openssl_get_md_methods()</a></span>. </p> </dd> <dt> <code class="parameter">raw_output</code></dt> <dd> <p class="para"> When set to <strong><code>TRUE</code></strong>, outputs raw binary data. <strong><code>FALSE</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">raw_output</code> is set to <strong><code>TRUE</code></strong> in which case the raw binary representation of the message digest is returned. </p> <p class="para"> Returns <strong><code>FALSE</code></strong> on failure. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-x509-export.html">openssl_x509_export</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.openssl-x509-free.html">openssl_x509_free</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>