<!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>Returns an array with the key details</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-pkey-free.html">openssl_pkey_free</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.openssl-pkey-get-private.html">openssl_pkey_get_private</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-pkey-get-details" class="refentry"> <div class="refnamediv"> <h1 class="refname">openssl_pkey_get_details</h1> <p class="verinfo">(PHP 5 >= 5.2.0, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_pkey_get_details</span> — <span class="dc-title">Returns an array with the key details</span></p> </div> <div class="refsect1 description" id="refsect1-function.openssl-pkey-get-details-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">array</span> <span class="methodname"><strong>openssl_pkey_get_details</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$key</code></span> )</div> <p class="para rdfs-comment"> This function returns the key details (bits, key, type). </p> </div> <div class="refsect1 parameters" id="refsect1-function.openssl-pkey-get-details-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <code class="parameter">key</code></dt> <dd> <p class="para"> Resource holding the key. </p> </dd> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.openssl-pkey-get-details-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns an array with the key details in success or <strong><code>FALSE</code></strong> in failure. Returned array has indexes <em>bits</em> (number of bits), <em>key</em> (string representation of the public key) and <em>type</em> (type of the key which is one of <strong><code>OPENSSL_KEYTYPE_RSA</code></strong>, <strong><code>OPENSSL_KEYTYPE_DSA</code></strong>, <strong><code>OPENSSL_KEYTYPE_DH</code></strong>, <strong><code>OPENSSL_KEYTYPE_EC</code></strong> or -1 meaning unknown). </p> <p class="para"> Depending on the key type used, additional details may be returned. Note that some elements may not always be available. </p> <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> <strong><code>OPENSSL_KEYTYPE_RSA</code></strong>, an additional array key named <em>"rsa"</em>, containing the key data is returned. </span> <table class="doctable informaltable"> <thead> <tr> <th>Key</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td><em>"n"</em></td> <td>modulus</td> </tr> <tr> <td><em>"e"</em></td> <td>public exponent</td> </tr> <tr> <td><em>"d"</em></td> <td>private exponent</td> </tr> <tr> <td><em>"p"</em></td> <td>prime 1</td> </tr> <tr> <td><em>"q"</em></td> <td>prime 2</td> </tr> <tr> <td><em>"dmp1"</em></td> <td>exponent1, d mod (p-1)</td> </tr> <tr> <td><em>"dmq1"</em></td> <td>exponent2, d mod (q-1)</td> </tr> <tr> <td><em>"iqmp"</em></td> <td>coefficient, (inverse of q) mod p</td> </tr> </tbody> </table> </li> <li class="listitem"> <span class="simpara"> <strong><code>OPENSSL_KEYTYPE_DSA</code></strong>, an additional array key named <em>"dsa"</em>, containing the key data is returned. </span> <table class="doctable informaltable"> <thead> <tr> <th>Key</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td><em>"p"</em></td> <td>prime number (public)</td> </tr> <tr> <td><em>"q"</em></td> <td>160-bit subprime, q | p-1 (public)</td> </tr> <tr> <td><em>"g"</em></td> <td>generator of subgroup (public)</td> </tr> <tr> <td><em>"priv_key"</em></td> <td>private key x</td> </tr> <tr> <td><em>"pub_key"</em></td> <td>public key y = g^x</td> </tr> </tbody> </table> </li> <li class="listitem"> <span class="simpara"> <strong><code>OPENSSL_KEYTYPE_DH</code></strong>, an additional array key named <em>"dh"</em>, containing the key data is returned. </span> <table class="doctable informaltable"> <thead> <tr> <th>Key</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td><em>"p"</em></td> <td>prime number (shared)</td> </tr> <tr> <td><em>"g"</em></td> <td>generator of Z_p (shared)</td> </tr> <tr> <td><em>"priv_key"</em></td> <td>private DH value x</td> </tr> <tr> <td><em>"pub_key"</em></td> <td>public DH value g^x</td> </tr> </tbody> </table> </li> <li class="listitem"> <span class="simpara"> <strong><code>OPENSSL_KEYTYPE_EC</code></strong>, an additional array key named <em>"ec"</em>, containing the key data is returned. </span> <table class="doctable informaltable"> <thead> <tr> <th>Key</th> <th>Description</th> </tr> </thead> <tbody class="tbody"> <tr> <td><em>"curve_name"</em></td> <td>name of curve, see <span class="function"><a href="function.openssl-get-curve-names.html" class="function">openssl_get_curve_names()</a></span></td> </tr> <tr> <td><em>"curve_oid"</em></td> <td>ASN1 Object identifier (OID) for EC curve.</td> </tr> <tr> <td><em>"x"</em></td> <td>x coordinate (public)</td> </tr> <tr> <td><em>"y"</em></td> <td>y coordinate (public)</td> </tr> <tr> <td><em>"d"</em></td> <td>private key</td> </tr> </tbody> </table> </li> </ul> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-pkey-free.html">openssl_pkey_free</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.openssl-pkey-get-private.html">openssl_pkey_get_private</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>