php-doc-en/reference/gnupg/functions/gnupg-encrypt.xml
2022-01-16 22:08:32 +00:00

106 lines
2.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.gnupg-encrypt">
<refnamediv>
<refname>gnupg_encrypt</refname>
<refpurpose>Encrypts a given text</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>gnupg_encrypt</methodname>
<methodparam><type>resource</type><parameter>identifier</parameter></methodparam>
<methodparam><type>string</type><parameter>plaintext</parameter></methodparam>
</methodsynopsis>
<para>
Encrypts the given <parameter>plaintext</parameter> with the keys, which
were set with <link
linkend="function.gnupg-addencryptkey">gnupg_addencryptkey</link> before and
returns the encrypted text.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>identifier</parameter></term>
<listitem>
&gnupg.identifier;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>plaintext</parameter></term>
<listitem>
<para>
The text being encrypted.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
On success, this function returns the encrypted text.
On failure, this function returns &false;.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Procedural <function>gnupg_encrypt</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$res = gnupg_init();
gnupg_addencryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC");
$enc = gnupg_encrypt($res, "just a test");
echo $enc;
?>
]]>
</programlisting>
</example>
<example>
<title>OO <function>gnupg_encrypt</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$gpg = new gnupg();
$gpg->addencryptkey("8660281B6051D071D94B5B230549F9DC851566DC");
$enc = $gpg->encrypt("just a test");
echo $enc;
?>
]]>
</programlisting>
</example>
</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
-->