cvs: peardoc /en/package/encryption crypt-gpg.xml /en/package/encryption/crypt-gpg examples.xml generate-key.xml intro.xml referring-to-keys.xml
usage.xml

From: Date: Fri, 16 Jan 2009 16:22:44 +0000
Subject: cvs: peardoc /en/package/encryption crypt-gpg.xml /en/package/encryption/crypt-gpg examples.xml generate-key.xml intro.xml referring-to-keys.xml
usage.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-11429@lists.php.net to get a copy of this message
gauthierm Fri Jan 16 16:22:44 2009 UTC Added files: /peardoc/en/package/encryption/crypt-gpg usage.xml Modified files: /peardoc/en/package/encryption/crypt-gpg examples.xml generate-key.xml intro.xml referring-to-keys.xml /peardoc/en/package/encryption crypt-gpg.xml Log: Updated documentation for Crypt_GPG. Better docbook syntax and add documentation required to close Doc #14645.

http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/examples.xml?r1=1.6&r2=1.7&diff_format=u Index: peardoc/en/package/encryption/crypt-gpg/examples.xml diff -u peardoc/en/package/encryption/crypt-gpg/examples.xml:1.6 peardoc/en/package/encryption/crypt-gpg/examples.xml:1.7 --- peardoc/en/package/encryption/crypt-gpg/examples.xml:1.6 Mon Nov 17 20:01:24 2008 +++ peardoc/en/package/encryption/crypt-gpg/examples.xml Fri Jan 16 16:22:44 2009 @@ -1,50 +1,28 @@ <?xml version="1.0" encoding="utf-8"?> -<refentry +<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="lillet" xml:id="package.encryption.crypt-gpg.examples"> - <refnamediv> - <refname>Examples</refname> - <refpurpose>several small examples of Crypt_GPG's usage</refpurpose> - </refnamediv> - - <!--refentryinfo> - <author> - <firstname>Michael</firstname> - <surname>Gauthier</surname> - </author> - </refentryinfo--> - - <refsection xml:id="package.encryption.crypt-gpg.examples.notes"> - - <info> - <title/> - </info> - - <para> - <note> - <para> - This documentation covers version 0.7.0 of Crypt_GPG which has an API - that is still in beta. The code in these examples is subject to change. - </para> - </note> - <note> - <para> - The following examples assume you have created a key following the - <link linkend="package.encryption.crypt-gpg.generate-key">instructions - for generating a key</link> that can both encrypt and sign data. The - example key has a user id of <emphasis>test@example.com</emphasis> and a - passphrase of <emphasis>test</emphasis>. All signature data is ficticious - but is formatted like real signature data. - </para> - </note> - </para> + <info> + <title>Examples</title> + </info> - </refsection> + <para> + <note> + <para> + The following examples assume you have created a key following the + <link linkend="package.encryption.crypt-gpg.generate-key">instructions + for generating a key</link> that can both encrypt and sign data. The + example key has a user id of <emphasis>test@example.com</emphasis> and a + passphrase of <emphasis>test</emphasis>. All signature data is fictitious + but is formatted like real signature data. + </para> + </note> + </para> - <refsection xml:id="package.encryption.crypt-gpg.examples.signing-file"> + <section xml:id="package.encryption.crypt-gpg.examples.signing-file"> <info> <title>Signing a Package File</title> @@ -66,9 +44,9 @@ </informalexample> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.examples.verifying-file"> + <section xml:id="package.encryption.crypt-gpg.examples.verifying-file"> <info> <title>Verifying a Signed File</title> @@ -102,9 +80,9 @@ </informalexample> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.examples.encrypting-web"> + <section xml:id="package.encryption.crypt-gpg.examples.encrypting-web"> <info> <title>Encrypting a File From the Web</title> @@ -126,9 +104,9 @@ </informalexample> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.examples.encrypting-credit-card"> + <section xml:id="package.encryption.crypt-gpg.examples.encrypting-credit-card"> <info> <title>Encrypting Credit Card Numbers</title> @@ -160,9 +138,9 @@ </informalexample> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.examples.decrypting-credit-card"> + <section xml:id="package.encryption.crypt-gpg.examples.decrypting-credit-card"> <info> <title>Decrypting Credit Card Numbers</title> @@ -190,9 +168,9 @@ </informalexample> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.examples.publish-public-key"> + <section xml:id="package.encryption.crypt-gpg.examples.publish-public-key"> <info> <title>Publishing a Public Key</title> @@ -213,9 +191,9 @@ </informalexample> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.examples.clearsign-message"> + <section xml:id="package.encryption.crypt-gpg.examples.clearsign-message"> <info> <title>Clearsigning a Message</title> @@ -239,9 +217,9 @@ </informalexample> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.examples.verify-clearsign"> + <section xml:id="package.encryption.crypt-gpg.examples.verify-clearsign"> <info> <title>Verifying a Clearsigned Message</title> @@ -278,6 +256,6 @@ </informalexample> </para> - </refsection> + </section> -</refentry> +</section> http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/generate-key.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/encryption/crypt-gpg/generate-key.xml diff -u peardoc/en/package/encryption/crypt-gpg/generate-key.xml:1.4 peardoc/en/package/encryption/crypt-gpg/generate-key.xml:1.5 --- peardoc/en/package/encryption/crypt-gpg/generate-key.xml:1.4 Mon Oct 20 15:40:42 2008 +++ peardoc/en/package/encryption/crypt-gpg/generate-key.xml Fri Jan 16 16:22:44 2009 @@ -1,67 +1,61 @@ <?xml version="1.0" encoding="utf-8"?> -<refentry +<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="lillet" xml:id="package.encryption.crypt-gpg.generate-key"> - <refnamediv> - <refname>Generating a GPG Key</refname> - <refpurpose>outlines how to generate a GPG key for use with Crypt_GPG</refpurpose> - </refnamediv> - - <!--refentryinfo> - <author> - <firstname>Michael</firstname> - <surname>Gauthier</surname> - </author> - </refentryinfo--> - - <refsection xml:id="package.encryption.crypt-gpg.generate-key.intro"> - <info> - <title/> + <title>Generating a GPG Key</title> + <abstract> + <para> + Outlines how to generate a GPG key for use with + <package>Crypt_GPG</package>. + </para> + </abstract> </info> - <para> - Crypt_GPG does not yet support generating GPG keys. Generating a GPG key - for use with Crypt_GPG is much the same as generating any other GPG key on - a system. - </para> - - <para> - <important> - <para> - - Though Crypt_GPG supports - <link xlink:href="&phpdocbase.crypt-gpg.method;__construct">specifying the - keyring to use</link>, Crypt_GPG, by default, uses the keyring of the - current user. If using Crypt_GPG with a webserver such as Apache, the - current user is the Apache user and the key will need to be generated as - the Apache user. To do this, run the gen-key command as: - - <informalexample> - <programlisting> -<command>$ sudo -u apache gpg --gen-key</command> - </programlisting> - </informalexample> - </para> - </important> - </para> - - <para> - The following example walks through the process of generating a key that - supports both encrypting and signing. First, run the command: - - <programlisting> -<command>$ gpg --gen-key</command> - </programlisting> - - </para> - <para> - This will display the following copyright information and a list of - available key types: - <programlisting> + <para> + <package>Crypt_GPG</package> does not yet support generating GPG keys. + Generating a GPG key for use with <package>Crypt_GPG</package> is much + the same as generating any other GPG key on a system. + </para> + + <para> + <important> + <para> + Though <classname>Crypt_GPG</classname> supports + <link xlink:href="&phpdocbase.crypt-gpg.method;__construct">specifying the + keyring to use</link>, <classname>Crypt_GPG</classname>, by default, uses + the keyring of the current user. If using <package>Crypt_GPG</package> + with a webserver such as Apache, the current user is the Apache user and + the key will need to be generated as the Apache user. To do this, run the + <command>gen-key</command> command as: + <informalexample> + <programlisting> + <computeroutput> +<prompt>$ </prompt><command>sudo -u apache gpg --gen-key</command> + </computeroutput> + </programlisting> + </informalexample> + </para> + </important> + </para> + + <para> + The following example walks through the process of generating a key that + supports both encrypting and signing. First, run the command: + <programlisting> + <computeroutput> +<prompt>$ </prompt><command>gpg --gen-key</command> + </computeroutput> + </programlisting> + </para> + <para> + This will display the following copyright information and a list of + available key types: + <programlisting> + <computeroutput> gpg (GnuPG) 1.4.6; Copyright (C) 2006 Free Software Foundation, Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it @@ -70,28 +64,32 @@ (1) DSA and Elgamal (default) (2) DSA (sign only) (5) RSA (sign only) -Your selection? 1 +Your selection? <userinput>1</userinput> DSA keypair will have 1024 bits. - </programlisting> - </para> - - <para> - Select <emphasis>(1) DSA and Elgamal (default)</emphasis> to allow the - generated key to both encrypt and sign data. This will generate a - public-private key pair in the GPG keyring and prompt for the size of the - encryption key: - <programlisting> + </computeroutput> + </programlisting> + </para> + + <para> + Select <emphasis>(1) DSA and Elgamal (default)</emphasis> to allow the + generated key to both encrypt and sign data. This will generate a + public-private key pair in the GPG keyring and prompt for the size of the + encryption key: + <programlisting> + <computeroutput> ELG-E keys may be between 1024 and 4096 bits long. What keysize do you want? (2048) - </programlisting> - </para> - - <para> - Select the default value of 2048. Enter greater or fewer bits depending on - how secure the encryption must be. The default value is considered safe for - most applications. GPG then prompts for the time period over which the - generated key will be valid: - <programlisting> + </computeroutput> + </programlisting> + </para> + + <para> + Select the default value of 2048. Enter greater or fewer bits depending on + how secure the encryption must be. The default value is considered safe for + most applications. GPG then prompts for the time period over which the + generated key will be valid: + <programlisting> + <computeroutput> Please specify how long the key should be valid. 0 = key does not expire &lt;n&gt; = key expires in n days @@ -100,52 +98,58 @@ &lt;n&gt;y = key expires in n years Key is valid for? (0) Key does not expire at all -Is this correct? (y/N) y - </programlisting> - </para> - - <para> - Unless the key needs to expire after a certain time period (preventing - subsequent decryption), a key that does not expire should be used. Next, - enter the three parts of the key's user id. The first part of the user id is - the real name of the person or organization that will use the key to sign or - encrypt data. The second part is an email address and the third is a comment - about the key. Both the email address and comment are optional: - <programlisting> +Is this correct? (y/N) <userinput>y</userinput> + </computeroutput> + </programlisting> + </para> + + <para> + Unless the key needs to expire after a certain time period (preventing + subsequent decryption), a key that does not expire should be used. Next, + enter the three parts of the key's user id. The first part of the user id is + the real name of the person or organization that will use the key to sign or + encrypt data. The second part is an email address and the third is a comment + about the key. Both the email address and comment are optional: + <programlisting> + <computeroutput> You need a user ID to identify your key; the software constructs the user ID from the Real Name, Comment and Email Address in this form: "Heinrich Heine (Der Dichter) &lt;heinrichh@duesseldorf.de&gt;" Real name: Test User Email address: test@example.com Comment: test key -Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o - </programlisting> - </para> - - <para> - After entering the primary user id of the new key, the passphrase must be - selected. A secret passphrase is essential to securing encrypted data. - Guessable passphrases will render encryption useless. For critical data such - as credit card numbers, a non-dictionary word that is at least 8 characters - long is recommended. - <programlisting> +Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? <userinput>o</userinput> + </computeroutput> + </programlisting> + </para> + + <para> + After entering the primary user id of the new key, the passphrase must be + selected. A secret passphrase is essential to securing encrypted data. + Guessable passphrases will render encryption useless. For critical data such + as credit card numbers, a non-dictionary word that is at least 8 characters + long is recommended. + <programlisting> + <computeroutput> You need a Passphrase to protect your secret key. Enter passphrase: Repeat passphrase: - </programlisting> - </para> - - <para> - Following the passphrase, GPG will gather entropy for a period to ensure the - generated key uses sutitably random numbers. When enough entropy is - collected the key is generated and added to the keyring: - <programlisting> + </computeroutput> + </programlisting> + </para> + + <para> + Following the passphrase, GPG will gather entropy for a period to ensure the + generated key uses sutitably random numbers. When enough entropy is + collected the key is generated and added to the keyring: + <programlisting> + <computeroutput> We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. -... snip ... +<replaceable>... snip ...</replaceable> gpg: key DB15A2C9 marked as ultimately trusted public and secret key created and signed. @@ -156,14 +160,13 @@ Key fingerprint = F94A F628 5725 7147 0569 F9FF E995 8292 DB15 A2C9 uid Test User (test key) &lt;test@example.com&gt; sub 2048g/6AD96F48 2008-08-05 - </programlisting> - </para> - - <para> - At this point the key is in the GPG keyring and ready to be used by - Crypt_GPG. - </para> - - </refsection> + </computeroutput> + </programlisting> + </para> + + <para> + At this point the key is in the GPG keyring and ready to be used by + <package>Crypt_GPG</package>. + </para> -</refentry> +</section> http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/intro.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/encryption/crypt-gpg/intro.xml diff -u peardoc/en/package/encryption/crypt-gpg/intro.xml:1.4 peardoc/en/package/encryption/crypt-gpg/intro.xml:1.5 --- peardoc/en/package/encryption/crypt-gpg/intro.xml:1.4 Mon Oct 20 15:40:42 2008 +++ peardoc/en/package/encryption/crypt-gpg/intro.xml Fri Jan 16 16:22:44 2009 @@ -1,44 +1,39 @@ <?xml version="1.0" encoding="utf-8"?> -<refentry +<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="lillet" xml:id="package.encryption.crypt-gpg.intro"> - <refnamediv> - <refname>Introduction and Overview</refname> - <refpurpose>introduces the Crypt_GPG package</refpurpose> - </refnamediv> - - <!--refentryinfo> - <author> - <firstname>Michael</firstname> - <surname>Gauthier</surname> - </author> - </refentryinfo--> - - <refsection xml:id="package.encryption.crypt-gpg.intro.intro"> - <info> - <title>Introduction</title> + <title>Introduction and Overview</title> </info> + <section xml:id="package.encryption.crypt-gpg.intro.intro"> + + <info> + <title>Introduction</title> + </info> + <para> - Crypt_GPG is a PHP package to interact with the - <link xlink:href="http://www.gnupg.org/">GNU Privacy Guard (GPG)</link>. GPG - is a free and open-source implementation of the <link xlink:href="http://www.ietf.org/rfc/rfc4880.txt">OpenPGP protocol</link>, - providing key managment, data encryption and data signing. Crypt_GPG - provides an object-oriented API for performing OpenPGP commands using GPG. + <package>Crypt_GPG</package> is a PHP package to interact with the + <link xlink:href="http://www.gnupg.org/"><application>GNU Privacy Guard (GPG)</application></link>. + GPG is a free and open-source implementation of the <link xlink:href="http://www.ietf.org/rfc/rfc4880.txt">OpenPGP protocol</link>, + providing key management, data encryption and data signing. + <package>Crypt_GPG</package> provides an object-oriented API for performing + OpenPGP commands using GPG. </para> <para> - GPG is distributed as an executable program with a command line argument - syntax for performing commands. Crypt_GPG uses PHP's <link xlink:href="http://ca3.php.net/manual/en/ref.exec.php">program execution - functions</link> to run GPG as a subprocess thus performing the desired - command. Crypt_GPG automatically handles process control, stream handling - and error checking of the GPG subprocess. Crypt_GPG uses PHP streams - internally for most actions, allowing (among other things) any streamable - resource to be used with the Crypt_GPG file commands. + GPG is distributed as an executable program with a command-line argument + syntax for performing commands. <package>Crypt_GPG</package> uses PHP's + <link xlink:href="http://ca3.php.net/manual/en/ref.exec.php">program + execution functions</link> to run GPG as a subprocess thus performing the + desired command. <package>Crypt_GPG</package> automatically handles process + control, stream handling and error checking of the GPG subprocess. + <package>Crypt_GPG</package> uses PHP streams internally for most actions, + allowing (among other things) any streamable resource to be used with the + <package>Crypt_GPG</package> file commands. </para> <para> @@ -50,17 +45,17 @@ </note> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.intro.overview"> + <section xml:id="package.encryption.crypt-gpg.intro.overview"> <info> <title>Overview</title> </info> <para> - The basic internal overview of a GPG command executed in Crypt_GPG is as - follows: + The basic internal overview of a GPG command executed in + <package>Crypt_GPG</package> is as follows: <orderedlist> <listitem> <para>build the required command line,</para> @@ -83,10 +78,10 @@ </orderedlist> </para> <para> - Crypt_GPG handles all these details internally so GPG can be used with - minimal effort from the developer. + <package>Crypt_GPG</package> handles all these details internally so GPG can + be used with minimal effort from the developer. </para> - </refsection> + </section> -</refentry> +</section> http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml diff -u peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml:1.4 peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml:1.5 --- peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml:1.4 Mon Oct 20 15:40:42 2008 +++ peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml Fri Jan 16 16:22:44 2009 @@ -1,40 +1,43 @@ <?xml version="1.0" encoding="utf-8"?> -<refentry +<section xmlns="http://docbook.org/ns/docbook" + xmlns:xlink="http://www.w3.org/1999/xlink" version="lillet" xml:id="package.encryption.crypt-gpg.referring-to-keys"> - <refnamediv> - <refname>Referring to Keys</refname> - <refpurpose>outlines how to refer to GPG keys in code using Crypt_GPG</refpurpose> - </refnamediv> - - <!--refentryinfo> - <author> - <firstname>Michael</firstname> - <surname>Gauthier</surname> - </author> - </refentryinfo--> + <info> + <title>Referring to Keys</title> + <abstract> + <para> + Outlines how to refer to GPG keys in code using + <package>Crypt_GPG</package>. + </para> + </abstract> + </info> - <refsection xml:id="package.encryption.crypt-gpg.referring-to-keys.fingerprint"> + <section xml:id="package.encryption.crypt-gpg.referring-to-keys.fingerprint"> <info> <title>Fingerprint</title> </info> <para> - Crypt_GPG supports referring to a key in several ways. The most definitive - way to refer to a specific key is to use the key's fingerprint. Key - fingerprints are generated by performing a checksum on the actual content - of a key. A fingerprint appears as a string of hex characters that may - sometimes be separated by spaces or colons. For example: <emphasis>F94A F628 - 5725 7147 0569 F9FF E995 8292 DB15 A2C9</emphasis>. The fingerprint of a - key can be retrieved using the <function>Crypt_GPG::getKeys</function> and - <function>Crypt_GPG::getFingerprint</function> methods. Alternatively, - the following command may be used to list keys on a console: + <package>Crypt_GPG</package> supports referring to a key in several ways. + The most definitive way to refer to a specific key is to use the key's + fingerprint. Key fingerprints are generated by performing a checksum on the + actual content of a key. A fingerprint appears as a string of hexadecimal + characters, sometimes separated by spaces or colons. For example: + <literal>F94A F628 5725 7147 0569 F9FF E995 8292 DB15 A2C9</literal>. The + fingerprint of a key can be retrieved using the + <methodname>Crypt_GPG::<link xlink:href="&phpdocbase.crypt-gpg.method;getKeys">getKeys()</link></methodname> and + <methodname>Crypt_GPG::<link xlink:href="&phpdocbase.crypt-gpg.method;getFingerprint">getFingerprint()</link></methodname> + methods. Alternatively, the following command may be used to list keys on + a console: <informalexample> <programlisting> -<command>$ gpg --list-keys --with-fingerprint --with-fingerprint</command> + <computeroutput> +<prompt>$ </prompt><command>gpg --list-keys --with-fingerprint --with-fingerprint</command> + </computeroutput> </programlisting> </informalexample> <note> @@ -44,9 +47,9 @@ </note> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.referring-to-keys.id"> + <section xml:id="package.encryption.crypt-gpg.referring-to-keys.id"> <info> <title>Key ID</title> @@ -54,13 +57,15 @@ <para> Keys may also be referenced by the key id. The key id is an eight-octal long - hexidecimal number. The key id can be obtained using - <function>Crypt_GPG::getKeys</function>. Though rare, it is possible to have - two keys with the same key id. The key id may also be obtained using the - following command: + hexadecimal number. The key id can be obtained using + <methodname>Crypt_GPG::<link xlink:href="&phpdocbase.crypt-gpg.method;getKeys">getKeys()</link></methodname>. + Though rare, it is possible to have two keys with the same key id. The key + id may also be obtained using the following command: <informalexample> <programlisting> -<command>$ gpg --list-keys --with-colons</command> + <computeroutput> +<prompt>$ </prompt><command>gpg --list-keys --with-colons</command> + </computeroutput> </programlisting> </informalexample> The key id is the fifth colon-separated field. A partial key id may also be @@ -68,14 +73,16 @@ full key id and may be obtained using the following command: <informalexample> <programlisting> -<command>$ gpg --list-keys</command> + <computeroutput> +<prompt>$ </prompt><command>gpg --list-keys</command> + </computeroutput> </programlisting> </informalexample> </para> - </refsection> + </section> - <refsection xml:id="package.encryption.crypt-gpg.referring-to-keys.user-id"> + <section xml:id="package.encryption.crypt-gpg.referring-to-keys.user-id"> <info> <title>User ID</title> @@ -93,6 +100,6 @@ form of <emphasis>test@example.com</emphasis> is fine to use. </para> - </refsection> + </section> -</refentry> +</section> http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/encryption/crypt-gpg.xml diff -u peardoc/en/package/encryption/crypt-gpg.xml:1.4 peardoc/en/package/encryption/crypt-gpg.xml:1.5 --- peardoc/en/package/encryption/crypt-gpg.xml:1.4 Thu Oct 9 22:35:23 2008 +++ peardoc/en/package/encryption/crypt-gpg.xml Fri Jan 16 16:22:44 2009 @@ -8,6 +8,7 @@ &package.encryption.crypt-gpg.intro; &package.encryption.crypt-gpg.generate-key; + &package.encryption.crypt-gpg.usage; &package.encryption.crypt-gpg.referring-to-keys; &package.encryption.crypt-gpg.examples; http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/usage.xml?view=markup&rev=1.1 Index: peardoc/en/package/encryption/crypt-gpg/usage.xml +++ peardoc/en/package/encryption/crypt-gpg/usage.xml <?xml version="1.0" encoding="utf-8"?> <section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="lillet" xml:id="package.encryption.crypt-gpg.usage"> <info> <title>Usage</title> </info> <section xml:id="package.encryption.crypt-gpg.usage.creating"> <info> <title>Creating The GPG Object</title> </info> <para> The <classname>Crypt_GPG</classname> class is the main entry point for using <package>Crypt_GPG</package>. To use GPG in your project, create an instance of <classname>Crypt_GPG</classname> and then call methods on the object to perform GPG commands. </para> <para> The <classname>Crypt_GPG</classname> class supports several options, which may be specified in the constructor. Options may be used for the following: </para> <section> <info> <title>Specifying Keyring Location</title> </info> <para> Sometimes, specifying the location of the keyring is required. One such case case is when using <classname>Crypt_GPG</classname> from the context of a Web page when the Web-server's user does not have a home directory, or does not have write access to its home directory. This is often the case on shared hosts. In this case, you should specify the GPG keyring location as an existing writeable directory. This is done using the <literal>homedir</literal> option. For example: <informalexample> <programlisting role="php"><![CDATA[ <?php require_once 'Crypt/GPG.php'; // Specify homedir as an existing writeable directory if the web user // does not have a home directoryi, or if the web user's home directory // is not writeable. $gpg = new Crypt_GPG(array('homedir' => '/my/writeable/directory')); ?> ]]></programlisting> </informalexample> </para> </section> <section> <info> <title>Showing Debug Information</title> </info> <para> If, for some reason, <package>Crypt_GPG</package> does not seem to work correctly, detailed debugging information may be turned on. This is done using the <literal>debug</literal> option. When providing bug reports for the <package>Crypt_GPG</package> package, you may be asked to turn on deubg mode. Example: <informalexample> <programlisting role="php"><![CDATA[ <?php require_once 'Crypt/GPG.php'; // Enable debug mode. This will dump a lot of output when Crypt_GPG // actions are performed. $gpg = new Crypt_GPG(array('debug' => true)); ?> ]]></programlisting> </informalexample> </para> </section> <section> <info> <title>Specifying the GPG Binary Location</title> </info> <para> <package>Crypt_GPG</package> works by talking to the GPG subprocess. As a result, it needs to know the location of the GPG binary to work properly. In most cases, <package>Crypt_GPG</package> will detect the location of the GPG binary automatically. If the location is detected incorrectly, or if the GPG binary is installed in a custom location, the <literal>binary</literal> option may be used. For example: <informalexample> <programlisting role="php"><![CDATA[ <?php require_once 'Crypt/GPG.php'; // Specify custom location of GPG binary. $gpg = new Crypt_GPG(array('binary' => '/home/joe/bin/gpg')); ?> ]]></programlisting> </informalexample> </para> <para> If an invalid binary location is specified, <classname>Crypt_GPG</classname> will throw an exception. </para> </section> </section> <!--section xml:id="package.encryption.crypt-gpg.usage.api"> <info> <title>API Calls</title> </info> <para> Foo </para> </section--> </section>
« previous php.pear.doc (#11429) next »