<?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 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.openssl-cms-encrypt.php',
    1 => 'openssl_cms_encrypt',
    2 => 'Cifra un mensaje CMS',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'Funciones de 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' => 'es',
    '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">Cifra un mensaje CMS</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-cms-encrypt-description">
  <h3 class="title">Descripción</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">
   Esta función cifra el contenido para uno o varios destinatarios,
   basado en los certificados que se le pasan.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-cms-encrypt-parameters">
  <h3 class="title">Parámetros</h3>
  <dl>
   
    <dt><code class="parameter">input_filename</code></dt>
    <dd>
     <p class="para">
       El fichero a cifrar.
     </p>
    </dd>
   
   
    <dt><code class="parameter">output_filename</code></dt>
    <dd>
     <p class="para">
      El fichero de salida.
     </p>
    </dd>
   
   
    <dt><code class="parameter">certificate</code></dt>
    <dd>
     <p class="para">
      Los destinatarios a cifrar.
     </p>
    </dd>
   
   
    <dt><code class="parameter">headers</code></dt>
    <dd>
     <p class="para">
      Las cabeceras a incluir al utilizar S/MIME.
     </p>
    </dd>
   
   
    <dt><code class="parameter">flags</code></dt>
    <dd>
     <p class="para">
      Los flag a pasar a CMS_sign.
     </p>
    </dd>
   
   
    <dt><code class="parameter">encoding</code></dt>
    <dd>
     <p class="para">
      Una codificación de salida. Una de las 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> o <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">
      El cifrado a utilizar.
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-cms-encrypt-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Esta función retorna <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> en caso de éxito o <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si ocurre un error.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.openssl-cms-encrypt-changelog">
  <h3 class="title">Historial de cambios</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Versión</th>
      <th>Descripción</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.5.0</td>
      <td>
       <code class="parameter">cipher_algo</code> es ahora de tipo <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> o <span class="type"><a href="language.types.string.php" class="type string">string</a></span>.
       Anteriormente, era de tipo <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>.
      </td>
     </tr>

     <tr>
      <td>8.1.0</td>
      <td>
       El algoritmo de cifrado por omisión (<code class="parameter">cipher_algo</code>) es ahora
       AES-128-CBC (<strong><code><a href="openssl.ciphers.php#constant.openssl-cipher-aes-128-cbc">OPENSSL_CIPHER_AES_128_CBC</a></code></strong>). Anteriormente,
       se utilizaba PKCS7/CMS (<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); ?>