1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- 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 normally located in ~./.gnupg/.
To specify a custom location, store the path to the keyring in the
environment variable GNUPGHOME. See <link
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();
// not really needed. Clearsign is default
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
-->
|