<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.openssl-csr-export" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>openssl_csr_export</refname>
  <refpurpose>Exports a <acronym>CSR</acronym> as a string</refpurpose>
 </refnamediv>
 
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>openssl_csr_export</methodname>
   <methodparam><type class="union"><type>OpenSSLCertificateSigningRequest</type><type>string</type></type><parameter>csr</parameter></methodparam>
   <methodparam><type>string</type><parameter role="reference">output</parameter></methodparam>
   <methodparam choice="opt"><type>bool</type><parameter>no_text</parameter><initializer>&true;</initializer></methodparam>
  </methodsynopsis>
  <para>
   <function>openssl_csr_export</function> takes the Certificate Signing
   Request represented by <parameter>csr</parameter> and stores it in
   <acronym>PEM</acronym> format in <parameter>output</parameter>, which is passed by
   reference.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
     &openssl.param.csr;
    <varlistentry>
     <term><parameter>output</parameter></term>
     <listitem>
      <para>
       on success, this string will contain the <acronym>PEM</acronym>
       encoded <acronym>CSR</acronym>
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>no_text</parameter></term>
     <listitem>
      &note.openssl.param-notext;
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <informaltable>
   <tgroup cols="2">
    <thead>
     <row>
      <entry>&Version;</entry>
      <entry>&Description;</entry>
     </row>
    </thead>
    <tbody>
     <row>
      <entry>8.0.0</entry>
      <entry>
       <parameter>csr</parameter> accepts an <classname>OpenSSLCertificateSigningRequest</classname> instance now;
       previously, a &resource; of type <literal>OpenSSL X.509 CSR</literal> was accepted.
      </entry>
     </row>
    </tbody>
   </tgroup>
  </informaltable>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>openssl_csr_export() example</title>
    <programlisting role="php">
<![CDATA[
<?php
$subject = array(
    "commonName" => "example.com",
);
$private_key = openssl_pkey_new(array(
    "private_key_bits" => 2048,
    "private_key_type" => OPENSSL_KEYTYPE_RSA,
));
$configargs = array(
    'digest_alg' => 'sha256WithRSAEncryption'
);
$csr = openssl_csr_new($subject, $private_key, $configargs);
openssl_csr_export($csr, $csr_string);
echo $csr_string;
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>openssl_csr_export_to_file</function></member>
    <member><function>openssl_csr_new</function></member>
    <member><function>openssl_csr_sign</function></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
