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

From: Date: Mon, 20 Oct 2008 15:40:42 +0000
Subject: cvs: peardoc /en/package/encryption/crypt-gpg examples.xml generate-key.xml intro.xml referring-to-keys.xml /entities global.ent
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-11228@lists.php.net to get a copy of this message
gauthierm Mon Oct 20 15:40:42 2008 UTC Modified files: /peardoc/entities global.ent /peardoc/en/package/encryption/crypt-gpg examples.xml generate-key.xml intro.xml referring-to-keys.xml Log: Add API documentation entities for Crypt_GPG package and fix a bug in the verify method examples.

http://cvs.php.net/viewvc.cgi/peardoc/entities/global.ent?r1=1.2&r2=1.3&diff_format=u Index: peardoc/entities/global.ent diff -u peardoc/entities/global.ent:1.2 peardoc/entities/global.ent:1.3 --- peardoc/entities/global.ent:1.2 Thu Oct 9 16:11:15 2008 +++ peardoc/entities/global.ent Mon Oct 20 15:40:42 2008 @@ -1,6 +1,6 @@ <!-- -*- SGML -*- - $Id: global.ent,v 1.2 2008/10/09 16:11:15 saltybeagle Exp $ + $Id: global.ent,v 1.3 2008/10/20 15:40:42 gauthierm Exp $ Contains global "macros" for all the XML documents. @@ -280,3 +280,5 @@ <!ENTITY phpdocbase.datetime-date_timezone.method "http://pear.php.net/package/Date/docs/latest/Date/Date_TimeZone.html#class_methods"> <!ENTITY phpdocbase.games-chess "http://pear.php.net/package/Games_Chess/docs/latest/Games_Chess/"> <!ENTITY phpdocbase.image-image_transform "http://pear.php.net/package/Image_Transform/docs/latest/Image_Transform/Image_Transform.html#method"> +<!ENTITY phpdocbase.crypt-gpg.method "http://pear.php.net/package/Crypt_GPG/docs/latest/Crypt_GPG/Crypt_GPG.html#method"> +<!ENTITY phpdocbase.crypt-gpg_signature.method "http://pear.php.net/package/Crypt_GPG/docs/latest/Crypt_GPG/Crypt_GPG_Signature.html#method"> http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/examples.xml?r1=1.4&r2=1.5&diff_format=u Index: peardoc/en/package/encryption/crypt-gpg/examples.xml diff -u peardoc/en/package/encryption/crypt-gpg/examples.xml:1.4 peardoc/en/package/encryption/crypt-gpg/examples.xml:1.5 --- peardoc/en/package/encryption/crypt-gpg/examples.xml:1.4 Thu Oct 9 15:16:26 2008 +++ peardoc/en/package/encryption/crypt-gpg/examples.xml Mon Oct 20 15:40:42 2008 @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.encryption.crypt-gpg.examples"> +<refentry + 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> @@ -13,9 +17,11 @@ </author> </refentryinfo--> - <refsection xml:id="package.encryption.crypt-gpg.examples.notes"><info><title/></info> + <refsection xml:id="package.encryption.crypt-gpg.examples.notes"> - + <info> + <title/> + </info> <para> <note> @@ -38,9 +44,11 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.examples.signing-file"><info><title>Signing a Package File</title></info> + <refsection xml:id="package.encryption.crypt-gpg.examples.signing-file"> - + <info> + <title>Signing a Package File</title> + </info> <para> <informalexample> @@ -49,11 +57,9 @@ require_once 'Crypt/GPG.php'; -$data = file_get_contents($package_file_name); - $gpg = new Crypt_GPG(); $gpg->addSignKey('test@example.com', 'test'); -$signature = $gpg->sign($data, Crypt_GPG::SIGN_MODE_DETACHED); +$signature = $gpg->signFile($filename, Crypt_GPG::SIGN_MODE_DETACHED); echo "Package signature is: ", $signature, "\n"; @@ -64,9 +70,11 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.examples.verifying-file"><info><title>Verifying a Signed File</title></info> + <refsection xml:id="package.encryption.crypt-gpg.examples.verifying-file"> - + <info> + <title>Verifying a Signed File</title> + </info> <para> <informalexample> @@ -75,7 +83,7 @@ require_once 'Crypt/GPG.php'; -$signature = <<<DATA +$signature = <<<DATA -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBIl9Tf6ZWCktsVoskRAoAKAJ9VkbFDTSGY2ygaEGBcMOE8Or9puwCgppYm @@ -84,11 +92,10 @@ -----END PGP SIGNATURE----- DATA; -$signedData = file_get_contents($package_file_name); $gpg = new Crypt_GPG(); -$details = $gpg->verify($signed_data, $signature); +$signatures = $gpg->verifyFile($filename, $signature); -if ($details->isValid()) { +if ($signatures[0]->isValid()) { echo "Package is valid.\n"; } else { echo "Package is invalid!\n"; @@ -101,9 +108,36 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.examples.encrypting-credit-card"><info><title>Encrypting Credit Card Numbers</title></info> + <refsection xml:id="package.encryption.crypt-gpg.examples.encrypting-web"> - + <info> + <title>Encrypting a File From the Web</title> + </info> + + <para> + <informalexample> + <programlisting role="php"><![CDATA[ +<?php + +require_once 'Crypt/GPG.php'; + +$gpg = new Crypt_GPG(); +$gpg->addEncryptKey('test@example.com'); +// you can use any fopen-able stream +$gpg->encryptFile('http://example.com/file.html', '~/file.html.asc'); + +?> + ]]></programlisting> + </informalexample> + </para> + + </refsection> + + <refsection xml:id="package.encryption.crypt-gpg.examples.encrypting-credit-card"> + + <info> + <title>Encrypting Credit Card Numbers</title> + </info> <para> <informalexample> @@ -135,9 +169,11 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.examples.decrypting-credit-card"><info><title>Decrypting Credit Card Numbers</title></info> + <refsection xml:id="package.encryption.crypt-gpg.examples.decrypting-credit-card"> - + <info> + <title>Decrypting Credit Card Numbers</title> + </info> <para> <informalexample> @@ -165,9 +201,11 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.examples.publish-public-key"><info><title>Publishing a Public Key</title></info> + <refsection xml:id="package.encryption.crypt-gpg.examples.publish-public-key"> - + <info> + <title>Publishing a Public Key</title> + </info> <para> <informalexample> @@ -179,8 +217,7 @@ $gpg = new Crypt_GPG(); echo "My public key is: ", $gpg->exportPublicKey('test@example.com'), "\n"; echo "My key fingerprint is: ", - $gpg->getFingerprint('test@example.com', Crypt_GPG::FORMAT_CANONICAL), - "\n"; + $gpg->getFingerprint('test@example.com', Crypt_GPG::FORMAT_CANONICAL), "\n"; ?> ]]></programlisting> @@ -189,9 +226,11 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.examples.clearsign-message"><info><title>Clearsigning a Message</title></info> + <refsection xml:id="package.encryption.crypt-gpg.examples.clearsign-message"> - + <info> + <title>Clearsigning a Message</title> + </info> <para> <informalexample> @@ -215,9 +254,11 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.examples.verify-clearsign"><info><title>Verifying a Clearsigned Message</title></info> + <refsection xml:id="package.encryption.crypt-gpg.examples.verify-clearsign"> - + <info> + <title>Verifying a Clearsigned Message</title> + </info> <para> <informalexample> @@ -238,10 +279,10 @@ -----END PGP SIGNATURE----- DATA; -$gpg = new Crypt_GPG(); -$details = $gpg->verify($signedData); +$gpg = new Crypt_GPG(); +$signatures = $gpg->verify($signedData); -if ($details->isValid()) { +if ($signatures[0]->isValid()) { echo "Message is valid.\n"; } else { echo "Message is invalid!\n"; http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/generate-key.xml?r1=1.3&r2=1.4&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.3 peardoc/en/package/encryption/crypt-gpg/generate-key.xml:1.4 --- peardoc/en/package/encryption/crypt-gpg/generate-key.xml:1.3 Thu Oct 9 15:16:26 2008 +++ peardoc/en/package/encryption/crypt-gpg/generate-key.xml Mon Oct 20 15:40:42 2008 @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.encryption.crypt-gpg.generate-key"> +<refentry + 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> @@ -13,9 +17,11 @@ </author> </refentryinfo--> - <refsection xml:id="package.encryption.crypt-gpg.generate-key.intro"><info><title/></info> + <refsection xml:id="package.encryption.crypt-gpg.generate-key.intro"> - + <info> + <title/> + </info> <para> Crypt_GPG does not yet support generating GPG keys. Generating a GPG key @@ -26,12 +32,13 @@ <para> <important> <para> - Though Crypt_GPG supports specifying the keyring to use <!-- TODO: link - to options -->, 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: + + 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> http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/intro.xml?r1=1.3&r2=1.4&diff_format=u Index: peardoc/en/package/encryption/crypt-gpg/intro.xml diff -u peardoc/en/package/encryption/crypt-gpg/intro.xml:1.3 peardoc/en/package/encryption/crypt-gpg/intro.xml:1.4 --- peardoc/en/package/encryption/crypt-gpg/intro.xml:1.3 Thu Oct 9 15:16:26 2008 +++ peardoc/en/package/encryption/crypt-gpg/intro.xml Mon Oct 20 15:40:42 2008 @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> -<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.encryption.crypt-gpg.intro"> +<refentry + 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> @@ -13,21 +17,23 @@ </author> </refentryinfo--> - <refsection xml:id="package.encryption.crypt-gpg.intro.intro"><info><title>Introduction</title></info> + <refsection 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 xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.gnupg.org/">GNU Privacy Guard (GPG)</link>. GPG - is a free and open-source implementation of the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.ietf.org/rfc/rfc4880.txt">OpenPGP protocol</link>, + <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. </para> <para> GPG is distributed as an executable program with a command line argument - syntax for performing commands. Crypt_GPG uses PHP's <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://ca3.php.net/manual/en/ref.exec.php">program execution + 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 @@ -46,9 +52,11 @@ </refsection> - <refsection><info><title>Overview</title></info> + <refsection 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 http://cvs.php.net/viewvc.cgi/peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml?r1=1.3&r2=1.4&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.3 peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml:1.4 --- peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml:1.3 Thu Oct 9 15:16:26 2008 +++ peardoc/en/package/encryption/crypt-gpg/referring-to-keys.xml Mon Oct 20 15:40:42 2008 @@ -1,5 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> -<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.encryption.crypt-gpg.referring-to-keys"> +<refentry + xmlns="http://docbook.org/ns/docbook" + version="lillet" + xml:id="package.encryption.crypt-gpg.referring-to-keys"> <refnamediv> <refname>Referring to Keys</refname> @@ -13,9 +16,11 @@ </author> </refentryinfo--> - <refsection xml:id="package.encryption.crypt-gpg.referring-to-keys.fingerprint"><info><title>Fingerprint</title></info> + <refsection 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 @@ -41,9 +46,11 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.referring-to-keys.id"><info><title>Key ID</title></info> + <refsection xml:id="package.encryption.crypt-gpg.referring-to-keys.id"> - + <info> + <title>Key ID</title> + </info> <para> Keys may also be referenced by the key id. The key id is an eight-octal long @@ -68,9 +75,11 @@ </refsection> - <refsection xml:id="package.encryption.crypt-gpg.referring-to-keys.user-id"><info><title>User ID</title></info> + <refsection xml:id="package.encryption.crypt-gpg.referring-to-keys.user-id"> - + <info> + <title>User ID</title> + </info> <para> Lastly, keys may be referenced by all or part of the key's user id. For
« previous php.pear.doc (#11228) next »