2005-10-29 16:08:09 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2005-10-29 18:51:50 +00:00
|
|
|
<!-- $Revision: 1.2 $ -->
|
2005-10-29 16:08:09 +00:00
|
|
|
<!-- Purpose: utilspec.nontext -->
|
|
|
|
<!-- Membership: pecl -->
|
|
|
|
<!-- State: beta -->
|
|
|
|
<reference id="ref.gnupg">
|
|
|
|
<title>gnupg &Functions;</title>
|
|
|
|
<titleabbrev>gnupg</titleabbrev>
|
|
|
|
|
|
|
|
<partintro>
|
|
|
|
<section id="gnupg.intro">
|
|
|
|
&reftitle.intro;
|
|
|
|
<para>
|
|
|
|
This module allows you to interact with <ulink
|
|
|
|
url="http://www.gnupg.org/">gnupg</ulink>.
|
|
|
|
&warn.experimental;
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section id="gnupg.requirements">
|
|
|
|
&reftitle.required;
|
|
|
|
<para>
|
|
|
|
The gnupg extension requires PHP 4.3.
|
|
|
|
To use this extension in an OO style, PHP 5 is required.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
This extension requires the <ulink
|
|
|
|
url="http://www.gnupg.org/(en)/download/index.html#gpgme">gpgme
|
|
|
|
library</ulink>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
&reference.gnupg.configure;
|
|
|
|
|
|
|
|
&reference.gnupg.constants;
|
|
|
|
|
|
|
|
<section id="gnupg.notes">
|
|
|
|
&reftitle.notes;
|
|
|
|
<para>
|
|
|
|
This extension makes use of the keyring of the current user. This keyring
|
|
|
|
is normaly located in ~./.gnupg/.
|
|
|
|
To specify a custom location, store the path to the keyring in the
|
2005-10-29 18:51:50 +00:00
|
|
|
environment variable GNUPGHOME. See <link
|
2005-10-29 16:08:09 +00:00
|
|
|
linkend='function.putenv'>putenv</link> for more information how to do
|
|
|
|
this.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Some functions require the specification of a key. This specification can
|
|
|
|
be anything that refers to an unique key (userid, key-id, fingerprint
|
|
|
|
...).
|
|
|
|
This documentation uses the fingerprint in all examples.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section id="gnupg.keylistiterator">
|
|
|
|
<title>keylistiterator</title>
|
|
|
|
<para>
|
|
|
|
This extension also comes with an Iterator for your keyring.
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
// create a new iterator for listing all public keys that matches 'example'
|
|
|
|
$iterator = new gnupg_keylistiterator("example");
|
|
|
|
foreach($iterator as $fingerprint => $userid){
|
|
|
|
echo $fingerprint." -> ".$userid."\n";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section id="gnupg.examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
This example will clearsign a given text.
|
|
|
|
</para>
|
|
|
|
<example>
|
|
|
|
<title>gnupg clearsign example (procedural)</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
// init gnupg
|
|
|
|
$res = gnupg_init();
|
2005-10-29 18:51:50 +00:00
|
|
|
// not really needed. Clearsign is default
|
2005-10-29 16:08:09 +00:00
|
|
|
gnupg_setsignmode($res,GNUPG_SIG_MODE_CLEAR);
|
|
|
|
// add key with passphrase 'test' for signing
|
|
|
|
gnupg_addsignkey($res,"8660281B6051D071D94B5B230549F9DC851566DC","test");
|
|
|
|
// sign
|
|
|
|
$signed = gnupg_sign("just a test");
|
|
|
|
echo $signed;
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
<example>
|
|
|
|
<title>gnupg clearsign example (OO)</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
// new class
|
|
|
|
$gnupg = new gnupg();
|
|
|
|
// not really needed. Clearsign is default
|
|
|
|
$gnupg->setsignmode(gnupg::SIG_MODE_CLEAR);
|
|
|
|
// add key with passphrase 'test' for signing
|
|
|
|
$gnupg->addsignkey("8660281B6051D071D94B5B230549F9DC851566DC","test");
|
|
|
|
// sign
|
|
|
|
$signed = $gnupg->sign("just a test");
|
|
|
|
echo $signed;
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</section>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&reference.gnupg.functions;
|
|
|
|
|
|
|
|
</reference>
|
|
|
|
|
|
|
|
<!-- 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:"../../../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
|
|
|
|
-->
|
|
|
|
|