<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.sodium-crypto-box-seal-open" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>sodium_crypto_box_seal_open</refname>
  <refpurpose>Anonymous public-key decryption</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type class="union"><type>string</type><type>false</type></type><methodname>sodium_crypto_box_seal_open</methodname>
   <methodparam><type>string</type><parameter>ciphertext</parameter></methodparam>
   <methodparam><type>string</type><parameter>key_pair</parameter></methodparam>
  </methodsynopsis>
  <para>
   Decrypt a message that was encrypted with <function>sodium_crypto_box_seal</function>
  </para>

 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>ciphertext</parameter></term>
    <listitem>
     <para>
      The encrypted message
     </para>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>key_pair</parameter></term>
    <listitem>
     <para>
      The keypair of the recipient. Must include the secret key.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   The plaintext on success, &return.falseforfailure;.
  </para>
 </refsect1>


 <refsect1 role="examples"><!-- {{{ -->
  &reftitle.examples;
  <example xml:id="sodium-crypto-box-seal-open.example.basic"><!-- {{{ -->
   <title><function>sodium_crypto_box_seal_open</function> example</title>
   <programlisting role="php">
<![CDATA[
<?php
// Ciphertext is not sensitive; base64_decode is fine
$sealed_b64 = "oRBXXAV4iQBrxlV4A21Bord8Yo/D8ZlrIIGNyaRCcGBfpz0map52I3xq6l+CST+1NSgQkbV+HiYyFjXWiWiaCGupGf+zl4bgWj/A9Adtem7Jt3h3emrMsLw=";
$sealed = base64_decode($sealed_b64);

// Keypair contains a cryptographic secret; use a timing-safe decoder
$keypair_b64 = "KZkF8wnB7bnC2aXB3lFOqCTc0Z6MllvaQb9ASVG8o2/MsewkuE4u1uaEgTzSakeiYyIW8DGj+02/L3cWIbs9bQ==";
$keypair = sodium_base642bin($keypair_b64, SODIUM_BASE64_VARIANT_ORIGINAL);

$opened = sodium_crypto_box_seal_open($sealed, $keypair);
var_dump($opened);
?>
]]>
   </programlisting>
   &example.outputs.similar;
   <screen>
<![CDATA[
string(41) "Writing software in PHP can be a delight!"
]]>
   </screen>
  </example><!-- }}} -->
 </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
-->
