<?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-csr-export-to-file.php',
    1 => 'openssl_csr_export_to_file',
    2 => 'Exporta una CSR a un fichero',
  ),
  'up' => 
  array (
    0 => 'ref.openssl.php',
    1 => 'Funciones de OpenSSL',
  ),
  'prev' => 
  array (
    0 => 'function.openssl-csr-export.php',
    1 => 'openssl_csr_export',
  ),
  'next' => 
  array (
    0 => 'function.openssl-csr-get-public-key.php',
    1 => 'openssl_csr_get_public_key',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/openssl/functions/openssl-csr-export-to-file.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.openssl-csr-export-to-file" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">openssl_csr_export_to_file</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">openssl_csr_export_to_file</span> &mdash; <span class="dc-title">Exporta una CSR a un fichero</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.openssl-csr-export-to-file-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>openssl_csr_export_to_file</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="class.opensslcertificatesigningrequest.php" class="type OpenSSLCertificateSigningRequest">OpenSSLCertificateSigningRequest</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$csr</code></span>, <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>, <span class="methodparam"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> <code class="parameter">$no_text</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>openssl_csr_export_to_file()</strong></span> toma la <abbr title="Certificate Signing Request">CSR</abbr> representada por
   el argumento <code class="parameter">csr</code> y la guarda en formato <abbr title="Privacy-Enhanced Mail">PEM</abbr> en el fichero
   nombrado <code class="parameter">output_filename</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.openssl-csr-export-to-file-parameters">
  <h3 class="title">Parámetros</h3>
  <p class="para">
   <dl>
    
<dt><code class="parameter">csr</code></dt>
<dd>
    <p class="para">
        Ver los <a href="openssl.certparams.php" class="link">parámetros CSR</a> para obtener una lista de los valores válidos.
    </p>
</dd>

    
     <dt><code class="parameter">output_filename</code></dt>
     <dd>
      <p class="para">
       Ruta hacia el fichero de salida.
      </p>
     </dd>
    
    
     <dt><code class="parameter">no_text</code></dt>
     <dd>
      <p class="para">
El parámetro opcional <code class="parameter">notext</code> afecta al nivel de verbosidad del display;
si vale <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>, se añadirán información legible por humanos en el display.
Por omisión, el parámetro <code class="parameter">notext</code> vale <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
</p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.openssl-csr-export-to-file-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-csr-export-to-file-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.0.0</td>
      <td>
       <code class="parameter">csr</code> ahora acepta una instancia de
       <span class="classname"><a href="class.opensslcertificatesigningrequest.php" class="classname">OpenSSLCertificateSigningRequest</a></span>;
       anteriormente, se aceptaba un <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> de tipo <code class="literal">OpenSSL X.509 CSR</code>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.openssl-csr-export-to-file-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Ejemplo de openssl_csr_export_to_file()</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$subject </span><span style="color: #007700">= array(<br />    </span><span style="color: #DD0000">"commonName" </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"example.com"</span><span style="color: #007700">,<br />);<br /></span><span style="color: #0000BB">$private_key </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_pkey_new</span><span style="color: #007700">(array(<br />    </span><span style="color: #DD0000">"private_key_bits" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">2048</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">"private_key_type" </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">OPENSSL_KEYTYPE_RSA</span><span style="color: #007700">,<br />));<br /></span><span style="color: #0000BB">$csr </span><span style="color: #007700">= </span><span style="color: #0000BB">openssl_csr_new</span><span style="color: #007700">(</span><span style="color: #0000BB">$subject</span><span style="color: #007700">, </span><span style="color: #0000BB">$private_key</span><span style="color: #007700">, array(</span><span style="color: #DD0000">'digest_alg' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'sha384'</span><span style="color: #007700">) );<br /></span><span style="color: #0000BB">openssl_pkey_export_to_file</span><span style="color: #007700">(</span><span style="color: #0000BB">$private_key</span><span style="color: #007700">, </span><span style="color: #DD0000">'example-priv.key'</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// Al mismo tiempo que el sujeto, la CSR contiene la clave pública correspondiente a la clave privada<br /></span><span style="color: #0000BB">openssl_csr_export_to_file</span><span style="color: #007700">(</span><span style="color: #0000BB">$csr</span><span style="color: #007700">, </span><span style="color: #DD0000">'example-csr.pem'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.openssl-csr-export-to-file-seealso">
  <h3 class="title">Ver también</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.openssl-csr-export.php" class="function" rel="rdfs-seeAlso">openssl_csr_export()</a> - Exporta un CSR a un fichero o una variable</span></li>
    <li><span class="function"><a href="function.openssl-csr-new.php" class="function" rel="rdfs-seeAlso">openssl_csr_new()</a> - Genera una CSR</span></li>
    <li><span class="function"><a href="function.openssl-csr-sign.php" class="function" rel="rdfs-seeAlso">openssl_csr_sign()</a> - Firma un CSR con otro certificado (o consigo mismo) y genera un certificado</span></li>
   </ul>
  </p>
 </div>


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