Sophie

Sophie

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

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>Decrypts data</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-csr-sign.html">openssl_csr_sign</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.openssl-dh-compute-key.html">openssl_dh_compute_key</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-decrypt" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_decrypt</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7)</p><p class="refpurpose"><span class="refname">openssl_decrypt</span> &mdash; <span class="dc-title">Decrypts data</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-decrypt-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>openssl_decrypt</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$method</code></span>
   , <span class="methodparam"><span class="type">string</span> <code class="parameter">$key</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$iv</code><span class="initializer"> = &quot;&quot;</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$tag</code><span class="initializer"> = &quot;&quot;</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$aad</code><span class="initializer"> = &quot;&quot;</span></span>
  ]]]] )</div>

  <p class="para rdfs-comment">
   Takes a raw or base64 encoded string and decrypts it using a given method and key.
  </p>

 </div>


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

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

     <dd>

      <p class="para">
       The encrypted message to be decrypted.
      </p>
     </dd>

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

     <dd>

      <p class="para">
       The cipher method. For a list of available cipher methods, use 
       <span class="function"><a href="function.openssl-get-cipher-methods.html" class="function">openssl_get_cipher_methods()</a></span>.  
      </p>
     </dd>

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

     <dd>

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

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

      <dd>

       <p class="para">
        <code class="parameter">options</code> can be one of
        <strong><code>OPENSSL_RAW_DATA</code></strong>,
        <strong><code>OPENSSL_ZERO_PADDING</code></strong>.
       </p>
      </dd>

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

     <dd>

      <p class="para">
       A non-NULL Initialization Vector. 
      </p>
     </dd>

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

     <dd>

      <p class="para">
       The authentication tag in AEAD cipher mode. If it is incorrect, the authentication fails and the function returns <strong><code>FALSE</code></strong>.
      </p>
     </dd>

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

     <dd>

      <p class="para">
       Additional authentication data.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-decrypt-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The decrypted string on success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.openssl-decrypt-errors">
  <h3 class="title">Errors/Exceptions</h3>
  <p class="para">
   Emits an <strong><code>E_WARNING</code></strong> level error if an unknown cipher algorithm
   is passed via the <code class="parameter">method</code> parameter.
  </p>
  <p class="para">
   Emits an <strong><code>E_WARNING</code></strong> level error if an empty value is passed
   in via the <code class="parameter">iv</code> parameter.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.openssl-decrypt-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>5.3.3</td>
      <td>
       The <code class="parameter">iv</code> parameter was added.
      </td>
     </tr>

     <tr>
      <td>5.4.0</td>
      <td>
       The <code class="parameter">raw_output</code> was changed to <code class="parameter">options</code>.
      </td>
     </tr>

     <tr>
      <td>7.1.0</td>
      <td>The <code class="parameter">tag</code> and <code class="parameter">aad</code> parameters were added.</td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 seealso" id="refsect1-function.openssl-decrypt-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.openssl-encrypt.html" class="function" rel="rdfs-seeAlso">openssl_encrypt()</a> - Encrypts data</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.openssl-csr-sign.html">openssl_csr_sign</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.openssl-dh-compute-key.html">openssl_dh_compute_key</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>