<?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 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.openssl-cms-encrypt.php',
    1 => 'openssl_cms_encrypt',
    2 => 'Encrypt a CMS message',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'OpenSSL Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.openssl-cms-decrypt.php',
    1 => 'openssl_cms_decrypt',
  ),
  'next' => 
  array (
    0 => 'function.openssl-cms-read.php',
    1 => 'openssl_cms_read',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/openssl/functions/openssl-cms-encrypt.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.openssl-cms-encrypt" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_cms_encrypt</h1>
  <p class="verinfo">(PHP 8)</p><p class="refpurpose"><span class="refname">openssl_cms_encrypt</span> &mdash; <span class="dc-title">Encrypt a CMS message</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-cms-encrypt-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_cms_encrypt</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">$input_filename</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">$output_filename</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<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.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$certificate</code></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.array.php" class="type array">array</a></span></span> <code class="parameter">$headers</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">$flags</code><span class="initializer"> = 0</span></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">$encoding</code><span class="initializer"> = <strong><code><a href="openssl.constants.other.php#constant.openssl-encoding-smime">OPENSSL_ENCODING_SMIME</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><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.integer.php" class="type int">int</a></span></span> <code class="parameter">$cipher_algo</code><span class="initializer"> = <strong><code><a href="openssl.ciphers.php#constant.openssl-cipher-aes-128-cbc">OPENSSL_CIPHER_AES_128_CBC</a></code></strong></span></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   This function encrypts content to one or more recipients,
   based on the certificates that are passed to it.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-cms-encrypt-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <dl>
   
    <dt><code class="parameter">input_filename</code></dt>
    <dd>
     <p class="para">
       The file to be encrypted.
     </p>
    </dd>
   
   
    <dt><code class="parameter">output_filename</code></dt>
    <dd>
     <p class="para">
      The output file.
     </p>
    </dd>
   
   
    <dt><code class="parameter">certificate</code></dt>
    <dd>
     <p class="para">
      Recipients to encrypt to.
     </p>
    </dd>
   
   
    <dt><code class="parameter">headers</code></dt>
    <dd>
     <p class="para">
      Headers to include when S/MIME is used.
     </p>
    </dd>
   
   
    <dt><code class="parameter">flags</code></dt>
    <dd>
     <p class="para">
      Flags to be passed to CMS_sign.
     </p>
    </dd>
   
   
    <dt><code class="parameter">encoding</code></dt>
    <dd>
     <p class="para">
      An encoding to output. One of <strong><code><a href="openssl.constants.other.php#constant.openssl-encoding-smime">OPENSSL_ENCODING_SMIME</a></code></strong>,
      <strong><code><a href="openssl.constants.other.php#constant.openssl-encoding-der">OPENSSL_ENCODING_DER</a></code></strong> or <strong><code><a href="openssl.constants.other.php#constant.openssl-encoding-pem">OPENSSL_ENCODING_PEM</a></code></strong>.
     </p>
    </dd>
   
   
    <dt><code class="parameter">cipher_algo</code></dt>
    <dd>
     <p class="para">
      A cipher to use.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-cms-encrypt-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Restituisce <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> in caso di successo, <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.openssl-cms-encrypt-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versione</th>
      <th>Descrizione</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.5.0</td>
      <td>
       <code class="parameter">cipher_algo</code> is now of type <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> or <span class="type"><a href="language.types.string.php" class="type string">string</a></span>.
       Previously, it was of type <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>.
      </td>
     </tr>

     <tr>
      <td>8.1.0</td>
      <td>
       The default cipher algorithm (<code class="parameter">cipher_algo</code>) is now
       AES-128-CBC (<strong><code><a href="openssl.ciphers.php#constant.openssl-cipher-aes-128-cbc">OPENSSL_CIPHER_AES_128_CBC</a></code></strong>). Previously,
       PKCS7/CMS was used (<strong><code><a href="openssl.ciphers.php#constant.openssl-cipher-rc2-40">OPENSSL_CIPHER_RC2_40</a></code></strong>).
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


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