<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.openssl-cms-encrypt.php',
    1 => 'openssl_cms_encrypt',
    2 => 'Chiffre un message CMS',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'Fonctions OpenSSL',
  ),
  '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' => 'fr',
    '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">Chiffre un message CMS</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-cms-encrypt-description">
  <h3 class="title">Description</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">
   Cette fonction chiffre le contenu pour un ou plusieurs destinataires,
   basé sur les certificats qui lui sont passés.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-cms-encrypt-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
    <dt><code class="parameter">input_filename</code></dt>
    <dd>
     <p class="para">
       Le fichier à chiffrer.
     </p>
    </dd>
   
   
    <dt><code class="parameter">output_filename</code></dt>
    <dd>
     <p class="para">
      Le fichier de sortie.
     </p>
    </dd>
   
   
    <dt><code class="parameter">certificate</code></dt>
    <dd>
     <p class="para">
      Les destinataires à chiffrer.
     </p>
    </dd>
   
   
    <dt><code class="parameter">headers</code></dt>
    <dd>
     <p class="para">
      Les en-têtes à inclure lors de l&#039;utilisation de S/MIME.
     </p>
    </dd>
   
   
    <dt><code class="parameter">flags</code></dt>
    <dd>
     <p class="para">
      Les drapeaux à passer à CMS_sign.
     </p>
    </dd>
   
   
    <dt><code class="parameter">encoding</code></dt>
    <dd>
     <p class="para">
      Un encodage de sortie. Une des constantes <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> ou <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">
      Le chiffrement à utiliser.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-cms-encrypt-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Cette fonction retourne <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> en cas de succès ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.openssl-cms-encrypt-changelog">
  <h3 class="title">Historique</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.5.0</td>
      <td>
       <code class="parameter">cipher_algo</code> est maintenant de type <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> ou
       <span class="type"><a href="language.types.string.php" class="type string">string</a></span>. Précédemment, il était de 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>
       L&#039;algorithme de chiffrement par défaut (<code class="parameter">cipher_algo</code>) est maintenant
       AES-128-CBC (<strong><code><a href="openssl.ciphers.php#constant.openssl-cipher-aes-128-cbc">OPENSSL_CIPHER_AES_128_CBC</a></code></strong>). Précédemment,
       PKCS7/CMS était utilisé (<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); ?>