<?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 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.openssl-decrypt.php',
    1 => 'openssl_decrypt',
    2 => 'Decrypts data',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'OpenSSL-Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.openssl-csr-sign.php',
    1 => 'openssl_csr_sign',
  ),
  'next' => 
  array (
    0 => 'function.openssl-dh-compute-key.php',
    1 => 'openssl_dh_compute_key',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/openssl/functions/openssl-decrypt.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<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, PHP 8)</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">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_decrypt</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$data</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$cipher_algo</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="attribute"><a href="class.sensitiveparameter.php">#[\SensitiveParameter]</a> </span><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$passphrase</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$iv</code><span class="initializer"> = &quot;&quot;</span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$tag</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$aad</code><span class="initializer"> = &quot;&quot;</span></span><br>): <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">
   Takes a raw or base64 encoded string and decrypts it using a given method and passphrase.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-decrypt-parameters">
  <h3 class="title">Parameter-Liste</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">cipher_algo</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.php" class="function">openssl_get_cipher_methods()</a></span>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">passphrase</code></dt>
     <dd>
      <p class="para">
       The passphrase. If the passphrase is shorter than expected, it is silently padded with
       <code class="literal">NUL</code> characters; if the passphrase is longer than expected, it is
       silently truncated.
      </p>
      <div class="caution"><strong class="caution">Achtung</strong>
       <p class="simpara">
        There is no key derivation function used for <code class="parameter">passphrase</code> as its name
        might suggest. The only operation used is padding with <code class="literal">NUL</code> characters
        or truncation if the length is different than expected.
       </p>
      </div>
     </dd>
    
    
      <dt><code class="parameter">options</code></dt>
      <dd>
       <p class="para">
        <code class="parameter">options</code> can be one of
        <strong><code><a href="openssl.constants.other.php#constant.openssl-raw-data">OPENSSL_RAW_DATA</a></code></strong>,
        <strong><code><a href="openssl.constants.other.php#constant.openssl-zero-padding">OPENSSL_ZERO_PADDING</a></code></strong>
        or <strong><code><a href="openssl.constants.other.php#constant.openssl-dont-zero-pad-key">OPENSSL_DONT_ZERO_PAD_KEY</a></code></strong>.
       </p>
      </dd>
    
    
     <dt><code class="parameter">iv</code></dt>
     <dd>
      <p class="para">
       A non-<strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> Initialization Vector. If the IV is shorter than expected, it is padded with
       <code class="literal">NUL</code> characters and warning is emitted; if the passphrase is longer
       than expected, it is truncated and warning is emitted.
      </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><a href="reserved.constants.php#constant.false">false</a></code></strong>.
      </p>
      <div class="caution"><strong class="caution">Achtung</strong>
       <p class="simpara">
        The length of the <code class="parameter">tag</code> is not checked by the function.
        It is the caller&#039;s responsibility to ensure that the length of the tag
        matches the length of the tag retrieved when <span class="function"><a href="function.openssl-encrypt.php" class="function">openssl_encrypt()</a></span>
        has been called. Otherwise the decryption may succeed if the given tag only
        matches the start of the proper tag.
       </p>
      </div>
     </dd>
    
    
     <dt><code class="parameter">aad</code></dt>
     <dd>
      <p class="para">
       Additional authenticated data.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-decrypt-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   The decrypted string on successBei einem Fehler wird <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben..
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.openssl-decrypt-errors">
  <h3 class="title">Fehler/Exceptions</h3>
  <p class="para">
   Emits an <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> level error if an unknown cipher algorithm
   is passed via the <code class="parameter">cipher_algo</code> parameter.
  </p>
  <p class="para">
   Emits an <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></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>Beschreibung</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.1.0</td>
      <td><code class="parameter">tag</code> is now nullable.</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">Siehe auch</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.openssl-encrypt.php" class="function" rel="rdfs-seeAlso">openssl_encrypt()</a> - Verschl&uuml;sselt Daten</span></li>
   </ul>
  </p>
 </div>


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