GnuPG-Interface-1.02/000755 000765 000024 00000000000 14034140256 015100 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/inc/000755 000765 000024 00000000000 14034140255 015650 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/test/000755 000765 000024 00000000000 14034140255 016056 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/SIGNATURE000644 000765 000024 00000014374 14034140256 016375 0ustar00jbrandtstaff000000 000000 This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.79. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 SHA1 58df30f41479b74a5136dce6cb57903bb9bccf6f Changes SHA1 b8afd3fa6b961d3e0a64dd941b07b2bf08a18020 MANIFEST SHA1 01aaeb25c70093c04dd0b27f8619332393830652 MANIFEST.SKIP SHA1 ad518658d7ce95936baa78955559d9b912b92b55 META.yml SHA1 c121366967afd6b218323ea4df929d1bbed43110 Makefile.PL SHA1 2fc4a445629985a484469b495f1ceb15f7b635d9 README SHA1 c3f8f9f2a209f80b7ca3c8af3a6b1b7b408ad620 inc/Module/Install.pm SHA1 de30b539a326675c42e6ad360fddb05902d621be inc/Module/Install/Base.pm SHA1 81fffeca82bcd7100d8435b139f0780fcc5cdf9c inc/Module/Install/Can.pm SHA1 b4dd9cb3cf0cb60390c575bd3405e2297d4a0b1a inc/Module/Install/Fetch.pm SHA1 b84cf97b12f8e5ef37bea54e33ddce32dff804d1 inc/Module/Install/Makefile.pm SHA1 0d9fd69718198fcd1560214c4f23fcaa44f8395e inc/Module/Install/Metadata.pm SHA1 8d19f4485276b987b7838d4ec01909f8055a4724 inc/Module/Install/ReadmeFromPod.pm SHA1 99b8179fbd9e05422b161cf91abe198744188064 inc/Module/Install/Win32.pm SHA1 6a91e14bbecc64e9c8e2261dfa4b360641d152e4 inc/Module/Install/WriteAll.pm SHA1 0b8019dedbd45a368d11088e29ef9f169ed40539 lib/GnuPG/Fingerprint.pm SHA1 7d9dc51ba25c5525d796c195ab2a15380f78029d lib/GnuPG/Handles.pm SHA1 b2fe771ca9a1d719b222013e08b93ab57f7452e8 lib/GnuPG/HashInit.pm SHA1 08af10bd5fa9f78c8064a211810a17454050d482 lib/GnuPG/Interface.pm SHA1 fc1ae42e880aa2b730e77f4a46da33ff4ce578fc lib/GnuPG/Key.pm SHA1 a9aeb895a186cffec1828bf9fca9411234505b47 lib/GnuPG/Options.pm SHA1 bd3ab65a9089e086ff3bf44781a099830cdd2f6e lib/GnuPG/PrimaryKey.pm SHA1 a38e294729aac733fafcf9d7e4b7ef5fcb50e685 lib/GnuPG/PublicKey.pm SHA1 4b917013b36c4e66bdf3ae27cc8e056c9bd6be64 lib/GnuPG/Revoker.pm SHA1 3dbf6667b73b61dff5bc8db30b6dd81415297c09 lib/GnuPG/SecretKey.pm SHA1 f19dfa77fd83fcc520aa2246318b359c0ba844cd lib/GnuPG/Signature.pm SHA1 3267654e96c0fbe6805c466f193e92c5cd8a5e5b lib/GnuPG/SubKey.pm SHA1 acfec9fd5e879711280d5ac8ebfd667fde8d4f1e lib/GnuPG/UserAttribute.pm SHA1 d70a9e4c89b2fe445c733dc9c177d62cc9f44826 lib/GnuPG/UserId.pm SHA1 b9e982d8360e168c1c9d565582e42f2dd792062b t/000_setup.t SHA1 367fdb308292a9c005afffef49ff9096a20a4da3 t/Fingerprint.t SHA1 d9dd42839cf88b708fc1a87ebb8d4cec1e9be51c t/Interface.t SHA1 980fcd5a1d302e65cc2414be96d5f3a4266e8308 t/MyTest.pm SHA1 53f15a6d3c5c3943ade61f5fe597d537b6b2b068 t/MyTestSpecific.pm SHA1 ccd942d9f00627253d7eb9c011116dc5671639b8 t/UserId.t SHA1 e2e53ab9458c61d32b973a16d32573a954e13769 t/clearsign.t SHA1 d89a92151669da3fec256502f5014261077e2226 t/decrypt.t SHA1 b828dfb74321c117264b4418cf57d2da3d96f7c4 t/detach_sign.t SHA1 f7471dc0a0d56ddd4b3c914b6f8b835eecc38660 t/encrypt.t SHA1 2d8d00e2bd767c658c2a795ec970398af3c87ebe t/encrypt_symmetrically.t SHA1 ae21d78d4a3af65ff7eaef240cc90f3d09a2229e t/export_keys.t SHA1 e4083dae3946081b3a757825213a131e78e5dc09 t/get_public_keys.t SHA1 9d64b90da57e904bcae368496e78d4f132604b8c t/get_secret_keys.t SHA1 5a4cbcdac983766a60f5f25db20bf81f251c9b3a t/import_keys.t SHA1 6dd9228dc8316384b5fc6410012f7fd5eac19c19 t/list_public_keys.t SHA1 d75d9f785b3094421011f0ad8c1799dad225aff4 t/list_secret_keys.t SHA1 d0bb05cee33efd536962e28b9f1eacd2cb03bf2b t/list_sigs.t SHA1 07a602cbb5a78518cd4cccfb7007e80564a19e1e t/passphrase_handling.t SHA1 99c53aa0a919cbf16cba74be84c6cff3af0cd097 t/sign.t SHA1 cef254d25a4c8a8b2e02d4f215d2297b95f07f1c t/sign_and_encrypt.t SHA1 cabbf4e667027f9bb7958673bc9b8be2d1577e29 t/verify.t SHA1 c66d9fcfc45a37d72c729eefba9a377d5778329f t/version_updates.t SHA1 8fd17bc4ad8ac4c4357503edfe2d1a952a44c28b t/wrap_call.t SHA1 375f99600a05d4b1bbaff046bd079194e1625bb1 t/z_delete_keys.t SHA1 c005f5b1de96721e9455ddc3dc727d5d4bd17615 t/zzz_cleanup.t SHA1 58f58338a2922798c59c5e852bd0110541f27e2d test/encrypted.1.gpg SHA1 6b4f8006e15940ca93d8629a145258bdc109edd3 test/encrypted.2.gpg SHA1 3b0e1dbd40b361ceda883f1a563201ff65fc25d8 test/fake-gpg-v1 SHA1 c0686932708d254906a003a5ffe46f170530022d test/fake-gpg-v2 SHA1 3c6c6dd448fcf2a67b241fead821146489e6e46f test/fake-pinentry.pl SHA1 1290379acadab2cc713d659c7c3feff2b0923f75 test/gpg.conf SHA1 b012a47f295ee9dcc955560b9a78c0ad3a61e137 test/key.1.asc SHA1 6a34c098dd418f13266020d4c7e810f2da08e7b0 test/new_secret.pgp SHA1 4e1243bd22c66e76c2ba9eddc1f91394e57f9f83 test/passphrase SHA1 59c0e6436b38645144d17ce11ac4aabfdd43e960 test/plain.1.txt SHA1 a2e120b6c6effab16d8734ea6e56e80a28858742 test/plain.2.txt SHA1 7d94ea032bdbb0104c1dc73583ec64ade6294495 test/public-keys-sigs/1.0.test SHA1 63d93054decf9ff6c2dc99eb03f131b55af4ee43 test/public-keys-sigs/1.1.test SHA1 bd9892a93f802c68109b11b756f79f6b0292eb1a test/public-keys-sigs/2.0.test SHA1 73d90696020a01753cda984262a2831dcc6ac0d7 test/public-keys-sigs/2.1.test SHA1 82d483adc6d203c79856a70dd259370f6efdeef7 test/public-keys/1.0.test SHA1 86056ad37b8bb67d55ac61b5d5a27ac4bbd1cceb test/public-keys/1.1.test SHA1 a8e97a2439671dae0dd29a2404c321ccb686ba7a test/public-keys/2.0.test SHA1 54d2c13bf3b73b7582edef091175dfe3763ddf59 test/public-keys/2.1.test SHA1 4349906c08f65af3b13e7b441ac4dd2e637bfeae test/public_keys.pgp SHA1 8fcae9373283d70fc2b941ebd5e59fc03147b40b test/secret-keys/1.0.test SHA1 5ab2fd7245b905259aa5dccc023f1e0a4417a55a test/secret-keys/1.1.test SHA1 3d9fc47a5598f62170aee923d7b00f81079cb6bc test/secret-keys/1.2.test SHA1 3bd6135279f9ae23e32680707c6170910421e5de test/secret-keys/2.0.test SHA1 9ce5508cd8cefadc4c9bf2842864b52e87b1826e test/secret_keys.pgp SHA1 981418a80bf7dab91b63608cfd1ddf5091f89ad7 test/signed.1.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEFelFwSnB+u9xCpouFedxUadmpRQFAmBwwK4ACgkQFedxUadm pRT+lgf/Uhf7JupcQmMWYRWHkPlAWVeL4M5Ip/rJt/p/0yytdaDMgxztLEq4/ynE n7D2lZKDUrfWiARO+l6xBllHkm+ilvZgpLH7ENR7VWZGg8TwmRVDwgmjKMdTSZ8x arSmCdlN2OrSp9PTnRNDYbK5nZrQgQ/1QNz3rerQFcnxgKbAxwcNmBHIiPOxQmLa HO6W91DHZaEQ1+yFE6FZYAqFUazwG3XhrH3gyshJCfWcReyHtcZMpGbWxHVjApH0 tiLoRB9DFs0YHWBCVE3k14UgeKTfNTcGbJFDLQWwTHDLwt9pz0X4oLlTBRZYeYv9 a0O80zh3dM5tUMfWw9rAkz+14XH9qQ== =VCIr -----END PGP SIGNATURE----- GnuPG-Interface-1.02/Changes000644 000765 000024 00000020764 14034140010 016370 0ustar00jbrandtstaff000000 000000 Revision history for GnuPG-Interface 1.02 - 2021-04-09 - Work around an issue with CLI options for deleting secret keys in gpg 2.2 1.01 - 2021-01-26 - Make $gnupg->call('foo') update the internal GnuPG version number. - Localize tainted PATH env to make exec happy 1.0 - 2020-05-13 - Limit support to GnuPG 2.2+ and 1.4 - Additional information from keys when using GnuPG 2.2 or higher - Add support for use of agent/pinentry - Updated options to add ignore_mdc_error and logging - Improvements to tests - Update pubkey_data documentation - Special thanks to dkg on Github for a large PR with updates for GnuPG 2 - Thanks also to ntyni on Github for a pointer to test updates also dealing with version changes 0.52 - 2016-02-16 - Skip "grp" records, generated by GPG 2.1; this suppresses "unknown record type" warnings - Add explicit Fatal dependency; though nominally part of code perl, RedHat's perl does not ship with it - Ensure that the trustdb is created before attempting to encrypt; gpg2 requires that it exist, even for commands with --trust-model=always. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751266 0.51 - 2014-12-17 - Update README file - Work around gpg2 bug by omitting --homedir during symmetric encryption 0.50 - 2014-03-14 - Version 0.49 implicitly required Moose; switch to a technique that does not - Modernize CHANGES 0.49 - 2014-03-13 - Restore context-sensitive (array/arrayref) behavior of multiple array methods from 0.46. - Fix MANIFEST/.gitignore inconsistency 0.48 - 2014-03-10 - Switch from --always-trust to --trust-model=always 0.47 - 2014-03-10 - No changes from 0.47_02 0.47_02 - 2014-02-14 - Remove a stray 'use Data::Dumper::Concise' added in 0.47_01 0.47_01 - 2014-01-27 - Switch from Any::Moose to Moo - Accept "gpg (GnuPG/MacGPG2)" as a valid gpg version - Typo fixes in documentation 0.46 - 2012-10-25 - Add a ->search_keys method - Add a ->version method - Remove dead code for finding gnupg2 binary 0.45 - 2011-10-26 - Include trailing columns when parsing --fixed-list-mode output 0.44 - 2011-05-02 - Bump Math::BigInt dependency to get the new 'try GMP' syntax. 0.43 - 2011-03-08 - Stable release 0.42_02 - 2010-06-05 - Additional cleanups from dkg 0.42_01 - 2010-05-10 - GnuPG::Revoker: improve docs, compare() should fail if the signature counts differ - dkg - Handle revoker packets (rvk) - dkg - Move compare() into GnuPG::Signature, got rid of t/GnuPG/ComparableSignature.pm - dkg - Move signature comparison into ComparableKey.pm instead of ComparableSubKey.pm - dkg - Move fingerprint comparison directly into GnuPG::Fingerprint - dkg - Change around some variable names for consistency's sake: $current_key becomes $current_primary_key $current_fingerprinted_key becomes $current_key -dkg - Fixed synopsis example in GnuPG::Signature pod - dkg - Allow for primary key to have per-key (useful for signatures of class 0x1f, see http://tools.ietf.org/html/rfc4880#section-5.2.1) - dkg - Add revocations to keys and user ids and user attributes - dkg - Add signature class and exportability to GnuPG::Signature - dkg - Introduced GnuPG::UserAttribute to handle uat packets - dkg - Actually check validity of signatures and report them - dkg - Support more than 1 signature over each subkey - dkg - Do not bother shipping test/random_seed - dkg - Fix copy method of GnuPG::Options: The result of not checking for definedness here is to never copy the meta_immutable value successfully (as that is true by default). This led to a FTBFS (failure to build from source) when running non-interactively. See also: http://bugs.debian.org/549743 - Tim Retout - Expose signature expiration times - dkg - Take advantage of --fixed-list-mode and report timestamps at 1Hz precision instead of daily precision - dkg - Always use --fixed-list-mode for consistency and better granularity of data - dkg - Unescape strings to handle User IDs with colons in them - dkg - Add usage_flags to keys - dkg - Several doc patches from Daniel Kahn Gillmor - Fix for documented typos reported by SYSMON Fixes rt.cpan.org#50377 - Fix POD errors - alexmv 0.42 - 2009-09-30 - Support for GPG2 0.41_01 - 2009-09-25 - Beginnings of support for GPG2 0.40_04 - 2009-04-21 - Use Any::Moose instead of Moose for Mouse celerity (Sartak) 0.40_1 - 2008-11-15 - [rt.cpan.org #40963] Replace Class::MethodMaker with Moose (Chris Prather) 0.36 - 2007-08-13 - [rt.cpan.org #28814] - Performance improvement from mehradek (Radoslaw Zielinski) -use English; +use English qw( -no_match_vars ); 0.35 - 2007-04-20 - New Maintainer: Jesse Vincent took over maintenance of this module. - Removed test key expiry dates. (Fixes http://rt.cpan.org/Ticket/Display.html?id=17618) - Applied secret key output patch for modern GPG from http://rt.cpan.org/Ticket/Display.html?id=17619 - Applied patch to support 'tru' record types from (http://search.cpan.org/src/JRED/Mail-GPG-1.0.6/patches/) 0.34 - 2002-09-26 - Documentation fixes. 0.33 - 2002-06-14 - Fixed a bug in GnuPG::Interface->import_keys() so that it doesn't overwrite your 'command_args' anymore. Thanks to Peter Palfrader for pointing this out. 0.32 - 2002-06-11 - Extended the expiration on the test keys another 4 years so that the test suite works. - Documentation fixes. - Other small cleanups. 0.31 - 2001-05-03 - Fixed stalling test cases. - Added deprecation support for fields of GnuPG::Interface::wrap_call 0.30 - 2001-05-01 - Re-worked inheritance tree so that GnuPG::SecretKey and GnuPG::PublicKey are sub-classes of newly-added GnuPG::PrimaryKey. - Tested with GnuPG 1.0.5. - GnuPG::Fingerprint deprecate hex_data(), in favor of as_hex_string(). - GnuPG::UserId deprecates user_id_string(), in favor of as_string(). 0.20 - 2001-04-28 - Fixes for running under Perl 5.6.0 (stdin, stdout, stderr filehandling changed). Thanks to Paul Walmsley, the_shag@users.sourceforge.net - Fix testing so that it works with GnuPG 1.0.4h. - Move a lot of testing code from inside the code to outside, so that it doesn't need to be loaded along with normal usage. This might help speed. - License is now the same terms as perl itself. - Don't ship with Class::MethodMaker 0.11 - 2000-08-08 - AutoLoader is now used correctly. - GnuPG::Options->no_comment() is no longer exists, for clarity. (It doesn't do what you think it does). - GnuPG::Options->comment() will now only not cause a --comment option to be used if it's value is undefined. This means you can do $gnupg->options->comment( '' ) to prevent a comment from being used. 0.10 - 2000-07-13 - GnuPG::Interface should work fine with the recently- released GnuPG 1.0.2. - GnuPG::Handles objects can now handle reading or writing directly from already-opened filehandles. This can allow a more 'natural' approach to having GnuPG read and write directly to files, with the exeption being that the user has to open these files beforehand. - Documentation created to describe the new accessing of open filehandle behaviour, and a FAQ started in GnuPG::Interface's docs. - Major code cleanup and other small docs cleanup. 0.09 - 2000-06-26 - Using GnuPG::Handles which are meant to be dupes is now more viable and documented. In particular, file descriptor numbers (properly prefixed, according to the open() documentation) can be used. This helps when using symbols and and object handles. 0.08 - 2000-06-21 - AutoLoader is now used; this may descrease compile-time. - Changes so that testing on recent development versions of GnuPG (namely 1.0.1e) works, or notably says that the error is occuring because of GnuPG version differences. 0.07 - 2000-05-25 - BACKWARDS COMPATIBILITY issue: GnuPG::Options->meta_signing_key() now expects an argument of type GnuPG::Object, instead of a scalar key id. See the following note for more details. - GnuPG::Options 'meta' methods that deal with keys arguments are more consistent now. Meta methods that accept key ids are now appended with _id(s); other meta methods that accept keys receive GnuPG::Key objects. 0.06 - 2000-05-18 - textmode option added to GnuPG::Options, and booleans of GnuPG::Options now make use of Class::MethodMaker's boolean usability. 0.04 - 2000-04-26 - This is a re-packaging release of 0.03. 0.03 - 2000-04-25 - Documenation fixes. - GnuPG::Option meta-pgp5-compatibility bug fixed. 0.01 - 2000-04-19 - Initial release GnuPG-Interface-1.02/MANIFEST000644 000765 000024 00000003215 14034140215 016225 0ustar00jbrandtstaff000000 000000 Changes inc/Module/Install.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/ReadmeFromPod.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm lib/GnuPG/Fingerprint.pm lib/GnuPG/Handles.pm lib/GnuPG/HashInit.pm lib/GnuPG/Interface.pm lib/GnuPG/Key.pm lib/GnuPG/Options.pm lib/GnuPG/PrimaryKey.pm lib/GnuPG/PublicKey.pm lib/GnuPG/Revoker.pm lib/GnuPG/SecretKey.pm lib/GnuPG/Signature.pm lib/GnuPG/SubKey.pm lib/GnuPG/UserAttribute.pm lib/GnuPG/UserId.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP META.yml README SIGNATURE t/000_setup.t t/clearsign.t t/decrypt.t t/detach_sign.t t/encrypt.t t/encrypt_symmetrically.t t/export_keys.t t/Fingerprint.t t/get_public_keys.t t/get_secret_keys.t t/import_keys.t t/Interface.t t/list_public_keys.t t/list_secret_keys.t t/list_sigs.t t/MyTest.pm t/MyTestSpecific.pm t/passphrase_handling.t t/sign.t t/sign_and_encrypt.t t/UserId.t t/verify.t t/version_updates.t t/wrap_call.t t/z_delete_keys.t t/zzz_cleanup.t test/encrypted.1.gpg test/encrypted.2.gpg test/fake-gpg-v1 test/fake-gpg-v2 test/fake-pinentry.pl test/gpg.conf test/key.1.asc test/new_secret.pgp test/passphrase test/plain.1.txt test/plain.2.txt test/public-keys-sigs/1.0.test test/public-keys-sigs/1.1.test test/public-keys-sigs/2.0.test test/public-keys-sigs/2.1.test test/public-keys/1.0.test test/public-keys/1.1.test test/public-keys/2.0.test test/public-keys/2.1.test test/public_keys.pgp test/secret-keys/1.0.test test/secret-keys/1.1.test test/secret-keys/1.2.test test/secret-keys/2.0.test test/secret_keys.pgp test/signed.1.asc GnuPG-Interface-1.02/t/000755 000765 000024 00000000000 14034140255 015342 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/README000644 000765 000024 00000046174 14034140245 015772 0ustar00jbrandtstaff000000 000000 NAME GnuPG::Interface - Perl interface to GnuPG SYNOPSIS # A simple example use IO::Handle; use GnuPG::Interface; # setting up the situation my $gnupg = GnuPG::Interface->new(); $gnupg->options->hash_init( armor => 1, homedir => '/home/foobar' ); # Note you can set the recipients even if you aren't encrypting! $gnupg->options->push_recipients( 'ftobin@cpan.org' ); $gnupg->options->meta_interactive( 0 ); # how we create some handles to interact with GnuPG my $input = IO::Handle->new(); my $output = IO::Handle->new(); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output ); # Now we'll go about encrypting with the options already set my @plaintext = ( 'foobar' ); my $pid = $gnupg->encrypt( handles => $handles ); # Now we write to the input of GnuPG print $input @plaintext; close $input; # now we read the output my @ciphertext = <$output>; close $output; waitpid $pid, 0; DESCRIPTION GnuPG::Interface and its associated modules are designed to provide an object-oriented method for interacting with GnuPG, being able to perform functions such as but not limited to encrypting, signing, decryption, verification, and key-listing parsing. How Data Member Accessor Methods are Created Each module in the GnuPG::Interface bundle relies on Moo to generate the get/set methods used to set the object's data members. *This is very important to realize.* This means that any data member which is a list has special methods assigned to it for pushing, popping, and clearing the list. Understanding Bidirectional Communication It is also imperative to realize that this package uses interprocess communication methods similar to those used in IPC::Open3 and "Bidirectional Communication with Another Process" in perlipc, and that users of this package need to understand how to use this method because this package does not abstract these methods for the user greatly. This package is not designed to abstract this away entirely (partly for security purposes), but rather to simply help create 'proper', clean calls to GnuPG, and to implement key-listing parsing. Please see "Bidirectional Communication with Another Process" in perlipc to learn how to deal with these methods. Using this package to do message processing generally invovlves creating a GnuPG::Interface object, creating a GnuPG::Handles object, setting some options in its options data member, and then calling a method which invokes GnuPG, such as clearsign. One then interacts with with the handles appropriately, as described in "Bidirectional Communication with Another Process" in perlipc. GnuPG Versions As of this version of GnuPG::Interface, there are two supported versions of GnuPG: 1.4.x and 2.2.x. The GnuPG download page has updated information on the currently supported versions. GnuPG released 2.0 and 2.1 versions in the past and some packaging systems may still provide these if you install the default "gpg", "gnupg", "gnupg2", etc. packages. This modules supports only version 2.2.x, so you may need to find additional package repositories or build from source to get the updated version. OBJECT METHODS Initialization Methods new( *%initialization_args* ) This methods creates a new object. The optional arguments are initialization of data members. hash_init( *%args* ). Object Methods which use a GnuPG::Handles Object list_public_keys( % ) list_sigs( % ) list_secret_keys( % ) encrypt( % ) encrypt_symmetrically( % ) sign( % ) clearsign( % ) detach_sign( % ) sign_and_encrypt( % ) decrypt( % ) verify( % ) import_keys( % ) export_keys( % ) recv_keys( % ) send_keys( % ) search_keys( % ) These methods each correspond directly to or are very similar to a GnuPG command described in gpg. Each of these methods takes a hash, which currently must contain a key of handles which has the value of a GnuPG::Handles object. Another optional key is command_args which should have the value of an array reference; these arguments will be passed to GnuPG as command arguments. These command arguments are used for such things as determining the keys to list in the export_keys method. *Please note that GnuPG command arguments are not the same as GnuPG options*. To understand what are options and what are command arguments please read "COMMANDS" in gpg and "OPTIONS" in gpg. Each of these calls returns the PID for the resulting GnuPG process. One can use this PID in a "waitpid" call instead of a "wait" call if more precise process reaping is needed. These methods will attach the handles specified in the handles object to the running GnuPG object, so that bidirectional communication can be established. That is, the optionally-defined stdin, stdout, stderr, status, logger, and passphrase handles will be attached to GnuPG's input, output, standard error, the handle created by setting status-fd, the handle created by setting logger-fd, and the handle created by setting passphrase-fd respectively. This tying of handles of similar to the process done in *IPC::Open3*. If you want the GnuPG process to read or write directly to an already-opened filehandle, you cannot do this via the normal *IPC::Open3* mechanisms. In order to accomplish this, set the appropriate handles data member to the already-opened filehandle, and then set the option direct to be true for that handle, as described in "options" in GnuPG::Handles. For example, to have GnuPG read from the file input.txt and write to output.txt, the following snippet may do: my $infile = IO::File->new( 'input.txt' ); my $outfile = IO::File->new( '>output.txt' ); my $handles = GnuPG::Handles->new( stdin => $infile, stdout => $outfile, ); $handles->options( 'stdin' )->{direct} = 1; $handles->options( 'stdout' )->{direct} = 1; If any handle in the handles object is not defined, GnuPG's input, output, and standard error will be tied to the running program's standard error, standard output, or standard error. If the status or logger handle is not defined, this channel of communication is never established with GnuPG, and so this information is not generated and does not come into play. If the passphrase data member handle of the handles object is not defined, but the the passphrase data member handle of GnuPG::Interface object is, GnuPG::Interface will handle passing this information into GnuPG for the user as a convenience. Note that this will result in GnuPG::Interface storing the passphrase in memory, instead of having it simply 'pass-through' to GnuPG via a handle. If neither the passphrase data member of the GnuPG::Interface nor the passphrase data member of the handles object is defined, then GnuPG::Interface assumes that access and control over the secret key will be handled by the running gpg-agent process. This represents the simplest mode of operation with the GnuPG "stable" suite (version 2.2 and later). It is also the preferred mode for tools intended to be user-facing, since the user will be prompted directly by gpg-agent for use of the secret key material. Note that for programmatic use, this mode requires the gpg-agent and pinentry to already be correctly configured. Other Methods get_public_keys( @search_strings ) get_secret_keys( @search_strings ) get_public_keys_with_sigs( @search_strings ) These methods create and return objects of the type GnuPG::PublicKey or GnuPG::SecretKey respectively. This is done by parsing the output of GnuPG with the option with-colons enabled. The objects created do or do not have signature information stored in them, depending if the method ends in *_sigs*; this separation of functionality is there because of performance hits when listing information with signatures. test_default_key_passphrase() This method will return a true or false value, depending on whether GnuPG reports a good passphrase was entered while signing a short message using the values of the passphrase data member, and the default key specified in the options data member. version() Returns the version of GnuPG that GnuPG::Interface is running. Invoking GnuPG with a custom call GnuPG::Interface attempts to cover a lot of the commands of GnuPG that one would want to perform; however, there may be a lot more calls that GnuPG is and will be capable of, so a generic command interface is provided, "wrap_call". wrap_call( %args ) Call GnuPG with a custom command. The %args hash must contain at least the following keys: commands The value of this key in the hash must be a reference to a a list of commands for GnuPG, such as "[ qw( --encrypt --sign ) ]". handles As with most other GnuPG::Interface methods, handles must be a GnuPG::Handles object. The following keys are optional. command_args As with other GnuPG::Interface methods, the value in hash for this key must be a reference to a list of arguments to be passed to the GnuPG command, such as which keys to list in a key-listing. OBJECT DATA MEMBERS call This defines the call made to invoke GnuPG. Defaults to 'gpg'; this should be changed if 'gpg' is not in your path, or there is a different name for the binary on your system. passphrase In order to lessen the burden of using handles by the user of this package, setting this option to one's passphrase for a secret key will allow the package to enter the passphrase via a handle to GnuPG by itself instead of leaving this to the user. See also "passphrase" in GnuPG::Handles. options This data member, of the type GnuPG::Options; the setting stored in this data member are used to determine the options used when calling GnuPG via *any* of the object methods described in this package. See GnuPG::Options for more information. EXAMPLES The following setup can be done before any of the following examples: use IO::Handle; use GnuPG::Interface; my @original_plaintext = ( "How do you doo?" ); my $passphrase = "Three Little Pigs"; my $gnupg = GnuPG::Interface->new(); $gnupg->options->hash_init( armor => 1, recipients => [ 'ftobin@uiuc.edu', '0xABCD1234ABCD1234ABCD1234ABCD1234ABCD1234' ], meta_interactive => 0 , ); $gnupg->options->debug_level(4); $gnupg->options->logger_file("/tmp/gnupg-$$-decrypt-".time().".log"); Encrypting # We'll let the standard error of GnuPG pass through # to our own standard error, by not creating # a stderr-part of the $handles object. my ( $input, $output ) = ( IO::Handle->new(), IO::Handle->new() ); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output ); # this sets up the communication # Note that the recipients were specified earlier # in the 'options' data member of the $gnupg object. my $pid = $gnupg->encrypt( handles => $handles ); # this passes in the plaintext print $input @original_plaintext; # this closes the communication channel, # indicating we are done close $input; my @ciphertext = <$output>; # reading the output waitpid $pid, 0; # clean up the finished GnuPG process Signing # This time we'll catch the standard error for our perusing my ( $input, $output, $error ) = ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), ); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output, stderr => $error, ); # indicate our pasphrase through the # convenience method $gnupg->passphrase( $passphrase ); # this sets up the communication my $pid = $gnupg->sign( handles => $handles ); # this passes in the plaintext print $input @original_plaintext; # this closes the communication channel, # indicating we are done close $input; my @ciphertext = <$output>; # reading the output my @error_output = <$error>; # reading the error close $output; close $error; waitpid $pid, 0; # clean up the finished GnuPG process Decryption # This time we'll catch the standard error for our perusing # as well as passing in the passphrase manually # as well as the status information given by GnuPG my ( $input, $output, $error, $passphrase_fh, $status_fh ) = ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), ); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output, stderr => $error, passphrase => $passphrase_fh, status => $status_fh, ); # this time we'll also demonstrate decrypting # a file written to disk # Make sure you "use IO::File" if you use this module! my $cipher_file = IO::File->new( 'encrypted.gpg' ); # this sets up the communication my $pid = $gnupg->decrypt( handles => $handles ); # This passes in the passphrase print $passphrase_fh $passphrase; close $passphrase_fh; # this passes in the plaintext print $input $_ while <$cipher_file>; # this closes the communication channel, # indicating we are done close $input; close $cipher_file; my @plaintext = <$output>; # reading the output my @error_output = <$error>; # reading the error my @status_info = <$status_fh>; # read the status info # clean up... close $output; close $error; close $status_fh; waitpid $pid, 0; # clean up the finished GnuPG process Printing Keys # This time we'll just let GnuPG print to our own output # and read from our input, because no input is needed! my $handles = GnuPG::Handles->new(); my @ids = ( 'ftobin', '0xABCD1234ABCD1234ABCD1234ABCD1234ABCD1234' ); # this time we need to specify something for # command_args because --list-public-keys takes # search ids as arguments my $pid = $gnupg->list_public_keys( handles => $handles, command_args => [ @ids ] ); waitpid $pid, 0; Creating GnuPG::PublicKey Objects my @ids = [ 'ftobin', '0xABCD1234ABCD1234ABCD1234ABCD1234ABCD1234' ]; my @keys = $gnupg->get_public_keys( @ids ); # no wait is required this time; it's handled internally # since the entire call is encapsulated Custom GnuPG call # assuming $handles is a GnuPG::Handles object my $pid = $gnupg->wrap_call ( commands => [ qw( --list-packets ) ], command_args => [ qw( test/key.1.asc ) ], handles => $handles, ); my @out = <$handles->stdout()>; waitpid $pid, 0; FAQ How do I get GnuPG::Interface to read/write directly from a filehandle? You need to set GnuPG::Handles direct option to be true for the filehandles in concern. See "options" in GnuPG::Handles and "Object Methods which use a GnuPG::Handles Object" for more information. Why do you make it so difficult to get GnuPG to write/read from a filehandle? In the shell, I can just call GnuPG with the --outfile option! There are lots of issues when trying to tell GnuPG to read/write directly from a file, such as if the file isn't there, or there is a file, and you want to write over it! What do you want to happen then? Having the user of this module handle these questions beforehand by opening up filehandles to GnuPG lets the user know fully what is going to happen in these circumstances, and makes the module less error-prone. When having GnuPG process a large message, sometimes it just hanges there. Your problem may be due to buffering issues; when GnuPG reads/writes to non-direct filehandles (those that are sent to filehandles which you read to from into memory, not that those access the disk), buffering issues can mess things up. I recommend looking into "options" in GnuPG::Handles. NOTES This package is the successor to PGP::GPG::MessageProcessor, which I found to be too inextensible to carry on further. A total redesign was needed, and this is the resulting work. After any call to a GnuPG-command method of GnuPG::Interface in which one passes in the handles, one should all wait to clean up GnuPG from the process table. BUGS Large Amounts of Data Currently there are problems when transmitting large quantities of information over handles; I'm guessing this is due to buffering issues. This bug does not seem specific to this package; IPC::Open3 also appears affected. OpenPGP v3 Keys I don't know yet how well this module handles parsing OpenPGP v3 keys. RHEL 7 Test Failures Testing with the updates for version 1.00 we saw intermittent test failures on RHEL 7 with GnuPG version 2.2.20. In some cases the tests would all pass for several runs, then one would fail. We're unable to reliably reproduce this so we would be interested in feedback from other users. SEE ALSO GnuPG::Options, GnuPG::Handles, GnuPG::PublicKey, GnuPG::SecretKey, gpg, "Bidirectional Communication with Another Process" in perlipc LICENSE This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR GnuPG::Interface is currently maintained by Best Practical Solutions . Frank J. Tobin, ftobin@cpan.org was the original author of the package. GnuPG-Interface-1.02/MANIFEST.SKIP000644 000765 000024 00000002106 12630404540 016774 0ustar00jbrandtstaff000000 000000 #!start included /home/chmrr/prog/perlbrew/perls/perl-5.16.0/lib/5.16.0/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid MYMETA files ^MYMETA\. #!end included /home/chmrr/prog/perlbrew/perls/perl-5.16.0/lib/5.16.0/ExtUtils/MANIFEST.SKIP .shipit .*\.tar\.gz test/.*/.*\.out test/random_seed test/temp test/trustdb.gpg GnuPG-Interface-1.02/META.yml000644 000765 000024 00000001200 14034140245 016340 0ustar00jbrandtstaff000000 000000 --- abstract: 'supply object methods for interacting with GnuPG' author: - BPS build_requires: ExtUtils::MakeMaker: 6.36 configure_requires: ExtUtils::MakeMaker: 6.36 distribution_type: module dynamic_config: 1 generated_by: 'Module::Install version 1.19' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: GnuPG-Interface no_index: directory: - inc - t - test requires: Fatal: 0 Math::BigInt: '1.78' Moo: '0.091011' MooX::HandlesVia: '0.001004' MooX::late: '0.014' Scalar::Util: 0 resources: license: http://dev.perl.org/licenses/ version: '1.02' GnuPG-Interface-1.02/lib/000755 000765 000024 00000000000 14034140255 015645 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/Makefile.PL000644 000765 000024 00000001355 14034136570 017062 0ustar00jbrandtstaff000000 000000 BEGIN{push @INC, '.';} use strict; use warnings; use inc::Module::Install; print "which gpg ... "; system("which", "gpg"); die "gpg (GnuPG) not found" if ( $? != 0 ); my $output = `gpg --version`; die "Can't determine gpg version" unless $output =~ /^gpg \(GnuPG.*?\) (\d+\.\d+)/; die "gpg (GnuPG) 1.4 or later is required" unless $1 >= 1.4; author 'BPS'; abstract 'supply object methods for interacting with GnuPG'; name 'GnuPG-Interface'; version_from 'lib/GnuPG/Interface.pm'; readme_from 'lib/GnuPG/Interface.pm'; requires 'Moo' => '0.091011'; requires 'MooX::HandlesVia' => '0.001004'; requires 'MooX::late' => '0.014'; requires 'Math::BigInt' => '1.78'; requires 'Fatal'; requires 'Scalar::Util'; license 'perl'; sign(); WriteAll(); GnuPG-Interface-1.02/lib/GnuPG/000755 000765 000024 00000000000 14034140255 016625 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/lib/GnuPG/Handles.pm000644 000765 000024 00000010032 13657001770 020545 0ustar00jbrandtstaff000000 000000 # Handles.pm # - interface to the handles used by GnuPG::Interface # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: Handles.pm,v 1.8 2001/12/09 02:24:10 ftobin Exp $ # package GnuPG::Handles; use Moo; use MooX::late; with qw(GnuPG::HashInit); use constant HANDLES => qw( stdin stdout stderr status logger passphrase command ); has "$_" => ( isa => 'Any', is => 'rw', clearer => 'clear_' . $_, ) for HANDLES; has _options => ( isa => 'HashRef', is => 'rw', lazy_build => 1, ); sub options { my $self = shift; my $key = shift; return $self->_options->{$key}; } sub _build__options { {} } sub BUILD { my ( $self, $args ) = @_; # This is done for the user's convenience so that they don't # have to worry about undefined hashrefs $self->_options->{$_} = {} for HANDLES; $self->hash_init(%$args); } 1; =head1 NAME GnuPG::Handles - GnuPG handles bundle =head1 SYNOPSIS use IO::Handle; my ( $stdin, $stdout, $stderr, $status_fh, $logger_fh, $passphrase_fh, ) = ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), ); my $handles = GnuPG::Handles->new ( stdin => $stdin, stdout => $stdout, stderr => $stderr, status => $status_fh, logger => $logger_fh, passphrase => $passphrase_fh, ); =head1 DESCRIPTION GnuPG::Handles objects are generally instantiated to be used in conjunction with methods of objects of the class GnuPG::Interface. GnuPG::Handles objects represent a collection of handles that are used to communicate with GnuPG. =head1 OBJECT METHODS =head2 Initialization Methods =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members. =item hash_init( I<%args> ). =back =head1 OBJECT DATA MEMBERS =over 4 =item stdin This handle is connected to the standard input of a GnuPG process. =item stdout This handle is connected to the standard output of a GnuPG process. =item stderr This handle is connected to the standard error of a GnuPG process. =item status This handle is connected to the status output handle of a GnuPG process. =item logger This handle is connected to the logger output handle of a GnuPG process. =item passphrase This handle is connected to the passphrase input handle of a GnuPG process. =item command This handle is connected to the command input handle of a GnuPG process. =item options This is a hash of hashrefs of settings pertaining to the handles in this object. The outer-level hash is keyed by the names of the handle the setting is for, while the inner is keyed by the setting being referenced. For example, to set the setting C to true for the filehandle C, the following code will do: # assuming $handles is an already-created # GnuPG::Handles object, this sets all # options for the filehandle stdin in one blow, # clearing out all others $handles->options( 'stdin', { direct => 1 } ); # this is useful to just make one change # to the set of options for a handle $handles->options( 'stdin' )->{direct} = 1; # and to get the setting... $setting = $handles->options( 'stdin' )->{direct}; # and to clear the settings for stdin $handles->options( 'stdin', {} ); The currently-used settings are as follows: =over 4 =item direct If the setting C is true for a handle, the GnuPG process spawned will access the handle directly. This is useful for having the GnuPG process read or write directly to or from an already-opened file. =back =back =head1 SEE ALSO L, =cut GnuPG-Interface-1.02/lib/GnuPG/Options.pm000644 000765 000024 00000021701 13657001774 020633 0ustar00jbrandtstaff000000 000000 # Options.pm # - providing an object-oriented approach to GnuPG's options # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: Options.pm,v 1.14 2001/08/21 13:31:50 ftobin Exp $ # package GnuPG::Options; use Moo; use MooX::late; use MooX::HandlesVia; with qw(GnuPG::HashInit); use constant BOOLEANS => qw( armor no_greeting verbose no_verbose quiet batch always_trust rfc1991 openpgp force_v3_sigs no_options textmode meta_pgp_5_compatible meta_pgp_2_compatible meta_interactive ignore_mdc_error keyring no_default_keyring ); use constant SCALARS => qw( homedir default_key comment status_fd logger_fd passphrase_fd command_fd compress_algo options meta_signing_key meta_signing_key_id debug_level logger_file ); use constant LISTS => qw( encrypt_to recipients meta_recipients_keys meta_recipients_key_ids extra_args ); has $_ => ( isa => 'Bool', is => 'rw', clearer => 'clear_' . $_, ) for BOOLEANS; has $_ => ( isa => 'Any', is => 'rw', clearer => 'clear_' . $_, ) for SCALARS; for my $list (LISTS) { my $ref = $list . "_ref"; has $ref => ( handles_via => 'Array', is => 'rw', lazy => 1, clearer => "clear_$list", default => sub { [] }, handles => { "push_$list" => 'push', }, ); no strict 'refs'; *{$list} = sub { my $self = shift; return wantarray ? @{$self->$ref(@_)} : $self->$ref(@_); }; } sub BUILD { my ( $self, $args ) = @_; # Newer GnuPG will force failure for old ciphertext unless set $args->{ignore_mdc_error} //= 1; $self->hash_init( meta_interactive => 1 ); $self->hash_init(%$args); } sub copy { my ($self) = @_; my $new = ( ref $self )->new(); foreach my $field ( BOOLEANS, SCALARS, LISTS ) { my $value = $self->$field(); next unless defined $value; $new->$field($value); } return $new; } sub get_args { my ($self) = @_; return ( $self->get_meta_args(), $self->get_option_args(), $self->extra_args(), ); } sub get_option_args { my ($self) = @_; my @args = (); push @args, '--homedir', $self->homedir() if $self->homedir(); push @args, '--options', $self->options() if $self->options(); push @args, '--no-options' if $self->no_options(); push @args, '--armor' if $self->armor(); push @args, '--textmode' if $self->textmode(); push @args, '--default-key', $self->default_key() if $self->default_key(); push @args, '--no-greeting' if $self->no_greeting(); push @args, '--verbose' if $self->verbose(); push @args, '--no-verbose' if $self->no_verbose(); push @args, '--quiet' if $self->quiet(); push @args, '--batch' if $self->batch(); push @args, '--trust-model=always' if $self->always_trust(); push @args, '--comment', $self->comment() if defined $self->comment(); push @args, '--force-v3-sigs' if $self->force_v3_sigs(); push @args, '--rfc1991' if $self->rfc1991; push @args, '--openpgp' if $self->openpgp(); push @args, '--compress-algo', $self->compress_algo() if defined $self->compress_algo(); push @args, '--status-fd', $self->status_fd() if defined $self->status_fd(); push @args, '--logger-fd', $self->logger_fd() if defined $self->logger_fd(); push @args, '--passphrase-fd', $self->passphrase_fd() if defined $self->passphrase_fd(); push @args, '--command-fd', $self->command_fd() if defined $self->command_fd(); push @args, map { ( '--recipient', $_ ) } $self->recipients(); push @args, map { ( '--encrypt-to', $_ ) } $self->encrypt_to(); push @args, '--debug-level', $self->debug_level() if ($self->debug_level); push @args, '--logger-file', $self->logger_file() if ($self->logger_file()); push @args, '--ignore-mdc-error' if ($self->ignore_mdc_error()); push @args, '--keyring' if ( $self->keyring() ); push @args, '--no-default-keyring' if ( $self->no_default_keyring() ); return @args; } sub get_meta_args { my ($self) = @_; my @args = (); push @args, '--compress-algo', 1, '--force-v3-sigs' if $self->meta_pgp_5_compatible(); push @args, '--rfc1991' if $self->meta_pgp_2_compatible(); push @args, '--batch', '--no-tty' if not $self->meta_interactive(); # To eliminate confusion, we'll move to having any options # that deal with keys end in _id(s) if they only take # an id; otherwise we assume that a GnuPG::Key push @args, '--default-key', $self->meta_signing_key_id() if $self->meta_signing_key_id(); push @args, '--default-key', $self->meta_signing_key()->hex_id() if $self->meta_signing_key(); push @args, map { ( '--recipient', $_ ) } $self->meta_recipients_key_ids(); push @args, map { ( '--recipient', $_->hex_id() ) } $self->meta_recipients_keys(); return @args; } 1; __END__ =head1 NAME GnuPG::Options - GnuPG options embodiment =head1 SYNOPSIS # assuming $gnupg is a GnuPG::Interface object $gnupg->options->armor( 1 ); $gnupg->options->push_recipients( 'ftobin', '0xABCD1234ABCD1234ABCD1234ABCD1234ABCD1234' ); =head1 DESCRIPTION GnuPG::Options objects are generally not instantiated on their own, but rather as part of a GnuPG::Interface object. =head1 OBJECT METHODS =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members. =item hash_init( I<%args> ). =item copy Returns a copy of this object. Useful for 'saving' options. =item get_args Returns a list of arguments to be passed to GnuPG based on data members which are 'meta_' options, regular options, and then I, in that order. =back =head1 OBJECT DATA MEMBERS =over 4 =item homedir =item armor =item textmode =item default_key =item no_greeting =item verbose =item no_verbose =item quiet =item batch =item always_trust =item comment =item status_fd =item logger_fd =item passphrase_fd =item compress_algo =item force_v3_sigs =item rfc1991 =item openpgp =item options =item no_options =item encrypt_to =item recipients =back These options correlate directly to many GnuPG options. For those that are boolean to GnuPG, simply that argument is passed. For those that are associated with a scalar, that scalar is passed passed as an argument appropriate. For those that can be specified more than once, such as B, those are considered lists and passed accordingly. Each are undefined or false to begin. =head2 Meta Options Meta options are those which do not correlate directly to any option in GnuPG, but rather are generally a bundle of options used to accomplish a specific goal, such as obtaining compatibility with PGP 5. The actual arguments each of these reflects may change with time. Each defaults to false unless otherwise specified. These options are being designed and to provide a non-GnuPG-specific abstraction, to help create compatibility with a possible PGP::Interface module. To help avoid confusion, methods with take a form of a key as an object shall be prepended with I<_id(s)> if they only take an id; otherwise assume an object of type GnuPG::Key is required. =over 4 =item meta_pgp_5_compatible If true, arguments are generated to try to be compatible with PGP 5.x. =item meta_pgp_2_compatible If true, arguments are generated to try to be compatible with PGP 2.x. =item meta_interactive If false, arguments are generated to try to help the using program use GnuPG in a non-interactive environment, such as CGI scripts. Default is true. =item meta_signing_key_id This scalar reflects the key used to sign messages. Currently this is synonymous with I. =item meta_signing_key This GnuPG::Key object reflects the key used to sign messages. =item meta_recipients_key_ids This list of scalar key ids are used to generate the appropriate arguments having these keys as recipients. =item meta_recipients_keys This list of keys of the type GnuPG::Key are used to generate the appropriate arguments having these keys as recipients. You probably want to have this list be of the inherited class GnuPG::SubKey, as in most instances, OpenPGP keypairs have the encyrption key as the subkey of the primary key, which is used for signing. =back =head2 Other Data Members =over 4 =item extra_args This is a list of any other arguments used to pass to GnuPG. Useful to pass an argument not yet covered in this package. =back =head1 SEE ALSO L, =cut GnuPG-Interface-1.02/lib/GnuPG/SubKey.pm000644 000765 000024 00000004373 12630404540 020374 0ustar00jbrandtstaff000000 000000 # SubKey.pm # - providing an object-oriented approach to GnuPG sub keys # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: SubKey.pm,v 1.9 2001/09/14 12:34:36 ftobin Exp $ # package GnuPG::SubKey; use Carp; use Moo; use MooX::late; BEGIN { extends qw( GnuPG::Key ) } has [qw( validity owner_trust local_id )] => ( isa => 'Any', is => 'rw', ); # DEPRECATED! # return the last signature, if present. Or push in a new signature, # if one is supplied. sub signature { my $self = shift; my $argcount = @_; if ($argcount) { @{$self->signatures} = (); $self->push_signatures(@_); } else { my $sigcount = @{$self->signatures}; if ($sigcount) { return $self->signatures->[$sigcount-1]; } else { return undef; } } } 1; __END__ =head1 NAME GnuPG::SubKey - GnuPG Sub Key objects =head1 SYNOPSIS # assumes a GnuPG::PublicKey object in $key my @subkeys = $key->subkeys(); # now GnuPG::SubKey objects are in @subkeys =head1 DESCRIPTION GnuPG::SubKey objects are generally instantiated through various methods of GnuPG::Interface. They embody various aspects of a GnuPG sub key. This package inherits data members and object methods from GnuPG::Key, which are not described here, but rather in L. =head1 OBJECT DATA MEMBERS =over 4 =item validity A scalar holding the value GnuPG reports for the trust of authenticity (a.k.a.) validity of a key. See GnuPG's DETAILS file for details. =item local_id GnuPG's local id for the key. =item owner_trust The scalar value GnuPG reports as the ownertrust for this key. See GnuPG's DETAILS file for details. =item signature * DEPRECATED* A GnuPG::Signature object holding the representation of the signature on this key. Please use signatures (see L) instead of signature. Using signature, you will get an arbitrary signature from the set of available signatures. =back =head1 SEE ALSO L, L, =cut GnuPG-Interface-1.02/lib/GnuPG/Interface.pm000644 000765 000024 00000127333 14034137303 021074 0ustar00jbrandtstaff000000 000000 # Interface.pm # - providing an object-oriented approach to interacting with GnuPG # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # package GnuPG::Interface; use Moo; use MooX::late; with qw(GnuPG::HashInit); use English qw( -no_match_vars ); use Carp; use Fcntl; use vars qw( $VERSION ); use Fatal qw( open close pipe fcntl ); use Class::Struct; use IO::Handle; use Math::BigInt try => 'GMP'; use GnuPG::Options; use GnuPG::Handles; use Scalar::Util 'tainted'; $VERSION = '1.02'; has passphrase => ( isa => 'Any', is => 'rw', clearer => 'clear_passphrase', ); has call => ( isa => 'Any', is => 'rw', trigger => 1, clearer => 'clear_call', ); # NB: GnuPG versions # # There are now two supported versions of GnuPG: legacy 1.4 and stable 2.2 # They are detected and each behave slightly differently. # # When using features specific to branches, check that the system's # version of gpg corresponds to the branch. # # legacy: 1.4 # stable: >= 2.2 # # You can find examples of version comparison in the tests. has version => ( isa => 'Str', is => 'ro', reader => 'version', writer => '_set_version', ); has options => ( isa => 'GnuPG::Options', is => 'rw', lazy_build => 1, ); sub _build_options { GnuPG::Options->new() } # deprecated! sub gnupg_call { shift->call(@_); } sub BUILD { my ( $self, $args ) = @_; $self->hash_init( call => 'gpg', %$args ); } struct( fh_setup => { parent_end => '$', child_end => '$', direct => '$', is_std => '$', parent_is_source => '$', name_shows_dup => '$', } ); # Update version if "call" is updated sub _trigger_call { my ( $self, $gpg ) = @_; $self->_set_version( $self->_version() ); } ################################################################# # real worker functions # This function does any 'extra' stuff that the user might # not want to handle himself, such as passing in the passphrase sub wrap_call( $% ) { my ( $self, %args ) = @_; my $handles = $args{handles} or croak 'error: no handles defined'; $handles->stdin('<&STDIN') unless $handles->stdin(); $handles->stdout('>&STDOUT') unless $handles->stdout(); $handles->stderr('>&STDERR') unless $handles->stderr(); $self->passphrase("\n") unless $self->passphrase(); my $needs_passphrase_handled = ( $self->passphrase() =~ m/\S/ and not $handles->passphrase() ) ? 1 : 0; if ($needs_passphrase_handled) { $handles->passphrase( IO::Handle->new() ); } my $pid = $self->fork_attach_exec(%args); if ($needs_passphrase_handled) { my $passphrase_handle = $handles->passphrase(); print $passphrase_handle $self->passphrase(); close $passphrase_handle; # We put this in in case the user wants to re-use this object $handles->clear_passphrase(); } return $pid; } # does does command-line creation, forking, and execcing # the reasing cli creation is done here is because we should # fork before finding the fd's for stuff like --status-fd sub fork_attach_exec( $% ) { my ( $self, %args ) = @_; my $handles = $args{handles} or croak 'no GnuPG::Handles passed'; my $use_loopback_pinentry = 0; # Don't use loopback pintentry for legacy (1.4) GPG # # Check that $version is populated before running cmp_version. If # we are invoked as part of BUILD to populate $version, then any # methods that depend on $version will fail. We don't care about # loopback when we're called just to check gpg version. $use_loopback_pinentry = 1 if ($handles->passphrase() && $self->version && $self->cmp_version($self->version, '2.2') > 0 ); # deprecation support $args{commands} ||= $args{gnupg_commands}; my @commands = ref $args{commands} ? @{ $args{commands} } : ( $args{commands} ) or croak "no gnupg commands passed"; # deprecation support $args{command_args} ||= $args{gnupg_command_args}; my @command_args = ref $args{command_args} ? @{ $args{command_args} } : ( $args{command_args} || () ); unshift @command_args, "--" if @command_args and $command_args[0] ne "--"; my %fhs; foreach my $fh_name ( qw( stdin stdout stderr status logger passphrase command ) ) { my $fh = $handles->$fh_name() or next; $fhs{$fh_name} = fh_setup->new(); $fhs{$fh_name}->parent_end($fh); } foreach my $fh_name (qw( stdin stdout stderr )) { $fhs{$fh_name}->is_std(1); } foreach my $fh_name (qw( stdin passphrase command )) { my $entry = $fhs{$fh_name} or next; $entry->parent_is_source(1); } # Below is code derived heavily from # Marc Horowitz's IPC::Open3, a base Perl module foreach my $fh_name ( keys %fhs ) { my $entry = $fhs{$fh_name}; my $parent_end = $entry->parent_end(); my $name_shows_dup = ( $parent_end =~ s/^[<>]&// ); $entry->parent_end($parent_end); $entry->name_shows_dup($name_shows_dup); $entry->direct( $name_shows_dup || $handles->options($fh_name)->{direct} || 0 ); } foreach my $fh_name ( keys %fhs ) { $fhs{$fh_name}->child_end( IO::Handle->new() ); } foreach my $fh_name ( keys %fhs ) { my $entry = $fhs{$fh_name}; next if $entry->direct(); my $reader_end; my $writer_end; if ( $entry->parent_is_source() ) { $reader_end = $entry->child_end(); $writer_end = $entry->parent_end(); } else { $reader_end = $entry->parent_end(); $writer_end = $entry->child_end(); } pipe $reader_end, $writer_end; } my $pid = fork; die "fork failed: $ERRNO" unless defined $pid; if ( $pid == 0 ) # child { # these are for safety later to help lessen autovifying, # speed things up, and make the code smaller my $stdin = $fhs{stdin}; my $stdout = $fhs{stdout}; my $stderr = $fhs{stderr}; # Paul Walmsley says: # Perl 5.6's POSIX.pm has a typo in it that prevents us from # importing STDERR_FILENO. So we resort to requiring it. require POSIX; my $standard_out = IO::Handle->new_from_fd( &POSIX::STDOUT_FILENO, 'w' ); my $standard_in = IO::Handle->new_from_fd( &POSIX::STDIN_FILENO, 'r' ); # Paul Walmsley says: # this mess is due to a typo in POSIX.pm on Perl 5.6 my $stderr_fd = eval {&POSIX::STDERR_FILENO}; $stderr_fd = 2 unless defined $stderr_fd; my $standard_err = IO::Handle->new_from_fd( $stderr_fd, 'w' ); # If she wants to dup the kid's stderr onto her stdout I need to # save a copy of her stdout before I put something else there. if ( $stdout->parent_end() ne $stderr->parent_end() and $stderr->direct() and my_fileno( $stderr->parent_end() ) == my_fileno($standard_out) ) { my $tmp = IO::Handle->new(); open $tmp, '>&' . my_fileno( $stderr->parent_end() ); $stderr->parent_end($tmp); } if ( $stdin->direct() ) { open $standard_in, '<&' . my_fileno( $stdin->parent_end() ) unless my_fileno($standard_in) == my_fileno( $stdin->parent_end() ); } else { close $stdin->parent_end(); open $standard_in, '<&=' . my_fileno( $stdin->child_end() ); } if ( $stdout->direct() ) { open $standard_out, '>&' . my_fileno( $stdout->parent_end() ) unless my_fileno($standard_out) == my_fileno( $stdout->parent_end() ); } else { close $stdout->parent_end(); open $standard_out, '>&=' . my_fileno( $stdout->child_end() ); } if ( $stdout->parent_end() ne $stderr->parent_end() ) { # I have to use a fileno here because in this one case # I'm doing a dup but the filehandle might be a reference # (from the special case above). if ( $stderr->direct() ) { open $standard_err, '>&' . my_fileno( $stderr->parent_end() ) unless my_fileno($standard_err) == my_fileno( $stderr->parent_end() ); } else { close $stderr->parent_end(); open $standard_err, '>&=' . my_fileno( $stderr->child_end() ); } } else { open $standard_err, '>&STDOUT' unless my_fileno($standard_err) == my_fileno($standard_out); } foreach my $fh_name ( keys %fhs ) { my $entry = $fhs{$fh_name}; next if $entry->is_std(); my $parent_end = $entry->parent_end(); my $child_end = $entry->child_end(); if ( $entry->direct() ) { if ( $entry->name_shows_dup() ) { my $open_prefix = $entry->parent_is_source() ? '<&' : '>&'; open $child_end, $open_prefix . $parent_end; } else { $child_end = $parent_end; $entry->child_end($child_end); } } else { close $parent_end; } # we want these fh's to stay open after the exec fcntl $child_end, F_SETFD, 0; # now set the options for the call to GnuPG my $fileno = my_fileno($child_end); my $option = $fh_name . '_fd'; $self->options->$option($fileno); } my @args = $self->options->get_args(); # Get around a bug in 2.2, see also https://dev.gnupg.org/T4667 # this covers both --delete-secret-key(s) and --delete-secret-and-public-key(s) if ( $self->version && $self->cmp_version( $self->version, 2.2 ) >= 0 && $commands[0] =~ /^--delete-secret-.*keys?$/ ) { push @args, '--yes'; } push @args, '--pinentry-mode', 'loopback' if $use_loopback_pinentry; my @command = ( $self->call(), @args, @commands, @command_args ); local $ENV{PATH} if tainted $ENV{PATH}; exec @command or die "exec() error: $ERRNO"; } # parent # close the child end of any pipes (non-direct stuff) foreach my $fh_name ( keys %fhs ) { my $entry = $fhs{$fh_name}; close $entry->child_end() unless $entry->direct(); } foreach my $fh_name ( keys %fhs ) { my $entry = $fhs{$fh_name}; next unless $entry->parent_is_source(); my $parent_end = $entry->parent_end(); # close any writing handles if they were a dup #any real reason for this? It bombs if we're doing #the automagic >& stuff. #close $parent_end if $entry->direct(); # unbuffer pipes select( ( select($parent_end), $OUTPUT_AUTOFLUSH = 1 )[0] ) if $parent_end; } return $pid; } sub my_fileno { no strict 'refs'; my ($fh) = @_; croak "fh is undefined" unless defined $fh; return $1 if $fh =~ /^=?(\d+)$/; # is it a fd in itself? my $fileno = fileno $fh; croak "error determining fileno for $fh: $ERRNO" unless defined $fileno; return $fileno; } sub unescape_string { my($str) = splice(@_); $str =~ s/\\x(..)/chr(hex($1))/eg; return $str; } ################################################################### sub get_public_keys ( $@ ) { my ( $self, @key_ids ) = @_; return $self->get_keys( commands => ['--list-public-keys'], command_args => [@key_ids], ); } sub get_secret_keys ( $@ ) { my ( $self, @key_ids ) = @_; return $self->get_keys( commands => ['--list-secret-keys'], command_args => [@key_ids], ); } sub get_public_keys_with_sigs ( $@ ) { my ( $self, @key_ids ) = @_; return $self->get_keys( commands => ['--check-sigs'], command_args => [@key_ids], ); } sub get_keys { my ( $self, %args ) = @_; my $saved_options = $self->options(); my $new_options = $self->options->copy(); $self->options($new_options); $self->options->push_extra_args( '--with-colons', '--fixed-list-mode', '--with-fingerprint', '--with-fingerprint', '--with-key-data', ); my $stdin = IO::Handle->new(); my $stdout = IO::Handle->new(); my $handles = GnuPG::Handles->new( stdin => $stdin, stdout => $stdout, ); my $pid = $self->wrap_call( handles => $handles, %args, ); my @returned_keys; my $current_primary_key; my $current_signed_item; my $current_key; require GnuPG::PublicKey; require GnuPG::SecretKey; require GnuPG::SubKey; require GnuPG::Fingerprint; require GnuPG::UserId; require GnuPG::UserAttribute; require GnuPG::Signature; require GnuPG::Revoker; while (<$stdout>) { my $line = $_; chomp $line; my @fields = split ':', $line, -1; next unless @fields > 3; my $record_type = $fields[0]; if ( $record_type eq 'pub' or $record_type eq 'sec' ) { push @returned_keys, $current_primary_key if $current_primary_key; my ( $user_id_validity, $key_length, $algo_num, $hex_key_id, $creation_date, $expiration_date, $local_id, $owner_trust, $user_id_string, $sigclass, #unused $usage_flags, ) = @fields[ 1 .. $#fields ]; # --fixed-list-mode uses epoch time for creation and expiration date strings. # For backward compatibility, we convert them back using GMT; my $expiration_date_string; if ($expiration_date eq '') { $expiration_date = undef; } else { $expiration_date_string = $self->_downrez_date($expiration_date); } my $creation_date_string = $self->_downrez_date($creation_date); $current_primary_key = $current_key = $record_type eq 'pub' ? GnuPG::PublicKey->new() : GnuPG::SecretKey->new(); $current_primary_key->hash_init( length => $key_length, algo_num => $algo_num, hex_id => $hex_key_id, local_id => $local_id, owner_trust => $owner_trust, creation_date => $creation_date, expiration_date => $expiration_date, creation_date_string => $creation_date_string, expiration_date_string => $expiration_date_string, usage_flags => $usage_flags, ); $current_signed_item = $current_primary_key; } elsif ( $record_type eq 'fpr' ) { my $hex = $fields[9]; my $f = GnuPG::Fingerprint->new( as_hex_string => $hex ); $current_key->fingerprint($f); } elsif ( $record_type eq 'sig' or $record_type eq 'rev' ) { my ( $validity, $algo_num, $hex_key_id, $signature_date, $expiration_date, $user_id_string, $sig_type, ) = @fields[ 1, 3 .. 6, 9, 10 ]; my $expiration_date_string; if ($expiration_date eq '') { $expiration_date = undef; } else { $expiration_date_string = $self->_downrez_date($expiration_date); } my $signature_date_string = $self->_downrez_date($signature_date); my ($sig_class, $is_exportable); if ($sig_type =~ /^([[:xdigit:]]{2})([xl])$/ ) { $sig_class = hex($1); $is_exportable = ('x' eq $2); } my $signature = GnuPG::Signature->new( validity => $validity, algo_num => $algo_num, hex_id => $hex_key_id, date => $signature_date, date_string => $signature_date_string, expiration_date => $expiration_date, expiration_date_string => $expiration_date_string, user_id_string => unescape_string($user_id_string), sig_class => $sig_class, is_exportable => $is_exportable, ); if ( $current_signed_item->isa('GnuPG::Key') || $current_signed_item->isa('GnuPG::UserId') || $current_signed_item->isa('GnuPG::Revoker') || $current_signed_item->isa('GnuPG::UserAttribute')) { if ($record_type eq 'sig') { $current_signed_item->push_signatures($signature); } elsif ($record_type eq 'rev') { $current_signed_item->push_revocations($signature); } } else { warn "do not know how to handle signature line: $line\n"; } } elsif ( $record_type eq 'uid' ) { my ( $validity, $user_id_string ) = @fields[ 1, 9 ]; $current_signed_item = GnuPG::UserId->new( validity => $validity, as_string => unescape_string($user_id_string), ); $current_primary_key->push_user_ids($current_signed_item); } elsif ( $record_type eq 'uat' ) { my ( $validity, $subpacket ) = @fields[ 1, 9 ]; my ( $subpacket_count, $subpacket_total_size ) = split(/ /,$subpacket); $current_signed_item = GnuPG::UserAttribute->new( validity => $validity, subpacket_count => $subpacket_count, subpacket_total_size => $subpacket_total_size, ); $current_primary_key->push_user_attributes($current_signed_item); } elsif ( $record_type eq 'sub' or $record_type eq 'ssb' ) { my ( $validity, $key_length, $algo_num, $hex_id, $creation_date, $expiration_date, $local_id, $dummy0, $dummy1, $dummy2, #unused $usage_flags, ) = @fields[ 1 .. 11 ]; my $expiration_date_string; if ($expiration_date eq '') { $expiration_date = undef; } else { $expiration_date_string = $self->_downrez_date($expiration_date); } my $creation_date_string = $self->_downrez_date($creation_date); $current_signed_item = $current_key = GnuPG::SubKey->new( validity => $validity, length => $key_length, algo_num => $algo_num, hex_id => $hex_id, creation_date => $creation_date, expiration_date => $expiration_date, creation_date_string => $creation_date_string, expiration_date_string => $expiration_date_string, local_id => $local_id, usage_flags => $usage_flags, ); $current_primary_key->push_subkeys($current_signed_item); } elsif ($record_type eq 'rvk') { my ($algo_num, $fpr, $class) = @fields[ 3,9,10 ]; my $rvk = GnuPG::Revoker->new( fingerprint => GnuPG::Fingerprint->new( as_hex_string => $fpr ), algo_num => ($algo_num + 0), class => hex($class), ); # pushing to either primary key or subkey, to handle # designated revokers to the subkeys too: $current_key->push_revokers($rvk); # revokers should be bound to the key with signatures: $current_signed_item = $rvk; } elsif ($record_type eq 'pkd') { my ($pos, $size, $data) = @fields[ 1,2,3 ]; $current_key->pubkey_data->[$pos+0] = Math::BigInt->from_hex('0x'.$data); } elsif ( $record_type ne 'tru' and $record_type ne 'grp' ) { warn "unknown record type $record_type"; } } waitpid $pid, 0; push @returned_keys, $current_primary_key if $current_primary_key; $self->options($saved_options); return @returned_keys; } sub _downrez_date { my $self = shift; my $date = shift; if ($date =~ /^\d+$/) { my ($year,$month,$day) = (gmtime($date))[5,4,3]; $year += 1900; $month += 1; return sprintf('%04d-%02d-%02d', $year, $month, $day); } return $date; } ################################################################ sub list_public_keys { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--list-public-keys'], ); } sub list_sigs { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--list-sigs'], ); } sub list_secret_keys { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--list-secret-keys'], ); } sub encrypt( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--encrypt'] ); } sub encrypt_symmetrically( $% ) { my ( $self, %args ) = @_; # Strip the homedir and put it back after encrypting; my $homedir = $self->options->homedir; $self->options->clear_homedir unless $self->cmp_version($self->version, '2.2') >= 0; my $pid = $self->wrap_call( %args, commands => ['--symmetric'] ); $self->options->homedir($homedir) unless $self->cmp_version($self->version, '2.2') >= 0; return $pid; } sub sign( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--sign'] ); } sub clearsign( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args,, commands => ['--clearsign'] ); } sub detach_sign( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--detach-sign'] ); } sub sign_and_encrypt( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => [ '--sign', '--encrypt' ] ); } sub decrypt( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--decrypt'] ); } sub verify( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--verify'] ); } sub import_keys( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--import'] ); } sub export_keys( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--export'] ); } sub recv_keys( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--recv-keys'] ); } sub send_keys( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--send-keys'] ); } sub search_keys( $% ) { my ( $self, %args ) = @_; return $self->wrap_call( %args, commands => ['--search-keys'] ); } sub _version { my ( $self ) = @_; my $out = IO::Handle->new; my $handles = GnuPG::Handles->new( stdout => $out ); my $pid = $self->wrap_call( commands => [ '--no-options', '--version' ], handles => $handles ); my $line = $out->getline; $line =~ /(\d+\.\d+\.\d+)/; my $version = $1; unless ($self->cmp_version($version, '2.2') >= 0 or ($self->cmp_version($version, '1.4') >= 0 and $self->cmp_version($version, '1.5') < 0 )) { croak "GnuPG Version 1.4 or 2.2+ required"; } waitpid $pid, 0; return $version; } sub cmp_version($$) { my ( $self, $a, $b ) = (@_); my @a = split '\.', $a; my @b = split '\.', $b; @a > @b ? push @b, (0) x (@a-@b) : push @a, (0) x (@b-@a); for ( my $i = 0; $i < @a; $i++ ) { return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i]; } return 0; } sub test_default_key_passphrase() { my ($self) = @_; # We can't do something like let the user pass # in a passphrase handle because we don't exist # anymore after the user runs off with the # attachments croak 'No passphrase defined to test!' unless defined $self->passphrase(); my $stdin = IO::Handle->new(); my $stdout = IO::Handle->new(); my $stderr = IO::Handle->new(); my $status = IO::Handle->new(); my $handles = GnuPG::Handles->new( stdin => $stdin, stdout => $stdout, stderr => $stderr, status => $status ); # save this setting since we need to be in non-interactive mode my $saved_meta_interactive_option = $self->options->meta_interactive(); $self->options->clear_meta_interactive(); my $pid = $self->sign( handles => $handles ); close $stdin; # restore this setting to its original setting $self->options->meta_interactive($saved_meta_interactive_option); # all we realy want to check is the status fh while (<$status>) { if (/^\[GNUPG:\]\s*(GOOD_PASSPHRASE|SIG_CREATED)/) { waitpid $pid, 0; return 1; } } # If we didn't catch the regexp above, we'll assume # that the passphrase was incorrect waitpid $pid, 0; return 0; } 1; ############################################################## =head1 NAME GnuPG::Interface - Perl interface to GnuPG =head1 SYNOPSIS # A simple example use IO::Handle; use GnuPG::Interface; # setting up the situation my $gnupg = GnuPG::Interface->new(); $gnupg->options->hash_init( armor => 1, homedir => '/home/foobar' ); # Note you can set the recipients even if you aren't encrypting! $gnupg->options->push_recipients( 'ftobin@cpan.org' ); $gnupg->options->meta_interactive( 0 ); # how we create some handles to interact with GnuPG my $input = IO::Handle->new(); my $output = IO::Handle->new(); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output ); # Now we'll go about encrypting with the options already set my @plaintext = ( 'foobar' ); my $pid = $gnupg->encrypt( handles => $handles ); # Now we write to the input of GnuPG print $input @plaintext; close $input; # now we read the output my @ciphertext = <$output>; close $output; waitpid $pid, 0; =head1 DESCRIPTION GnuPG::Interface and its associated modules are designed to provide an object-oriented method for interacting with GnuPG, being able to perform functions such as but not limited to encrypting, signing, decryption, verification, and key-listing parsing. =head2 How Data Member Accessor Methods are Created Each module in the GnuPG::Interface bundle relies on Moo to generate the get/set methods used to set the object's data members. I This means that any data member which is a list has special methods assigned to it for pushing, popping, and clearing the list. =head2 Understanding Bidirectional Communication It is also imperative to realize that this package uses interprocess communication methods similar to those used in L and L, and that users of this package need to understand how to use this method because this package does not abstract these methods for the user greatly. This package is not designed to abstract this away entirely (partly for security purposes), but rather to simply help create 'proper', clean calls to GnuPG, and to implement key-listing parsing. Please see L to learn how to deal with these methods. Using this package to do message processing generally invovlves creating a GnuPG::Interface object, creating a GnuPG::Handles object, setting some options in its B data member, and then calling a method which invokes GnuPG, such as B. One then interacts with with the handles appropriately, as described in L. =head1 GnuPG Versions As of this version of GnuPG::Interface, there are two supported versions of GnuPG: 1.4.x and 2.2.x. The L has updated information on the currently supported versions. GnuPG released 2.0 and 2.1 versions in the past and some packaging systems may still provide these if you install the default C, C, C, etc. packages. This modules supports only version 2.2.x, so you may need to find additional package repositories or build from source to get the updated version. =head1 OBJECT METHODS =head2 Initialization Methods =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members. =item hash_init( I<%args> ). =back =head2 Object Methods which use a GnuPG::Handles Object =over 4 =item list_public_keys( % ) =item list_sigs( % ) =item list_secret_keys( % ) =item encrypt( % ) =item encrypt_symmetrically( % ) =item sign( % ) =item clearsign( % ) =item detach_sign( % ) =item sign_and_encrypt( % ) =item decrypt( % ) =item verify( % ) =item import_keys( % ) =item export_keys( % ) =item recv_keys( % ) =item send_keys( % ) =item search_keys( % ) These methods each correspond directly to or are very similar to a GnuPG command described in L. Each of these methods takes a hash, which currently must contain a key of B which has the value of a GnuPG::Handles object. Another optional key is B which should have the value of an array reference; these arguments will be passed to GnuPG as command arguments. These command arguments are used for such things as determining the keys to list in the B method. I. To understand what are options and what are command arguments please read L and L. Each of these calls returns the PID for the resulting GnuPG process. One can use this PID in a C call instead of a C call if more precise process reaping is needed. These methods will attach the handles specified in the B object to the running GnuPG object, so that bidirectional communication can be established. That is, the optionally-defined B, B, B, B, B, and B handles will be attached to GnuPG's input, output, standard error, the handle created by setting B, the handle created by setting B, and the handle created by setting B respectively. This tying of handles of similar to the process done in I. If you want the GnuPG process to read or write directly to an already-opened filehandle, you cannot do this via the normal I mechanisms. In order to accomplish this, set the appropriate B data member to the already-opened filehandle, and then set the option B to be true for that handle, as described in L. For example, to have GnuPG read from the file F and write to F, the following snippet may do: my $infile = IO::File->new( 'input.txt' ); my $outfile = IO::File->new( '>output.txt' ); my $handles = GnuPG::Handles->new( stdin => $infile, stdout => $outfile, ); $handles->options( 'stdin' )->{direct} = 1; $handles->options( 'stdout' )->{direct} = 1; If any handle in the B object is not defined, GnuPG's input, output, and standard error will be tied to the running program's standard error, standard output, or standard error. If the B or B handle is not defined, this channel of communication is never established with GnuPG, and so this information is not generated and does not come into play. If the B data member handle of the B object is not defined, but the the B data member handle of GnuPG::Interface object is, GnuPG::Interface will handle passing this information into GnuPG for the user as a convenience. Note that this will result in GnuPG::Interface storing the passphrase in memory, instead of having it simply 'pass-through' to GnuPG via a handle. If neither the B data member of the GnuPG::Interface nor the B data member of the B object is defined, then GnuPG::Interface assumes that access and control over the secret key will be handled by the running gpg-agent process. This represents the simplest mode of operation with the GnuPG "stable" suite (version 2.2 and later). It is also the preferred mode for tools intended to be user-facing, since the user will be prompted directly by gpg-agent for use of the secret key material. Note that for programmatic use, this mode requires the gpg-agent and pinentry to already be correctly configured. =back =head2 Other Methods =over 4 =item get_public_keys( @search_strings ) =item get_secret_keys( @search_strings ) =item get_public_keys_with_sigs( @search_strings ) These methods create and return objects of the type GnuPG::PublicKey or GnuPG::SecretKey respectively. This is done by parsing the output of GnuPG with the option B enabled. The objects created do or do not have signature information stored in them, depending if the method ends in I<_sigs>; this separation of functionality is there because of performance hits when listing information with signatures. =item test_default_key_passphrase() This method will return a true or false value, depending on whether GnuPG reports a good passphrase was entered while signing a short message using the values of the B data member, and the default key specified in the B data member. =item version() Returns the version of GnuPG that GnuPG::Interface is running. =back =head1 Invoking GnuPG with a custom call GnuPG::Interface attempts to cover a lot of the commands of GnuPG that one would want to perform; however, there may be a lot more calls that GnuPG is and will be capable of, so a generic command interface is provided, C. =over 4 =item wrap_call( %args ) Call GnuPG with a custom command. The %args hash must contain at least the following keys: =over 4 =item commands The value of this key in the hash must be a reference to a a list of commands for GnuPG, such as C<[ qw( --encrypt --sign ) ]>. =item handles As with most other GnuPG::Interface methods, B must be a GnuPG::Handles object. =back The following keys are optional. =over 4 =item command_args As with other GnuPG::Interface methods, the value in hash for this key must be a reference to a list of arguments to be passed to the GnuPG command, such as which keys to list in a key-listing. =back =back =head1 OBJECT DATA MEMBERS =over 4 =item call This defines the call made to invoke GnuPG. Defaults to 'gpg'; this should be changed if 'gpg' is not in your path, or there is a different name for the binary on your system. =item passphrase In order to lessen the burden of using handles by the user of this package, setting this option to one's passphrase for a secret key will allow the package to enter the passphrase via a handle to GnuPG by itself instead of leaving this to the user. See also L. =item options This data member, of the type GnuPG::Options; the setting stored in this data member are used to determine the options used when calling GnuPG via I of the object methods described in this package. See L for more information. =back =head1 EXAMPLES The following setup can be done before any of the following examples: use IO::Handle; use GnuPG::Interface; my @original_plaintext = ( "How do you doo?" ); my $passphrase = "Three Little Pigs"; my $gnupg = GnuPG::Interface->new(); $gnupg->options->hash_init( armor => 1, recipients => [ 'ftobin@uiuc.edu', '0xABCD1234ABCD1234ABCD1234ABCD1234ABCD1234' ], meta_interactive => 0 , ); $gnupg->options->debug_level(4); $gnupg->options->logger_file("/tmp/gnupg-$$-decrypt-".time().".log"); =head2 Encrypting # We'll let the standard error of GnuPG pass through # to our own standard error, by not creating # a stderr-part of the $handles object. my ( $input, $output ) = ( IO::Handle->new(), IO::Handle->new() ); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output ); # this sets up the communication # Note that the recipients were specified earlier # in the 'options' data member of the $gnupg object. my $pid = $gnupg->encrypt( handles => $handles ); # this passes in the plaintext print $input @original_plaintext; # this closes the communication channel, # indicating we are done close $input; my @ciphertext = <$output>; # reading the output waitpid $pid, 0; # clean up the finished GnuPG process =head2 Signing # This time we'll catch the standard error for our perusing my ( $input, $output, $error ) = ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), ); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output, stderr => $error, ); # indicate our pasphrase through the # convenience method $gnupg->passphrase( $passphrase ); # this sets up the communication my $pid = $gnupg->sign( handles => $handles ); # this passes in the plaintext print $input @original_plaintext; # this closes the communication channel, # indicating we are done close $input; my @ciphertext = <$output>; # reading the output my @error_output = <$error>; # reading the error close $output; close $error; waitpid $pid, 0; # clean up the finished GnuPG process =head2 Decryption # This time we'll catch the standard error for our perusing # as well as passing in the passphrase manually # as well as the status information given by GnuPG my ( $input, $output, $error, $passphrase_fh, $status_fh ) = ( IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), IO::Handle->new(), ); my $handles = GnuPG::Handles->new( stdin => $input, stdout => $output, stderr => $error, passphrase => $passphrase_fh, status => $status_fh, ); # this time we'll also demonstrate decrypting # a file written to disk # Make sure you "use IO::File" if you use this module! my $cipher_file = IO::File->new( 'encrypted.gpg' ); # this sets up the communication my $pid = $gnupg->decrypt( handles => $handles ); # This passes in the passphrase print $passphrase_fh $passphrase; close $passphrase_fh; # this passes in the plaintext print $input $_ while <$cipher_file>; # this closes the communication channel, # indicating we are done close $input; close $cipher_file; my @plaintext = <$output>; # reading the output my @error_output = <$error>; # reading the error my @status_info = <$status_fh>; # read the status info # clean up... close $output; close $error; close $status_fh; waitpid $pid, 0; # clean up the finished GnuPG process =head2 Printing Keys # This time we'll just let GnuPG print to our own output # and read from our input, because no input is needed! my $handles = GnuPG::Handles->new(); my @ids = ( 'ftobin', '0xABCD1234ABCD1234ABCD1234ABCD1234ABCD1234' ); # this time we need to specify something for # command_args because --list-public-keys takes # search ids as arguments my $pid = $gnupg->list_public_keys( handles => $handles, command_args => [ @ids ] ); waitpid $pid, 0; =head2 Creating GnuPG::PublicKey Objects my @ids = [ 'ftobin', '0xABCD1234ABCD1234ABCD1234ABCD1234ABCD1234' ]; my @keys = $gnupg->get_public_keys( @ids ); # no wait is required this time; it's handled internally # since the entire call is encapsulated =head2 Custom GnuPG call # assuming $handles is a GnuPG::Handles object my $pid = $gnupg->wrap_call ( commands => [ qw( --list-packets ) ], command_args => [ qw( test/key.1.asc ) ], handles => $handles, ); my @out = <$handles->stdout()>; waitpid $pid, 0; =head1 FAQ =over 4 =item How do I get GnuPG::Interface to read/write directly from a filehandle? You need to set GnuPG::Handles B option to be true for the filehandles in concern. See L and L<"Object Methods which use a GnuPG::Handles Object"> for more information. =item Why do you make it so difficult to get GnuPG to write/read from a filehandle? In the shell, I can just call GnuPG with the --outfile option! There are lots of issues when trying to tell GnuPG to read/write directly from a file, such as if the file isn't there, or there is a file, and you want to write over it! What do you want to happen then? Having the user of this module handle these questions beforehand by opening up filehandles to GnuPG lets the user know fully what is going to happen in these circumstances, and makes the module less error-prone. =item When having GnuPG process a large message, sometimes it just hanges there. Your problem may be due to buffering issues; when GnuPG reads/writes to B filehandles (those that are sent to filehandles which you read to from into memory, not that those access the disk), buffering issues can mess things up. I recommend looking into L. =back =head1 NOTES This package is the successor to PGP::GPG::MessageProcessor, which I found to be too inextensible to carry on further. A total redesign was needed, and this is the resulting work. After any call to a GnuPG-command method of GnuPG::Interface in which one passes in the handles, one should all B to clean up GnuPG from the process table. =head1 BUGS =head2 Large Amounts of Data Currently there are problems when transmitting large quantities of information over handles; I'm guessing this is due to buffering issues. This bug does not seem specific to this package; IPC::Open3 also appears affected. =head2 OpenPGP v3 Keys I don't know yet how well this module handles parsing OpenPGP v3 keys. =head2 RHEL 7 Test Failures Testing with the updates for version 1.00 we saw intermittent test failures on RHEL 7 with GnuPG version 2.2.20. In some cases the tests would all pass for several runs, then one would fail. We're unable to reliably reproduce this so we would be interested in feedback from other users. =head1 SEE ALSO L, L, L, L, L, L =head1 LICENSE This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR GnuPG::Interface is currently maintained by Best Practical Solutions . Frank J. Tobin, ftobin@cpan.org was the original author of the package. =cut 1; GnuPG-Interface-1.02/lib/GnuPG/HashInit.pm000644 000765 000024 00000000275 12630404540 020676 0ustar00jbrandtstaff000000 000000 package GnuPG::HashInit; use Moo::Role; sub hash_init { my ($self, %args) = @_; while ( my ( $method, $value ) = each %args ) { $self->$method($value); } } 1; __END__ GnuPG-Interface-1.02/lib/GnuPG/SecretKey.pm000644 000765 000024 00000002350 12630404540 021061 0ustar00jbrandtstaff000000 000000 # SecretKey.pm # - providing an object-oriented approach to GnuPG secret keys # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: SecretKey.pm,v 1.9 2001/09/14 12:34:36 ftobin Exp $ # package GnuPG::SecretKey; use Moo; BEGIN { extends qw( GnuPG::PrimaryKey ) } 1; __END__ =head1 NAME GnuPG::SecretKey - GnuPG Secret Key Objects =head1 SYNOPSIS # assumes a GnuPG::Interface object in $gnupg my @keys = $gnupg->get_secret_keys( 'ftobin' ); # now GnuPG::SecretKey objects are in @keys =head1 DESCRIPTION GnuPG::SecretKey objects are generally instantiated through various methods of GnuPG::Interface. They embody various aspects of a GnuPG secret key. This package inherits data members and object methods from GnuPG::PrimaryKey, which is described here, but rather in L. Currently, this package is functionally no different from GnuPG::PrimaryKey. =head1 SEE ALSO L, =cut GnuPG-Interface-1.02/lib/GnuPG/Key.pm000644 000765 000024 00000014426 13657001773 017735 0ustar00jbrandtstaff000000 000000 # Key.pm # - providing an object-oriented approach to GnuPG keys # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: Key.pm,v 1.10 2001/12/10 01:29:27 ftobin Exp $ # package GnuPG::Key; use Moo; use MooX::late; with qw(GnuPG::HashInit); has [ qw( length algo_num hex_id hex_data creation_date expiration_date creation_date_string expiration_date_string fingerprint usage_flags ) ] => ( isa => 'Any', is => 'rw', ); has [ qw( signatures revokers revocations pubkey_data )] => ( isa => 'ArrayRef', is => 'rw', default => sub { [] }, ); sub push_signatures { my $self = shift; push @{ $self->signatures }, @_; } sub push_revocations { my $self = shift; push @{ $self->revocations }, @_; } sub push_revokers { my $self = shift; push @{ $self->revokers }, @_; } sub short_hex_id { my ($self) = @_; return substr $self->hex_id(), -8; } sub compare { my ($self, $other, $deep) = @_; my @string_comparisons = qw( length algo_num hex_id creation_date creation_date_string usage_flags ); my $field; foreach $field (@string_comparisons) { return 0 unless $self->$field eq $other->$field; } my @can_be_undef = qw( hex_data expiration_date expiration_date_string local_id ); foreach $field (@can_be_undef) { return 0 unless ((defined $self->$field && ( $self->$field ne '') ) == (defined $other->$field && ( $other->$field ne ''))); if (defined $self->$field && ( $self->$field ne '') ) { return 0 unless ($self->$field eq $other->$field); } } my @objs = qw( fingerprint ); foreach $field (@objs) { return 0 unless $self->$field->compare($other->$field, $deep); } if (defined $deep && $deep) { my @lists = qw( signatures revokers revocations ); my $i; foreach my $list (@lists) { return 0 unless @{$self->$list} == @{$other->$list}; for ( $i = 0; $i < scalar(@{$self->$list}); $i++ ) { return 0 unless $self->$list->[$i]->compare($other->$list->[$i], $deep); } } return 0 unless @{$self->pubkey_data} == @{$other->pubkey_data}; for ( $i = 0; $i < scalar(@{$self->pubkey_data}); $i++ ) { return 0 unless (0 == $self->pubkey_data->[$i]->bcmp($other->pubkey_data->[$i])); } } return 1; } 1; __END__ =head1 NAME GnuPG::Key - GnuPG Key Object =head1 SYNOPSIS # assumes a GnuPG::Interface object in $gnupg my @keys = $gnupg->get_public_keys( 'ftobin' ); # now GnuPG::PublicKey objects are in @keys =head1 DESCRIPTION GnuPG::Key objects are generally not instantiated on their own, but rather used as a superclass of GnuPG::PublicKey, GnuPG::SecretKey, or GnuPG::SubKey objects. =head1 OBJECT METHODS =head2 Initialization Methods =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members. =item hash_init( I<%args> ). =item short_hex_id This returns the commonly-used short, 8 character short hex id of the key. =item compare( I<$other>, I<$deep> ) Returns non-zero only when this Key is identical to the other GnuPG::Key. If $deep is present and non-zero, the key's associated signatures, revocations, and revokers will also be compared. =back =head1 OBJECT DATA MEMBERS =over 4 =item length Number of bits in the key. =item algo_num They algorithm number that the Key is used for. =item usage_flags The Key Usage flags associated with this key, represented as a string of lower-case letters. Possible values include: (a) authenticate, (c) certify, (e) encrypt, and (s) sign. A key may have any combination of them in any order. In addition to these letters, the primary key has uppercase versions of the letters to denote the _usable_ capabilities of the entire key, and a potential letter 'D' to indicate a disabled key. See "key capabilities" DETAILS from the GnuPG sources for more details. =item hex_data The data of the key. WARNING: this seems to have never been instantiated, and should always be undef. =item pubkey_data A list of Math::BigInt objects that correspond to the public key material for the given key. This member is empty on secret keys in GnuPG 1.4. It is populated on secret keys In GnuPG >= 2.2.0. For DSA keys, the values are: prime (p), group order (q), group generator (g), y For RSA keys, the values are: modulus (n), exponent (e) For El Gamal keys, the values are: prime (p), group generator (g), y For more details, see: http://tools.ietf.org/html/rfc4880#page-42 =item hex_id The long hex id of the key. This is not the fingerprint nor the short hex id, which is 8 hex characters. =item creation_date_string =item expiration_date_string Formatted date of the key's creation and expiration. If the key has no expiration, expiration_date_string will return undef. =item creation_date =item expiration_date Date of the key's creation and expiration, stored as the number of seconds since midnight 1970-01-01 UTC. If the key has no expiration, expiration_date will return undef. =item fingerprint A GnuPG::Fingerprint object. =item signatures A list of GnuPG::Signature objects embodying the signatures on this key. For subkeys, the signatures are usually subkey-binding signatures. For primary keys, the signatures are statements about the key itself. =item revocations A list of revocations associated with this key, stored as GnuPG::Signature objects (since revocations are a type of certification as well). Note that a revocation of a primary key has a different semantic meaning than a revocation associated with a subkey. =item revokers A list of GnuPG::Revoker objects associated with this key, indicating other keys which are allowed to revoke certifications made by this key. =back =head1 SEE ALSO L, L, L, =cut GnuPG-Interface-1.02/lib/GnuPG/Fingerprint.pm000644 000765 000024 00000003415 13657001770 021465 0ustar00jbrandtstaff000000 000000 # Fingerprint.pm # - providing an object-oriented approach to GnuPG key fingerprints # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: Fingerprint.pm,v 1.8 2001/08/21 13:31:50 ftobin Exp $ # package GnuPG::Fingerprint; use Moo; use MooX::late; with qw(GnuPG::HashInit); has as_hex_string => ( isa => 'Any', is => 'rw', ); sub compare { my ($self, $other) = @_; return 0 unless $other->isa('GnuPG::Fingerprint'); return $self->as_hex_string() eq $other->as_hex_string(); } # DEPRECATED sub hex_data { my ( $self, $v ) = @_; $self->as_hex_string( $v ) if defined $v; return $self->as_hex_string(); } 1; __END__ =head1 NAME GnuPG::Fingerprint - GnuPG Fingerprint Objects =head1 SYNOPSIS # assumes a GnuPG::Key in $key my $fingerprint = $key->fingerprint->as_hex_string(); =head1 DESCRIPTION GnuPG::Fingerprint objects are generally part of GnuPG::Key objects, and are not created on their own. =head1 OBJECT METHODS =head2 Initialization Methods =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members. =item hash_init( I<%args> ). =item compare( I<$other> ) Returns non-zero only when this fingerprint is identical to the other GnuPG::Fingerprint. =back =head1 OBJECT DATA MEMBERS =over 4 =item as_hex_string This is the hex value of the fingerprint that the object embodies, in string format. =back =head1 SEE ALSO L, =cut GnuPG-Interface-1.02/lib/GnuPG/UserId.pm000644 000765 000024 00000006326 12630404540 020365 0ustar00jbrandtstaff000000 000000 # UserId.pm # - providing an object-oriented approach to GnuPG user ids # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: UserId.pm,v 1.7 2001/08/21 13:31:50 ftobin Exp $ # package GnuPG::UserId; use Moo; use MooX::late; has [qw( validity as_string )] => ( isa => 'Any', is => 'rw', ); has signatures => ( isa => 'ArrayRef', is => 'rw', default => sub { [] }, ); has revocations => ( isa => 'ArrayRef', is => 'rw', default => sub { [] }, ); sub push_signatures { my $self = shift; push @{ $self->signatures }, @_; } sub push_revocations { my $self = shift; push @{ $self->revocations }, @_; } sub compare { my ( $self, $other, $deep ) = @_; my @comparison_ints = qw( validity as_string ); foreach my $field ( @comparison_ints ) { return 0 unless $self->$field() eq $other->$field(); } return 0 unless @{$self->signatures} == @{$other->signatures}; return 0 unless @{$self->revocations} == @{$other->revocations}; # FIXME: is it actually wrong if the associated signatures come out # in a different order on the two compared designated revokers? if (defined $deep && $deep) { for ( my $i = 0; $i < scalar(@{$self->signatures}); $i++ ) { return 0 unless $self->signatures->[$i]->compare($other->signatures->[$i], 1); } for ( my $i = 0; $i < scalar(@{$self->revocations}); $i++ ) { return 0 unless $self->revocations->[$i]->compare($other->revocations->[$i], 1); } } return 1; } # DEPRECATED sub user_id_string { my ( $self, $v ) = @_; $self->as_string($v) if defined $v; return $self->as_string(); } 1; __END__ =head1 NAME GnuPG::UserId - GnuPG User ID Objects =head1 SYNOPSIS # assumes a GnuPG::PublicKey object in $publickey my $user_id = $publickey->user_ids_ref->[0]->as_string; =head1 DESCRIPTION GnuPG::UserId objects are generally not instantiated on their own, but rather as part of GnuPG::PublicKey or GnuPG::SecretKey objects. =head1 OBJECT METHODS =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members; =item compare( I<$other>, I<$deep> ) Returns non-zero only when this User ID is identical to the other GnuPG::UserID. If $deep is present and non-zero, the User ID's signatures and revocations will also be compared. =back =head1 OBJECT DATA MEMBERS =over 4 =item as_string A string of the user id. =item validity A scalar holding the value GnuPG reports for the trust of authenticity (a.k.a.) validity of a key. See GnuPG's DETAILS file for details. =item signatures A list of GnuPG::Signature objects embodying the signatures on this user id. =item revocations A list of revocations associated with this User ID, stored as GnuPG::Signature objects (since revocations are a type of certification as well). =back =head1 SEE ALSO L, =cut GnuPG-Interface-1.02/lib/GnuPG/PrimaryKey.pm000644 000765 000024 00000006034 13657001773 021275 0ustar00jbrandtstaff000000 000000 # PrimaryKey.pm # - objectified GnuPG primary keys (can have subkeys) # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: PrimaryKey.pm,v 1.4 2001/09/14 12:34:36 ftobin Exp $ # package GnuPG::PrimaryKey; use Moo; use MooX::late; use MooX::HandlesVia; BEGIN { extends qw( GnuPG::Key ) } for my $list (qw(user_ids subkeys user_attributes)) { my $ref = $list . "_ref"; has $ref => ( handles_via => 'Array', is => 'rw', default => sub { [] }, handles => { "push_$list" => 'push', }, ); no strict 'refs'; *{$list} = sub { my $self = shift; return wantarray ? @{$self->$ref(@_)} : $self->$ref(@_); }; } has $_ => ( isa => 'Any', is => 'rw', clearer => 'clear_' . $_, ) for qw( local_id owner_trust ); sub compare { my ($self, $other, $deep) = @_; my @comparison_fields = qw ( owner_trust ); foreach my $field (@comparison_fields) { return 0 unless $self->$field eq $other->$field; } if (defined $deep && $deep) { my @lists = qw( user_ids subkeys user_attributes ); foreach my $list (@lists) { return 0 unless @{$self->$list} == @{$other->$list}; for ( my $i = 0; $i < scalar(@{$self->$list}); $i++ ) { return 0 unless $self->$list->[$i]->compare($other->$list->[$i], 1); } } } return $self->SUPER::compare($other, $deep); } 1; __END__ =head1 NAME GnuPG::PrimaryKey - GnuPG Primary Key Objects =head1 SYNOPSIS # assumes a GnuPG::Interface object in $gnupg my @keys = $gnupg->get_public_keys( 'ftobin' ); # or my @keys = $gnupg->get_secret_keys( 'ftobin' ); # now GnuPG::PrimaryKey objects are in @keys =head1 DESCRIPTION GnuPG::PrimaryKey objects are generally instantiated as GnuPG::PublicKey or GnuPG::SecretKey objects through various methods of GnuPG::Interface. They embody various aspects of a GnuPG primary key. This package inherits data members and object methods from GnuPG::Key, which is not described here, but rather in L. =head1 OBJECT DATA MEMBERS =over 4 =item user_ids A list of GnuPG::UserId objects associated with this key. =item user_attributes A list of GnuPG::UserAttribute objects associated with this key. =item subkeys A list of GnuPG::SubKey objects associated with this key. =item local_id WARNING: DO NOT USE. This used to mean GnuPG's local id for the key, but modern versions of GnuPG do not produce it. Expect this to be the empty string or undef. =item owner_trust The scalar value GnuPG reports as the ownertrust for this key. See GnuPG's DETAILS file for details. =back =head1 SEE ALSO L, L, L, =cut GnuPG-Interface-1.02/lib/GnuPG/UserAttribute.pm000644 000765 000024 00000005177 12630404540 021777 0ustar00jbrandtstaff000000 000000 # UserAttribute.pm # - providing an object-oriented approach to GnuPG user attributes # # Copyright (C) 2010 Daniel Kahn Gillmor # (derived from UserId.pm, Copyright (C) 2000 Frank J. Tobin ) # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: UserId.pm,v 1.7 2001/08/21 13:31:50 ftobin Exp $ # package GnuPG::UserAttribute; use Moo; use MooX::late; has [qw( validity subpacket_count subpacket_total_size )] => ( isa => 'Any', is => 'rw', ); has signatures => ( isa => 'ArrayRef', is => 'rw', default => sub { [] }, ); has revocations => ( isa => 'ArrayRef', is => 'rw', default => sub { [] }, ); sub push_signatures { my $self = shift; push @{ $self->signatures }, @_; } sub push_revocations { my $self = shift; push @{ $self->revocations }, @_; } 1; __END__ =head1 NAME GnuPG::UserAttribute - GnuPG User Attribute Objects =head1 SYNOPSIS # assumes a GnuPG::PublicKey object in $publickey my $jpgs_size = $publickey->user_attributes->[0]->subpacket_total_size(); =head1 DESCRIPTION GnuPG::UserAttribute objects are generally not instantiated on their own, but rather as part of GnuPG::PublicKey or GnuPG::SecretKey objects. =head1 OBJECT METHODS =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members; =back =head1 OBJECT DATA MEMBERS =over 4 =item validity A scalar holding the value GnuPG reports for the calculated validity of the binding between this User Attribute packet and its associated primary key. See GnuPG's DETAILS file for details. =item subpacket_count A scalar holding the number of attribute subpackets. This is usually 1, as most UATs seen in the wild contain a single image in JPEG format. =item subpacket_total_size A scalar holding the total byte count of all attribute subpackets. =item signatures A list of GnuPG::Signature objects embodying the signatures on this user attribute. =item revocations A list of revocations associated with this User Attribute, stored as GnuPG::Signature objects (since revocations are a type of certification as well). =back =head1 BUGS No useful information about the embedded attributes is provided yet. It would be nice to be able to get ahold of the raw JPEG material. =head1 SEE ALSO L, =cut GnuPG-Interface-1.02/lib/GnuPG/Signature.pm000644 000765 000024 00000007700 12630404540 021130 0ustar00jbrandtstaff000000 000000 # Signature.pm # - providing an object-oriented approach to GnuPG key signatures # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: Signature.pm,v 1.4 2001/08/21 13:31:50 ftobin Exp $ # package GnuPG::Signature; use Moo; use MooX::late; has [qw( validity algo_num hex_id user_id_string date date_string expiration_date expiration_date_string sig_class is_exportable )] => ( isa => 'Any', is => 'rw', ); sub is_valid { my $self = shift; return $self->validity eq '!'; } sub compare { my ($self, $other) = @_; my @compared_fields = qw( validity algo_num hex_id date date_string sig_class is_exportable ); foreach my $field ( @compared_fields ) { return 0 unless $self->$field eq $other->$field; } # check for expiration if present? return 0 unless (defined $self->expiration_date) == (defined $other->expiration_date); if (defined $self->expiration_date) { return 0 unless (($self->expiration_date == $other->expiration_date) || ($self->expiration_date_string eq $other->expiration_date_string)); } return 1; } 1; __END__ =head1 NAME GnuPG::Signature - GnuPG Key Signature Objects =head1 SYNOPSIS # assumes a GnuPG::Key or GnuPG::UserID or GnuPG::UserAttribute object in $signed my $signing_id = $signed->signatures->[0]->hex_id(); =head1 DESCRIPTION GnuPG::Signature objects are generally not instantiated on their own, but rather as part of GnuPG::Key objects. They embody various aspects of a GnuPG signature on a key. =head1 OBJECT METHODS =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members. =item is_valid() Returns 1 if GnuPG was able to cryptographically verify the signature, otherwise 0. =item compare( I<$other> ) Returns non-zero only when this Signature is identical to the other GnuPG::Signature. =back =head1 OBJECT DATA MEMBERS =over 4 =item validity A character indicating the cryptographic validity of the key. GnuPG uses at least the following characters: "!" means valid, "-" means not valid, "?" means unknown (e.g. if the supposed signing key is not present in the local keyring), and "%" means an error occurred (e.g. a non-supported algorithm). See the documentation for --check-sigs in gpg(1). =item algo_num The number of the algorithm used for the signature. =item hex_id The hex id of the signing key. =item user_id_string The first user id string on the key that made the signature. This may not be defined if the signing key is not on the local keyring. =item sig_class Signature class. This is the numeric value of the class of signature. A table of possible classes of signatures and their numeric types can be found at http://tools.ietf.org/html/rfc4880#section-5.2.1 =item is_exportable returns 0 for local-only signatures, non-zero for exportable signatures. =item date_string The formatted date the signature was performed on. =item date The date the signature was performed, represented as the number of seconds since midnight 1970-01-01 UTC. =item expiration_date_string The formatted date the signature will expire (signatures without expiration return undef). =item expiration_date The date the signature will expire, represented as the number of seconds since midnight 1970-01-01 UTC (signatures without expiration return undef) =back =head1 SEE ALSO =cut GnuPG-Interface-1.02/lib/GnuPG/PublicKey.pm000644 000765 000024 00000002354 12630404540 021056 0ustar00jbrandtstaff000000 000000 # PublicKey.pm # - providing an object-oriented approach to GnuPG public keys # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: PublicKey.pm,v 1.9 2001/09/14 12:34:36 ftobin Exp $ # package GnuPG::PublicKey; use Moo; BEGIN { extends qw( GnuPG::PrimaryKey ) } 1; __END__ =head1 NAME GnuPG::PublicKey - GnuPG Public Key Objects =head1 SYNOPSIS # assumes a GnuPG::Interface object in $gnupg my @keys = $gnupg->get_public_keys( 'ftobin' ); # now GnuPG::PublicKey objects are in @keys =head1 DESCRIPTION GnuPG::PublicKey objects are generally instantiated through various methods of GnuPG::Interface. They embody various aspects of a GnuPG public key. This package inherits data members and object methods from GnuPG::PrimaryKey, which is not described here, but rather in L. Currently, this package is functionally no different from GnuPG::PrimaryKey. =head1 SEE ALSO L, =cut GnuPG-Interface-1.02/lib/GnuPG/Revoker.pm000644 000765 000024 00000007504 12630404540 020606 0ustar00jbrandtstaff000000 000000 # Revoker.pm # - providing an object-oriented approach to GnuPG key revokers # # Copyright (C) 2010 Daniel Kahn Gillmor # (derived from Signature.pm, Copyright (C) 2000 Frank J. Tobin ) # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: Signature.pm,v 1.4 2001/08/21 13:31:50 ftobin Exp $ # package GnuPG::Revoker; use Moo; use MooX::late; has [qw( algo_num class )] => ( isa => 'Int', is => 'rw', ); has fingerprint => ( isa => 'GnuPG::Fingerprint', is => 'rw', ); has signatures => ( isa => 'ArrayRef', is => 'rw', default => sub { [] }, ); sub push_signatures { my $self = shift; push @{ $self->signatures }, @_; } sub is_sensitive { my $self = shift; return $self->class & 0x40; } sub compare { my ( $self, $other, $deep ) = @_; my @comparison_ints = qw( class algo_num ); foreach my $field ( @comparison_ints ) { return 0 unless $self->$field() == $other->$field(); } return 0 unless $self->fingerprint->compare($other->fingerprint); # FIXME: is it actually wrong if the associated signatures come out # in a different order on the two compared designated revokers? if (defined $deep && $deep) { return 0 unless @{$self->signatures} == @{$other->signatures}; for ( my $i = 0; $i < scalar(@{$self->signatures}); $i++ ) { return 0 unless $self->signatures->[$i]->compare($other->signatures->[$i], 1); } } return 1; } 1; __END__ =head1 NAME GnuPG::Revoker - GnuPG Key Revoker Objects =head1 SYNOPSIS # assumes a GnuPG::PrimaryKey object in $key my $revokerfpr = $key->revokers->[0]->fingerprint(); =head1 DESCRIPTION GnuPG::Revoker objects are generally not instantiated on their own, but rather as part of GnuPG::Key objects. They represent a statement that another key is designated to revoke certifications made by the key in question. =head1 OBJECT METHODS =over 4 =item new( I<%initialization_args> ) This methods creates a new object. The optional arguments are initialization of data members. =item is_sensitive() Returns 0 if the revoker information can be freely distributed. If this is non-zero, the information should be treated as "sensitive". Please see http://tools.ietf.org/html/rfc4880#section-5.2.3.15 for more explanation. =item compare( I<$other>, I<$deep> ) Returns non-zero only when this designated revoker is identical to the other GnuPG::Revoker. If $deep is present and non-zero, the revokers' signatures will also be compared. =back =head1 OBJECT DATA MEMBERS =over 4 =item fingerprint A GnuPG::Fingerprint object indicating the fingerprint of the specified revoking key. (Note that this is *not* the fingerprint of the key whose signatures can be revoked by this revoker). =item algo_num The numeric identifier of the algorithm of the revoker's key. =item signatures A list of GnuPG::Signature objects which cryptographically bind the designated revoker to the primary key. If the material was instantiated using the *_with_sigs() functions from GnuPG::Interface, then a valid revoker designation should have a valid signature associated with it from the relevant key doing the designation (not from the revoker's key). Note that designated revoker certifications are themselves irrevocable, so there is no analogous list of revocations in a GnuPG::Revoker object. =back =head1 SEE ALSO L, L, L, L, L =cut GnuPG-Interface-1.02/t/list_public_keys.t000644 000765 000024 00000003004 13657001770 021100 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: list_public_keys.t,v 1.7 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use IO::File; use lib './t'; use MyTest; use MyTestSpecific; my $outfile; TEST { reset_handles(); my $pid = $gnupg->list_public_keys( handles => $handles ); close $stdin; $outfile = 'test/public-keys/1.out'; my $out = IO::File->new( "> $outfile" ) or die "cannot open $outfile for writing: $ERRNO"; $out->print( <$stdout> ); close $stdout; $out->close(); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); my $pid = $gnupg->list_public_keys( handles => $handles, command_args => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' ); close $stdin; $outfile = 'test/public-keys/2.out'; my $out = IO::File->new( "> $outfile" ) or die "cannot open $outfile for writing: $ERRNO"; $out->print( <$stdout> ); close $stdout; $out->close(); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdout( $texts{temp}->fh() ); $handles->options( 'stdout' )->{direct} = 1; my $pid = $gnupg->list_public_keys( handles => $handles, command_args => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C', ); waitpid $pid, 0; $outfile = $texts{temp}->fn(); return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/passphrase_handling.t000644 000765 000024 00000002136 12630404540 021546 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: passphrase_handling.t,v 1.6 2001/05/03 06:02:39 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use Symbol; use IO::File; use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); return $gnupg->test_default_key_passphrase() }; $gnupg->clear_passphrase(); TEST { reset_handles(); my $passphrase_handle = gensym; $handles->passphrase( $passphrase_handle ); my $pid = $gnupg->sign( handles => $handles ); print $passphrase_handle 'test'; print $stdin @{ $texts{plain}->data() }; close $passphrase_handle; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->clear_stderr(); $handles->stderr( '>&STDERR' ); my $pass_fn = 'test/passphrase'; my $passfile = IO::File->new( $pass_fn ) or die "cannot open $pass_fn: $ERRNO"; $handles->passphrase( $passfile ); $handles->options( 'passphrase' )->{direct} = 1; my $pid = $gnupg->sign( handles => $handles ); close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/export_keys.t000644 000765 000024 00000001422 13657001770 020112 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: export_keys.t,v 1.6 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->export_keys( handles => $handles, command_args => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' ); close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdout( $texts{temp}->fh() ); $handles->options( 'stdout' )->{direct} = 1; my $pid = $gnupg->export_keys( handles => $handles, command_args => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/decrypt.t000644 000765 000024 00000003166 13657001774 017223 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: decrypt.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use File::Compare; use lib './t'; use MyTest; use MyTestSpecific; my $compare; TEST { reset_handles(); my $pid = $gnupg->decrypt( handles => $handles ); print $stdin @{ $texts{encrypted}->data() }; close $stdin; $compare = compare( $texts{plain}->fn(), $stdout ); close $stdout; waitpid $pid, 0; return $CHILD_ERROR == 0;; }; TEST { return $compare == 0; }; TEST { reset_handles(); $handles->stdin( $texts{encrypted}->fh() ); $handles->options( 'stdin' )->{direct} = 1; $handles->stdout( $texts{temp}->fh() ); $handles->options( 'stdout' )->{direct} = 1; my $pid = $gnupg->decrypt( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { return compare( $texts{plain}->fn(), $texts{temp}->fn() ) == 0; }; # test without default_passphrase (that is, by using the agent, if ENV flag set) TEST { return 1 unless ($gnupg->cmp_version($gnupg->version, '2.2') >= 0); reset_handles(); $handles->stdin( $texts{alt_encrypted}->fh() ); $handles->options( 'stdin' )->{direct} = 1; $handles->stdout( $texts{temp}->fh() ); $handles->options( 'stdout' )->{direct} = 1; $handles->clear_passphrase(); $gnupg->clear_passphrase(); my $pid = $gnupg->decrypt( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { return 1 unless ($gnupg->cmp_version($gnupg->version, '2.2') >= 0); return compare( $texts{alt_plain}->fn(), $texts{temp}->fn() ) == 0; }; GnuPG-Interface-1.02/t/list_sigs.t000644 000765 000024 00000002705 13657001770 017543 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: list_sigs.t,v 1.7 2001/05/03 06:00:06 ftobin Exp $ use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; my $outfile; TEST { reset_handles(); my $pid = $gnupg->list_sigs( handles => $handles ); close $stdin; $outfile = 'test/public-keys-sigs/1.out'; my $out = IO::File->new( "> $outfile" ) or die "cannot open $outfile for writing: $ERRNO"; $out->print( <$stdout> ); close $stdout; $out->close(); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); my $pid = $gnupg->list_sigs( handles => $handles, command_args => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C', ); close $stdin; $outfile = 'test/public-keys-sigs/2.out'; my $out = IO::File->new( "> $outfile" ) or die "cannot open $outfile for writing: $ERRNO"; $out->print( <$stdout> ); close $stdout; $out->close(); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdout( $texts{temp}->fh() ); $handles->options( 'stdout' )->{direct} = 1; my $pid = $gnupg->list_sigs( handles => $handles, command_args => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C', ); waitpid $pid, 0; $outfile = $texts{temp}->fn(); return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/zzz_cleanup.t000644 000765 000024 00000001366 13657001773 020114 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; use File::Path qw (remove_tree); # this is actually no test, just cleanup. TEST { my $homedir = $gnupg->options->homedir(); my $err = []; # kill off any long-lived gpg-agent, ignoring errors. # gpgconf versions < 2.1.11 do not support '--homedir', but still # respect the GNUPGHOME environment variable if ($gnupg->cmp_version($gnupg->version, '2.1') >= 0) { $ENV{'GNUPGHOME'} = $homedir; system('gpgconf', '--homedir', $homedir, '--quiet', '--kill', 'gpg-agent'); delete $ENV{'GNUPGHOME'}; } remove_tree($homedir, {error => \$err}); unlink('test/gnupghome'); return ! @$err; }; GnuPG-Interface-1.02/t/get_secret_keys.t000644 000765 000024 00000010740 13657001771 020721 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: get_secret_keys.t,v 1.9 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; use GnuPG::PrimaryKey; my ( $given_key, $handmade_key ); TEST { reset_handles(); my @returned_keys = $gnupg->get_secret_keys( '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' ); return 0 unless @returned_keys == 1; $given_key = shift @returned_keys; my $pubkey_data = [ Math::BigInt->from_hex('0x'. '88FCAAA5BCDCD52084D46143F44ED1715A339794641158DE03AA2092AFD3174E3DCA2CB7DF2DDC6FEDF7C3620F5A8BDAD06713E6153F8748DD76CB97305F30CBA8F8801DB47FAC11EED725F55672CB9BDAD629178A677CBB089B3E8AE0D9A9AD7741697A35F2868C62D25670994A92D810480173DC24263EEA0F103A43C0B64B'), Math::BigInt->from_hex('0x'. '8F2A3842C70FF17660CBB78C78FC93F534AB9A17'), Math::BigInt->from_hex('0x'. '83E348C2AA65F56DE84E8FDCE6DA7B0991B1C75EC8CA446FA85869A43350907BFF36BE512385E8E7E095578BB2138C04E318495873218286DE2B8C86F36EA670135434967AC798EBA28581F709F0C6B696EB512D3E561E381A06E4B5239BCC655015F9A926C74E4B859B26EAD604F208A556511A76A40EDCD9C38E6BD82CCCB4'), Math::BigInt->from_hex('0x'. '80DE04C85E30C9D62C13F90CFF927A84A5A59D0900B3533D4D6193FEF8C5DAEF9FF8A7D5F76B244FBC17644F50D524E0B19CD3A4B5FC2D78DAECA3FE58FA1C1A64E6C7B96C4EE618173543163A72EF954DFD593E84342699096E9CA76578AC1DE3D893BCCD0BF470CEF625FAF816A0F503EF75C18C6173E35C8675AF919E5704') ]; my $args = { length => 1024, algo_num => 17, hex_id => '53AE596EF950DA9C', creation_date => 949813093, creation_date_string => '2000-02-06', owner_trust => '-', usage_flags => 'scaESCA', pubkey_data => $pubkey_data, }; if ($gnupg->cmp_version($gnupg->version, '2.1') < 0) { # older versions don't report ownertrust or pubkey_data for secret keys: delete $args->{pubkey_data}; $args->{owner_trust} = ''; } $handmade_key = GnuPG::PrimaryKey->new($args); $handmade_key->fingerprint ( GnuPG::Fingerprint->new( as_hex_string => '93AFC4B1B0288A104996B44253AE596EF950DA9C', ) ); $handmade_key->push_user_ids( GnuPG::UserId->new( as_string => 'GnuPG test key (for testing purposes only)', validity => $args->{owner_trust}), GnuPG::UserId->new( as_string => 'Foo Bar (1)', validity => $args->{owner_trust})); my $revoker = GnuPG::Revoker->new ( algo_num => 17, class => 0x80, fingerprint => GnuPG::Fingerprint->new( as_hex_string => '4F863BBBA8166F0A340F600356FFD10A260C4FA3'), ); my $subkey_pub_data = [ Math::BigInt->from_hex('0x'. '8831982DADC4C5D05CBB01D9EAF612131DDC9C24CEA7246557679423FB0BA42F74D10D8E7F5564F6A4FB8837F8DC4A46571C19B122E6DF4B443D15197A6A22688863D0685FADB6E402316DAA9B560D1F915475364580A67E6DF0A727778A5CF3'), Math::BigInt->from_hex('0x'. '6'), Math::BigInt->from_hex('0x'. '2F3850FF130C6AC9AA0962720E86539626FAA9B67B33A74DFC0DE843FF3E90E43E2F379EE0182D914FA539CCCF5C83A20DB3A7C45E365B8A2A092E799A3DFF4AD8274EB977BAAF5B1AFB2ACB8D6F92454F01682F555565E73E56793C46EF7C3E') ]; my $sub_args = { validity => '-', length => 768, algo_num => 16, hex_id => 'ADB99D9C2E854A6B', creation_date => 949813119, creation_date_string => '2000-02-06', usage_flags => 'e', pubkey_data => $subkey_pub_data, }; if ($gnupg->cmp_version($gnupg->version, '2.1') < 0) { # older versions do not report pubkey data for secret keys delete $sub_args->{pubkey_data}; } my $subkey = GnuPG::SubKey->new($sub_args); $subkey->fingerprint ( GnuPG::Fingerprint->new( as_hex_string => '7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B', ) ); $handmade_key->push_subkeys( $subkey ); # older versions do not report designated revokers for secret keys $handmade_key->push_revokers( $revoker ) if ($gnupg->cmp_version($gnupg->version, '2.1') >= 0); $handmade_key->compare( $given_key ); }; TEST { $handmade_key->compare( $given_key, 1 ); }; GnuPG-Interface-1.02/t/MyTestSpecific.pm000644 000765 000024 00000010342 13657001773 020606 0ustar00jbrandtstaff000000 000000 # MyTestSpecific.pm # - module for use with test scripts # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: MyTestSpecific.pm,v 1.7 2001/08/21 13:31:50 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use Fatal qw/ open close /; use IO::File; use IO::Handle; use IO::Seekable; use File::Compare; use Exporter; use Class::Struct; use File::Temp qw (tempdir); use GnuPG::Interface; use GnuPG::Handles; use vars qw( @ISA @EXPORT $stdin $stdout $stderr $gpg_program $handles $gnupg %texts ); @ISA = qw( Exporter ); @EXPORT = qw( stdin stdout stderr gnupg_program handles reset_handles texts file_match ); my $homedir; if (-f "test/gnupghome") { my $record = IO::File->new( "< test/gnupghome" ); $homedir = <$record>; $record->close(); } else { $homedir = tempdir( DIR => '/tmp'); my $record = IO::File->new( "> test/gnupghome" ); $record->write($homedir); $record->close(); } $ENV{'GNUPGHOME'} = $homedir; $gnupg = GnuPG::Interface->new( passphrase => 'test' ); $gnupg->options->hash_init( homedir => $homedir, armor => 1, meta_interactive => 0, meta_signing_key_id => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C', always_trust => 1, ); struct( Text => { fn => "\$", fh => "\$", data => "\$" } ); $texts{plain} = Text->new(); $texts{plain}->fn( 'test/plain.1.txt' ); $texts{alt_plain} = Text->new(); $texts{alt_plain}->fn( 'test/plain.2.txt' ); $texts{encrypted} = Text->new(); $texts{encrypted}->fn( 'test/encrypted.1.gpg' ); $texts{alt_encrypted} = Text->new(); $texts{alt_encrypted}->fn( 'test/encrypted.2.gpg' ); $texts{signed} = Text->new(); $texts{signed}->fn( 'test/signed.1.asc' ); $texts{key} = Text->new(); $texts{key}->fn( 'test/key.1.asc' ); $texts{temp} = Text->new(); $texts{temp}->fn( 'test/temp' ); foreach my $name ( qw( plain alt_plain encrypted alt_encrypted signed key ) ) { my $entry = $texts{$name}; my $filename = $entry->fn(); my $fh = IO::File->new( $filename ) or die "cannot open $filename: $ERRNO"; $entry->data( [ $fh->getlines() ] ); } sub reset_handles { foreach ( $stdin, $stdout, $stderr ) { $_ = IO::Handle->new(); } $handles = GnuPG::Handles->new ( stdin => $stdin, stdout => $stdout, stderr => $stderr ); foreach my $name ( qw( plain alt_plain encrypted alt_encrypted signed key ) ) { my $entry = $texts{$name}; my $filename = $entry->fn(); my $fh = IO::File->new( $filename ) or die "cannot open $filename: $ERRNO"; $entry->fh( $fh ); } { my $entry = $texts{temp}; my $filename = $entry->fn(); my $fh = IO::File->new( $filename, 'w' ) or die "cannot open $filename: $ERRNO"; $entry->fh( $fh ); } } sub file_match { my ( $orig, @compares ) = @_; my $found_match = 0; foreach my $file ( @compares ) { return 1 if compare( $file, $orig ) == 0; } return 0; } # blank user_id_string and different validity for expired sig in GPG 2.2.x vs 1.x, 2.1 sub get_expired_test_sig_params { my $gnupg = shift; my $version = $gnupg->version; my %sig_params = ( date_string => '2000-03-16', hex_id => '56FFD10A260C4FA3', sig_class => 0x10, algo_num => 17, is_exportable => 1, ); if ($gnupg->cmp_version($gnupg->version, '2.2') > 0) { $sig_params{user_id_string} = ''; $sig_params{validity} = '?'; } else { $sig_params{user_id_string} = 'Frank J. Tobin ', $sig_params{validity} = '!'; } return %sig_params } 1; GnuPG-Interface-1.02/t/UserId.t000644 000765 000024 00000000626 12630404540 016726 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: UserId.t,v 1.1 2001/04/30 01:36:12 ftobin Exp $ # use strict; use lib './t'; use MyTest; use GnuPG::UserId; my $v1 = 'Dekan'; my $v2 = 'Frank Tobin'; my $user_id = GnuPG::UserId->new( as_string => $v1 ); # deprecation test TEST { $user_id->user_id_string() eq $v1; }; # deprecation test TEST { $user_id->user_id_string( $v2 ); $user_id->as_string() eq $v2; }; GnuPG-Interface-1.02/t/version_updates.t000644 000765 000024 00000001042 14034136570 020743 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w use strict; use lib './t'; use MyTest; use MyTestSpecific; TEST { my $gpg = GnuPG::Interface->new(call => './test/fake-gpg-v1'); return ($gpg->version() eq '1.4.23'); }; TEST { my $gpg = GnuPG::Interface->new(call => './test/fake-gpg-v2'); return ($gpg->version() eq '2.2.12'); }; TEST { my $gpg = GnuPG::Interface->new(call => './test/fake-gpg-v1'); my $v1 = $gpg->version(); $gpg->call('./test/fake-gpg-v2'); my $v2 = $gpg->version(); return ($v1 eq '1.4.23' && $v2 eq '2.2.12'); } GnuPG-Interface-1.02/t/detach_sign.t000644 000765 000024 00000001156 12630404540 020002 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: detach_sign.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->detach_sign( handles => $handles ); print $stdin @{ $texts{plain}->data() }; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdin( $texts{plain}->fh() ); $handles->options( 'stdin' )->{direct} = 1; my $pid = $gnupg->detach_sign( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/Interface.t000644 000765 000024 00000000632 14034136570 017435 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: Interface.t,v 1.1 2001/04/30 02:04:25 ftobin Exp $ # use strict; use lib './t'; use MyTest; use GnuPG::Interface; my $v1 = './test/fake-gpg-v1'; my $v2 = './test/fake-gpg-v2'; my $gnupg = GnuPG::Interface->new( call => $v1 ); # deprecation test TEST { $gnupg->gnupg_call() eq $v1; }; # deprecation test TEST { $gnupg->gnupg_call( $v2 ); $gnupg->call() eq $v2; }; GnuPG-Interface-1.02/t/wrap_call.t000644 000765 000024 00000001656 12630404540 017503 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: wrap_call.t,v 1.1 2001/05/03 07:32:34 ftobin Exp $ # use strict; use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->wrap_call ( commands => [ qw( --list-packets ) ], command_args => [ qw( test/key.1.asc ) ], handles => $handles, ); close $stdin; my @out = <$stdout>; waitpid $pid, 0; return @out > 0; #just check if we have output. }; TEST { return $CHILD_ERROR == 0; }; # same as above, but now with deprecated stuff TEST { reset_handles(); my $pid = $gnupg->wrap_call ( gnupg_commands => [ qw( --list-packets ) ], gnupg_command_args => [ qw( test/key.1.asc ) ], handles => $handles, ); close $stdin; my @out = <$stdout>; waitpid $pid, 0; return @out > 0; #just check if we have output. }; TEST { return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/000_setup.t000644 000765 000024 00000003113 13657001774 017260 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; use Cwd; use File::Path qw (make_path); use File::Copy; TEST { my $homedir = $gnupg->options->homedir(); make_path($homedir, { mode => 0700 }); copy('test/gpg.conf', $homedir . '/gpg.conf'); if ($gnupg->cmp_version($gnupg->version, '2.2') >= 0) { my $agentconf = IO::File->new( "> " . $homedir . "/gpg-agent.conf" ); # Classic gpg can't use loopback pinentry programs like fake-pinentry.pl. $agentconf->write( "allow-preset-passphrase\n". "allow-loopback-pinentry\n". "pinentry-program " . getcwd() . "/test/fake-pinentry.pl\n" ); $agentconf->close(); my $error = system("gpg-connect-agent", "--homedir", "$homedir", '/bye'); if ($error) { warn "gpg-connect-agent returned error : $error"; } $error = system('gpg-connect-agent', "--homedir", "$homedir", 'reloadagent', '/bye'); if ($error) { warn "gpg-connect-agent returned error : $error"; } $error = system("gpg-agent", '--homedir', "$homedir"); if ($error) { warn "gpg-agent returned error : $error"; } } reset_handles(); my $pid = $gnupg->import_keys(command_args => [ 'test/public_keys.pgp', 'test/secret_keys.pgp', 'test/new_secret.pgp' ], options => [ 'batch'], handles => $handles); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/MyTest.pm000644 000765 000024 00000002102 12630404540 017120 0ustar00jbrandtstaff000000 000000 # MyTest.pm # - module for use with test scripts # # Copyright (C) 2000 Frank J. Tobin # # This module is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # $Id: MyTest.pm,v 1.3 2001/08/21 13:31:50 ftobin Exp $ # package MyTest; use strict; use English qw( -no_match_vars ); use Exporter; use IO::File; use vars qw( @ISA @EXPORT ); @ISA = qw( Exporter ); @EXPORT = qw( TEST ); $OUTPUT_AUTOFLUSH = 1; print "1..", COUNT_TESTS(), "\n"; my $counter = 0; sub TEST ( & ) { my ( $code ) = @_; $counter++; &$code or print "not "; print "ok $counter\n"; } sub COUNT_TESTS { my ( $file ) = @_; $file ||= $PROGRAM_NAME; my $tests = 0; my $in = IO::File->new( $file ); while ( $_ = $in->getline() ) { $tests++ if /^\s*TEST\s*/; } return $tests; } 1; GnuPG-Interface-1.02/t/sign_and_encrypt.t000644 000765 000024 00000001323 13657001770 021064 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: sign_and_encrypt.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); $gnupg->options->push_recipients( '0x7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B' ); my $pid = $gnupg->sign_and_encrypt( handles => $handles ); print $stdin @{ $texts{plain}->data() }; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdin( $texts{plain}->fh() ); $handles->options( 'stdin' )->{direct} = 1; my $pid = $gnupg->sign_and_encrypt( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/list_secret_keys.t000644 000765 000024 00000004304 13657001772 021115 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: list_secret_keys.t,v 1.7 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; my $outfile; TEST { reset_handles(); $ENV{LC_MESSAGES} = 'C'; my $pid = $gnupg->list_secret_keys( handles => $handles ); close $stdin; $outfile = 'test/secret-keys/1.out'; my $out = IO::File->new( "> $outfile" ) or die "cannot open $outfile for writing: $ERRNO"; my $seckey_file = $gnupg->cmp_version($gnupg->version, '2.1') >= 0 ? 'pubring.kbx' : 'secring.gpg'; my $pubring_line = $gnupg->options->homedir() . '/' . $seckey_file . "\n"; while (<$stdout>) { if ($_ eq $pubring_line) { $out->print('test/gnupghome/'.$seckey_file."\n"); } elsif (/^--*$/) { $out->print("--------------------------\n"); } else { $out->print( $_ ); } } close $stdout; $out->close(); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { my $keylist; if ($gnupg->cmp_version($gnupg->version, '2.1') < 0) { $keylist = '0'; } else { if ($gnupg->cmp_version($gnupg->version, '2.1.11') <= 0) { $keylist = '1'; } else { $keylist = '2'; } } my @files_to_test = ( 'test/secret-keys/1.'.$keylist.'.test' ); return file_match( $outfile, @files_to_test ); }; TEST { reset_handles(); my $pid = $gnupg->list_secret_keys( handles => $handles, command_args => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' ); close $stdin; $outfile = 'test/secret-keys/2.out'; my $out = IO::File->new( "> $outfile" ) or die "cannot open $outfile for writing: $ERRNO"; $out->print( <$stdout> ); close $stdout; $out->close(); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdout( $texts{temp}->fh() ); $handles->options( 'stdout' )->{direct} = 1; my $pid = $gnupg->list_secret_keys( handles => $handles, command_args => '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' ); waitpid $pid, 0; $outfile = $texts{temp}->fn(); return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/z_delete_keys.t000644 000765 000024 00000001774 14034137171 020371 0ustar00jbrandtstaff000000 000000 use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->wrap_call( gnupg_commands => [qw( --delete-secret-keys )], gnupg_command_args => [qw( 0x93AFC4B1B0288A104996B44253AE596EF950DA9C )], handles => $handles, ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); my $pid = $gnupg->wrap_call( gnupg_commands => [qw( --delete-keys )], gnupg_command_args => [qw( 0x93AFC4B1B0288A104996B44253AE596EF950DA9C )], handles => $handles, ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); my $pid = $gnupg->wrap_call( gnupg_commands => [qw( --delete-secret-and-public-keys )], gnupg_command_args => [qw( 278F850AA702911F1318F0A61B913CE9B6747DDC )], handles => $handles, ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/encrypt.t000644 000765 000024 00000003105 13657001770 017222 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: encrypt.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->wrap_call( handles => $handles, commands => ['--update-trustdb'], ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $gnupg->options->clear_recipients(); $gnupg->options->clear_meta_recipients_keys(); $gnupg->options->push_recipients( '0x7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B' ); my $pid = $gnupg->encrypt( handles => $handles ); print $stdin @{ $texts{plain}->data() }; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); my @keys = $gnupg->get_public_keys( '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' ); $gnupg->options->clear_recipients(); $gnupg->options->clear_meta_recipients_keys(); $gnupg->options->push_meta_recipients_keys( @keys ); my $pid = $gnupg->encrypt( handles => $handles ); print $stdin @{ $texts{plain}->data() }; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $gnupg->options->clear_recipients(); $gnupg->options->clear_meta_recipients_keys(); $gnupg->options->push_recipients( '0x7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B' ); $handles->stdin( $texts{plain}->fh() ); $handles->options( 'stdin' )->{direct} = 1; my $pid = $gnupg->encrypt( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/Fingerprint.t000644 000765 000024 00000000762 12630404540 020023 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: Fingerprint.t,v 1.1 2001/04/30 01:36:12 ftobin Exp $ # use strict; use lib './t'; use MyTest; use GnuPG::Fingerprint; my $v1 = '5A29DAE3649ACCA7BF59A67DBAED721F334C9V14'; my $v2 = '4F863BBBA8166F0A340F600356FFD10A260C4FA3'; my $fingerprint = GnuPG::Fingerprint->new( as_hex_string => $v1 ); # deprecation test TEST { $fingerprint->hex_data() eq $v1; }; # deprecation test TEST { $fingerprint->hex_data( $v2 ); $fingerprint->as_hex_string() eq $v2; }; GnuPG-Interface-1.02/t/sign.t000644 000765 000024 00000001131 12630404540 016463 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: sign.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->sign( handles => $handles ); print $stdin @{ $texts{plain}->data() }; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdin( $texts{plain}->fh() ); $handles->options( 'stdin' )->{direct} = 1; my $pid = $gnupg->sign( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/get_public_keys.t000644 000765 000024 00000023504 13657001774 020717 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: get_public_keys.t,v 1.9 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; use GnuPG::PrimaryKey; use GnuPG::SubKey; my ( $given_key, $handmade_key ); TEST { reset_handles(); my @returned_keys = $gnupg->get_public_keys_with_sigs( '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' ); return 0 unless @returned_keys == 1; $given_key = shift @returned_keys; my $pubkey_data = [ Math::BigInt->from_hex('0x'. '88FCAAA5BCDCD52084D46143F44ED1715A339794641158DE03AA2092AFD3174E3DCA2CB7DF2DDC6FEDF7C3620F5A8BDAD06713E6153F8748DD76CB97305F30CBA8F8801DB47FAC11EED725F55672CB9BDAD629178A677CBB089B3E8AE0D9A9AD7741697A35F2868C62D25670994A92D810480173DC24263EEA0F103A43C0B64B'), Math::BigInt->from_hex('0x'. '8F2A3842C70FF17660CBB78C78FC93F534AB9A17'), Math::BigInt->from_hex('0x'. '83E348C2AA65F56DE84E8FDCE6DA7B0991B1C75EC8CA446FA85869A43350907BFF36BE512385E8E7E095578BB2138C04E318495873218286DE2B8C86F36EA670135434967AC798EBA28581F709F0C6B696EB512D3E561E381A06E4B5239BCC655015F9A926C74E4B859B26EAD604F208A556511A76A40EDCD9C38E6BD82CCCB4'), Math::BigInt->from_hex('0x'. '80DE04C85E30C9D62C13F90CFF927A84A5A59D0900B3533D4D6193FEF8C5DAEF9FF8A7D5F76B244FBC17644F50D524E0B19CD3A4B5FC2D78DAECA3FE58FA1C1A64E6C7B96C4EE618173543163A72EF954DFD593E84342699096E9CA76578AC1DE3D893BCCD0BF470CEF625FAF816A0F503EF75C18C6173E35C8675AF919E5704') ]; $handmade_key = GnuPG::PrimaryKey->new ( length => 1024, algo_num => 17, hex_id => '53AE596EF950DA9C', creation_date => 949813093, creation_date_string => '2000-02-06', owner_trust => '-', usage_flags => 'scaESCA', pubkey_data => $pubkey_data, ); $handmade_key->fingerprint ( GnuPG::Fingerprint->new( as_hex_string => '93AFC4B1B0288A104996B44253AE596EF950DA9C', ) ); # Note, blank user_id_string and different validity for expired sig in GPG 2.2.x my $uid0 = GnuPG::UserId->new( as_string => 'GnuPG test key (for testing purposes only)', validity => '-'); $uid0->push_signatures( GnuPG::Signature->new( date => 1177086597, algo_num => 17, is_exportable => 1, user_id_string => 'GnuPG test key (for testing purposes only)', date_string => '2007-04-20', hex_id => '53AE596EF950DA9C', sig_class => 0x13, validity => '!'), GnuPG::Signature->new( get_expired_test_sig_params($gnupg), date => 953180097, ), GnuPG::Signature->new( date => 949813093, algo_num => 17, is_exportable => 1, user_id_string => 'GnuPG test key (for testing purposes only)', date_string => '2000-02-06', hex_id => '53AE596EF950DA9C', sig_class => 0x13, validity => '!'), GnuPG::Signature->new( date => 1177086329, algo_num => 17, is_exportable => 1, user_id_string => 'GnuPG test key (for testing purposes only)', date_string => '2007-04-20', hex_id => '53AE596EF950DA9C', sig_class => 0x13, validity => '!'), ); # Note, blank user_id_string and different validity for expired sig in GPG 2.2.x my $uid1 = GnuPG::UserId->new( as_string => 'Foo Bar (1)', validity => '-'); $uid1->push_signatures( GnuPG::Signature->new( date => 1177086330, algo_num => 17, is_exportable => 1, user_id_string => 'GnuPG test key (for testing purposes only)', date_string => '2007-04-20', hex_id => '53AE596EF950DA9C', sig_class => 0x13, validity => '!'), GnuPG::Signature->new( get_expired_test_sig_params($gnupg), date => 953180103, ), GnuPG::Signature->new( date => 953179891, algo_num => 17, is_exportable => 1, user_id_string => 'GnuPG test key (for testing purposes only)', date_string => '2000-03-16', hex_id => '53AE596EF950DA9C', sig_class => 0x13, validity => '!')); $handmade_key->push_user_ids($uid0, $uid1); my $subkey_signature = GnuPG::Signature->new ( validity => '!', algo_num => 17, hex_id => '53AE596EF950DA9C', date => 1177086380, date_string => '2007-04-20', user_id_string => 'GnuPG test key (for testing purposes only)', sig_class => 0x18, is_exportable => 1, ); my $uid2_signature = GnuPG::Signature->new ( validity => '!', algo_num => 17, hex_id => '53AE596EF950DA9C', date => 953179891, date_string => '2000-03-16', ); my $ftobin_signature = GnuPG::Signature->new ( validity => '!', algo_num => 17, hex_id => '56FFD10A260C4FA3', date => 953180097, date_string => '2000-03-16', ); my $designated_revoker_sig = GnuPG::Signature->new ( validity => '!', algo_num => 17, hex_id => '53AE596EF950DA9C', date => 978325209, date_string => '2001-01-01', sig_class => 0x1f, is_exportable => 1 ); my $revoker = GnuPG::Revoker->new ( algo_num => 17, class => 0x80, fingerprint => GnuPG::Fingerprint->new( as_hex_string => '4F863BBBA8166F0A340F600356FFD10A260C4FA3'), ); $revoker->push_signatures($designated_revoker_sig); my $subkey_pub_data = [ Math::BigInt->from_hex('0x'. '8831982DADC4C5D05CBB01D9EAF612131DDC9C24CEA7246557679423FB0BA42F74D10D8E7F5564F6A4FB8837F8DC4A46571C19B122E6DF4B443D15197A6A22688863D0685FADB6E402316DAA9B560D1F915475364580A67E6DF0A727778A5CF3'), Math::BigInt->from_hex('0x'. '6'), Math::BigInt->from_hex('0x'. '2F3850FF130C6AC9AA0962720E86539626FAA9B67B33A74DFC0DE843FF3E90E43E2F379EE0182D914FA539CCCF5C83A20DB3A7C45E365B8A2A092E799A3DFF4AD8274EB977BAAF5B1AFB2ACB8D6F92454F01682F555565E73E56793C46EF7C3E') ]; my $subkey = GnuPG::SubKey->new ( validity => '-', length => 768, algo_num => 16, hex_id => 'ADB99D9C2E854A6B', creation_date => 949813119, creation_date_string => '2000-02-06', usage_flags => 'e', pubkey_data => $subkey_pub_data, ); $subkey->fingerprint ( GnuPG::Fingerprint->new( as_hex_string => '7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B' ) ); $subkey->push_signatures( $subkey_signature ); $handmade_key->push_subkeys( $subkey ); $handmade_key->push_revokers( $revoker ); $handmade_key->compare( $given_key ); }; TEST { my $subkey1 = $given_key->subkeys()->[0]; my $subkey2 = $handmade_key->subkeys()->[0]; bless $subkey1, 'GnuPG::SubKey'; my $equal = $subkey1->compare( $subkey2 ); warn 'subkeys fail comparison; this is a known issue with GnuPG 1.0.1' if not $equal; return $equal; }; TEST { # Some versions of GnuPG 2.2.x give same user_id and validity for expired sig as 1.4 # this forces them to be consistent and still test them with 2.2 codepath no warnings qw(redefine once); local *GnuPG::Signature::compare = sub { my ($self, $other) = @_; if ($gnupg->cmp_version($gnupg->version, '2.2') > 0) { if ( defined $self->user_id_string and $self->user_id_string eq 'Frank J. Tobin ') { $self->user_id_string(''); $self->validity('?'); } } my @compared_fields = qw( validity algo_num hex_id date date_string sig_class is_exportable ); foreach my $field ( @compared_fields ) { return 0 unless $self->$field eq $other->$field; } # check for expiration if present? return 0 unless (defined $self->expiration_date) == (defined $other->expiration_date); if (defined $self->expiration_date) { return 0 unless (($self->expiration_date == $other->expiration_date) || ($self->expiration_date_string eq $other->expiration_date_string)); } return 1; }; $handmade_key->compare( $given_key, 1 ); }; GnuPG-Interface-1.02/t/encrypt_symmetrically.t000644 000765 000024 00000001215 12630404540 022170 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: encrypt_symmetrically.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->encrypt_symmetrically( handles => $handles ); print $stdin @{ $texts{plain}->data() }; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdin( $texts{plain}->fh() ); $handles->options( 'stdin' )->{direct} = 1; my $pid = $gnupg->encrypt_symmetrically( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/verify.t000644 000765 000024 00000001142 12630404540 017031 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: verify.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->verify( handles => $handles ); print $stdin @{ $texts{signed}->data() }; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdin( $texts{signed}->fh() ); $handles->options( 'stdin' )->{direct} = 1; my $pid = $gnupg->verify( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/clearsign.t000644 000765 000024 00000001146 12630404540 017500 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: clearsign.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->clearsign( handles => $handles ); print $stdin @{ $texts{plain}->data }; close $stdin; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdin( $texts{plain}->fh() ); $handles->options( 'stdin' )->{direct} = 1; my $pid = $gnupg->clearsign( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/t/import_keys.t000644 000765 000024 00000001206 12630404540 020073 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # # $Id: import_keys.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $ # use strict; use English qw( -no_match_vars ); use lib './t'; use MyTest; use MyTestSpecific; TEST { reset_handles(); my $pid = $gnupg->import_keys( handles => $handles ); print $stdin @{ $texts{key}->data() }; close $stdin; my @output = <$stdout>; waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { reset_handles(); $handles->stdin( $texts{key}->fh() ); $handles->options( 'stdin' )->{direct} = 1; my $pid = $gnupg->import_keys( handles => $handles ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-1.02/test/fake-pinentry.pl000755 000765 000024 00000001323 13657001770 021201 0ustar00jbrandtstaff000000 000000 #!/usr/bin/perl -w # Use this for your test suites when a perl interpreter is available. # # The encrypted keys in your test suite that you expect to work must # be locked with a passphrase of "test" # # Author: Daniel Kahn Gillmor # # License: This trivial work is hereby explicitly placed into the # public domain. Anyone may reuse it, modify it, redistribute it for # any purpose. use strict; use warnings; # turn off buffering $| = 1; print "OK This is only for test suites, and should never be used in production\n"; while () { chomp; next if (/^$/); next if (/^#/); print ("D supercalifragilisticexpialidocious\n") if (/^getpin/i); print "OK\n"; exit if (/^bye/i); } 1; GnuPG-Interface-1.02/test/fake-gpg-v2000755 000765 000024 00000000044 14034136570 020015 0ustar00jbrandtstaff000000 000000 #!/bin/sh echo 'gpg (GnuPG) 2.2.12' GnuPG-Interface-1.02/test/passphrase000644 000765 000024 00000000005 12630404540 020145 0ustar00jbrandtstaff000000 000000 test GnuPG-Interface-1.02/test/public_keys.pgp000644 000765 000024 00000006532 13657001770 021115 0ustar00jbrandtstaff000000 000000 ™¢8œÿeˆüª¥¼ÜÕ „ÔaCôNÑqZ3—”dXÞª ’¯ÓN=Ê,·ß-Üoí÷ÃbZ‹ÚÐgæ?‡HÝvË—0_0˨ø€´¬î×%õVrË›ÚÖ)Šg|»›>ŠàÙ©­wAiz5ò†ŒbÒVp™J’ØHsÜ$&>ê:CÀ¶K *8BÇñv`Ë·Œxü“õ4«šƒãHªeõmèNÜæÚ{ ‘±Ç^ÈÊDo¨Xi¤3P{ÿ6¾Q#…èçà•W‹²ŒãIXs!‚†Þ+Œ†ón¦pT4–zǘ뢅÷ ðÆ¶–ëQ->V8äµ#›ÌePù©&ÇNK…›&êÖò¥VQv¤ÜÙÃŽkØ,Ì´€ÞÈ^0ÉÖ,ù ÿ’z„¥¥ ³S=Ma“þøÅÚïŸø§Õ÷k$O¼dOPÕ$౜Ӥµü-xÚì£þXúdæÇ¹lNæ5C:rï•MýY>„4&™ nœ§ex¬ãØ“¼Í ôpÎö%úø õïuÁŒasã\†u¯‘žWˆa!:PÙ €O†;»¨o 4`VÿÑ & O£ S®YnùPÚœО.±ú©i ¬u¯ÿO¦EßaF—£áÇŸRí'صà&Šîˆ"“ë¤J<çÚÙ°´*GnuPG test key (for testing purposes only)ˆb  €F(ê…eGPG S®YnùPÚœnwû-\¼j>‘EVz£œ(MLƒp tsí±äÀx`Ømx;sò—ã°ˆF8Ð_Á VÿÑ & O£è´Ÿv´&%­>Êp(÷vh9O¶É«ž!ùy£[XTÿÎ;¼F‚:* ®žÚ°ˆ\8œÿe Âg € S®YnùPÚœ•¥ŸD¹Mïy'ÖŠbyF ÚiúÇ>Äk‹–1{QÃý/Þ%€>Ö‡°´ Foo Bar (1)ˆ_  €F(ézeGPG S®YnùPÚœÂOš˜ªuC‰}qW~D¯Bâú!ÆËž2Ô–àÏyH ÑÅâ¹#ò°ˆF8Ð_Ç VÿÑ & O£n/Ÿtäb¥íáÒ®à™í6 †Ål¤KÆôâ‚IÖ¡ÜY·¼ ;ú°ˆ\8Ð^ó Âg € S®YnùPÚœù= u5ÏJ%æ"î{á6ÑÊÛJŸ~Ø&GÉÝ @cû¤-°ÖÀU- 9°¸Í8œÿˆ1˜-­ÄÅÐ\»ÙêöÜœ$Χ$eWg”#û ¤/tÑ ŽUdö¤ûˆ7øÜJFW±"æßKD=zj"hˆcÐh_­¶ä1mª›V ‘Tu6E€¦~mð§'wŠ\óþ/8Pÿ jɪ br†S–&ú©¶{3§Mü èCÿ>ä>/7žà-‘O¥9ÌÏ\ƒ¢ ³§Ä^6[Š* .yš=ÿJØ'N¹wº¯[û*Ëo’EOh/UUeç>VyˆNF(é¬eGPG S®YnùPڜ⛺.Føˆ•½î„¢Fù~j+¹É¹™¬«!´b0s±»ˆ«ÞºÓýs¶B°™¢7ɱÔ4Kk1…ÛfÏ„ÓgˆJô að/b+/ÏÒÞýé„QôñÂoŽZ \?*I¼´–5¥r¬õ˜§@ïª#îÍ b¥û% 3ÜÉ«±}ëÝ]––âgÁØí ãQ‘ÑjôÁp‡—xœEAx8m–—,Љ1_£HU´fFŸ ³çÊ&NÓ0ÖׇÞJ<\~“þ(Q‰¯NçÏzp¹).‰ØSŠÐT´¹a¤¶\·8r±3ºƒ¡_÷î„õ“;O ñÔ©aGÆÓ«؉ Bá†c;¹Ž)qeOóžBw¤"œàgtÓïy. ¨Fª†,iL‘$liRdnË=  z·7°®º9j‡ ™ûcšÕ!ފ݈yòÆbîàô!5…ïHž*%¬|Š+Du äþw8:)ý»ñ¦ÚkâaMÌLÙ´ºõØb'ØÆÑd}ÎA<~Ä3Ó¸’¬²7(ìu\j‡®–d>0‚÷vEÅu¿ôP‹:ŠQÝ Ù¨Žbð>J(Ù6EVS´2ãûãO´#Frank J. Tobin ˆ[7ɲ Âg € VÿÑ & O£Ož=” 2ÄM‰¨ÏÑWò5kØb@E7<.¤&HMl÷7Óu|dT<³°ˆF7ÌÕ øP:ô¶^&ÁŸu ‚ðŸ/ÅH‰ê;½)ÿåˠغmC¤.¼¶J#¬þÿoM¹œ°ˆF80² í„„KÛ®fK ñ'W“¸r?ße÷ƒ >xqœèó ÚîBV¼]‹'ŸÆé†[f‹{‹@°´Dekanˆ[7Ì- Âg € VÿÑ & O£Q¤ ±Q vÿdÓc àÚL¯ e¿3&óŸ@îÖ²@f’N®þû¹­>ºH¾q†°ˆF7Ìì øP:ô¶^ ; üLˆÇÿ„ܡؗög1jÕ„ÿÌ/ÈߘªwÜö)í¾KV°ˆF80²/ í„„KÛ®¦š È\ïÏÿL^Á)DçÆ;DÈÆ QŠÑ’ò¼ëqA;L°ÝéÒ5°þ`ê°´ Frank J. Tobin ˆ[7xýæ Âg € VÿÑ & O£Óœ £¦ð9uüŸ/0æG$<¯ð{ú“ŸnJ1PShpfe¿ïLEŒâe ù°ˆE80²/ í„„KÛ®yΗiéJsuFi®éŠŒ`a›6-Ô° ÞùK)b–}y…'ärf°´'Frank J. Tobin ˆ[7|fÓ Âg € VÿÑ & O£ëYž,æÏaxijŸpØÿxé%çŸv(Ñïg‡³“¦ÑWÿ[õìî’_$°ˆF80²/ í„„KÛ®”Ð Š _žÕ¾þ:£Îº±P¸Ü¿È Ë /rziE3_o”ÖªŽ'é†@°¹ 7˦²'qò @+ˆŒZ‹¤, öHðTÉ#RƒbPžöKÑ–¾yú©ŸyîV‹ß¤€8\ÊO[£½%½[¾œ°$kFYïhØ9‘r;Þþ¸z޶9ëG}¨~‘“4óüA¼ªN¶q,+”ž)ÅhÕ°BmAÉØ-—Ä™ay‹aƒNg«ò·BŽ‹k¤ê¦÷%fõó[Ôº/ö[åI£û²ÈúÉNÊŠX°úIxÚ˜Ú[‘˳°õ–§þ­÷Ðþgk~Ç I±v @ŸcõøÏèAE4´‰Užì'ãƒØÝÅÃÍà.bÃ?§ÑX£³ðûUvjé„) ­APé9„⢷­%MÄ%¿úDþkù+JžsAœe¹|ÞÏë„îv–²þ6`w,Ú¦æóÒÐRNÃH’X[©ªžï„Hµg¸ˆïÕPiÖõ¶õäàÚ9ŒÝü´‹Ùjýé™W†÷ûÏ3WˆÄ±mð5#Yê×ù-Þ_„úk.ùü^7«ÒQ¥…jOª§ŒÅ‚æ@‡nƒ4/§ù/>)Œ-õ÷$\gq×ÒÇZúÄ2‚£;ʬ‰‡MaÑèÞ¾ )<(TtéH÷®ëM‰‘~Î+˜Á‰mÓX3€±sKæÓövz³ŽŒ¶NÛœ&’+Qj²®xgÇø¿~"ˆL 7˦ Âg VÿÑ & O£¶ £lïÞ\‹þ¡­î@¢lj …ß¿ú fŒÄÿ);QzÞ˜²?…°GnuPG-Interface-1.02/test/signed.1.asc000644 000765 000024 00000000641 12630404540 020157 0ustar00jbrandtstaff000000 000000 -----BEGIN PGP MESSAGE----- Version: GnuPG v1.0.1 (FreeBSD) Comment: For info see http://www.gnupg.org owGbwMvMwCQYvC4y72fArTmMp5uSGCzmCs1VCslXyElNLMpTKM9ILFHILFZIz89P UUjMS4ELlOQrJKUqlCXmlKam6HCVZOQXpyqUFJWWZBQDlWQmZygkJ+bl5ZeAFBVn JGan5inkFykkZyTmpaem6ClxcfpWFpdYKYRkpCo45ednK+SnKTgCtRdzcXW4sTAI MjGwsTKBXMLAxSkAcx5fDcM8rfgEBbsFNf+qm4L2br7wUzz0/V5Rhnk6tiKB9bkN M1atrOP7sUc4sO6z+goA =qwXx -----END PGP MESSAGE----- GnuPG-Interface-1.02/test/plain.2.txt000644 000765 000024 00000000015 13657001770 020066 0ustar00jbrandtstaff000000 000000 test message GnuPG-Interface-1.02/test/secret-keys/000755 000765 000024 00000000000 14034140255 020314 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/test/encrypted.2.gpg000644 000765 000024 00000001021 13657001770 020714 0ustar00jbrandtstaff000000 000000 -----BEGIN PGP MESSAGE----- hQEMAw3NS2KuRB0PAQgAuCMQO6blPRIJZib+kDa51gac+BYPl8caXYTLqIHtiz2/ YRVqePJON4lNAqT6qUksIzQHtejFO6tb1SLqgX9Ti+fKAMLrQw9VGOYaJFoRrTJs +X33S4GHVVikRTu0dydAsekbfPSc2nRmTFUlSEV3psgAmg9xy8KA6cZroK9Xfcuh xW7KLE0hLP+2NZ7zNmJMdu6LDGzvlQsnm1UeElXK8XdMGf8kA3R+GgeeOnR/oEQc Uep77k/fLc+UV4fp9Dk1OBeg3Ko/irSaefk4mU7F4HmS8jIERHRvXBTiur1Zx8Nx 9U3fcQuc+P9+JC89iS4PJPF1Hr0MlezAghZYJrhOrtJIAe5Uaft5KMGRfy0VQnAs MHqGnGtzzVWK6GK83ibgG4tTfPEHHIgNFsJf3rM4cWklUmCS9TeeDJJZfhnRA6+/ X82e6OI7QNbO =DlGE -----END PGP MESSAGE----- GnuPG-Interface-1.02/test/public-keys-sigs/000755 000765 000024 00000000000 14034140255 021250 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/test/plain.1.txt000644 000765 000024 00000000174 12630404540 020063 0ustar00jbrandtstaff000000 000000 "To learn what is good and what is to be valued, those truths which cannot be shaken or changed." Myst: The Book of Atrus GnuPG-Interface-1.02/test/encrypted.1.gpg000644 000765 000024 00000001134 12630404540 020710 0ustar00jbrandtstaff000000 000000 -----BEGIN PGP MESSAGE----- Version: GnuPG v1.0.1 (FreeBSD) Comment: For info see http://www.gnupg.org hM4DrbmdnC6FSmsQAv48WgPo026qT5y6VRoeV+fA/c2XAj+cPuKXa19ntGLx1oAk Cj1Zd7m68gsnG9OOglat013s2ADkhLaR4FURcCjT57XZNvDacJK4oSTl91w12ClU TptmVoovBQhVNgyDmu8C/js3bgmSlkbZJIWh1NUbOYkV9ugP9i+ryYl9QIcjbWGq 9D/tgNJri0/k/L2+HywSktjMJI0KAF+L7RcMCQdzfQ2ffkm4ZWlRXGbGW4p7GBON JazfmBp1bKYw90D0Xwv5PMmHVh3T1sSWpZpeD5CHtqHWhWFFLi3qrh+A7VggATXz s9JU5FtKoLkpd+O3uFaNYbnCBjex5PwO+RFLEPJs5+gUEyNXsZlnIt+tLa3aRxzV brkdspHcgTZG7z00ZMRC4nLVuNLfflvPWrGSIIWHP+424dFPKdClabJ0bAxAp5B5 rDQKx0ef6AI+ =EQaf -----END PGP MESSAGE----- GnuPG-Interface-1.02/test/key.1.asc000644 000765 000024 00000003146 12630404540 017501 0ustar00jbrandtstaff000000 000000 -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.0.1h (FreeBSD) Comment: For info see http://www.gnupg.org mQGiBDic/2URBACI/KqlvNzVIITUYUP0TtFxWjOXlGQRWN4DqiCSr9MXTj3KLLff Ldxv7ffDYg9ai9rQZxPmFT+HSN12y5cwXzDLqPiAHbR/rBHu1yX1VnLLm9rWKReK Z3y7CJs+iuDZqa13QWl6NfKGjGLSVnCZSpLYEEgBc9wkJj7qDxA6Q8C2SwCgjyo4 QscP8XZgy7eMePyT9TSrmhcEAIPjSMKqZfVt6E6P3ObaewmRscdeyMpEb6hYaaQz UJB7/za+USOF6OfglVeLshOMBOMYSVhzIYKG3iuMhvNupnATVDSWeseY66KFgfcJ 8Ma2lutRLT5WHjgaBuS1I5vMZVAV+akmx05LhZsm6tYE8gilVlEadqQO3NnDjmvY LMy0BACA3gTIXjDJ1iwT+Qz/knqEpaWdCQCzUz1NYZP++MXa75/4p9X3ayRPvBdk T1DVJOCxnNOktfwteNrso/5Y+hwaZObHuWxO5hgXNUMWOnLvlU39WT6ENCaZCW6c p2V4rB3j2JO8zQv0cM72Jfr4FqD1A+91wYxhc+NchnWvkZ5XBLQqR251UEcgdGVz dCBrZXkgKGZvciB0ZXN0aW5nIHB1cnBvc2VzIG9ubHkpiFwEExECABwFAjic/2UF CQPCZwAECwoEAwMVAwIDFgIBAheAAAoJEFOuWW75UNqclaUAn0S5f03veSfWimJ5 RiAJ2mn6Asc+AJ0SGcRri5Yxe1HD/R4GL94lgD7Wh4hGBBARAgAGBQI40F/BAAoJ EFb/0QomDE+j6LQAn3YAtCYIJa0+ynAo93ZoOU+2yasbAJ4h+XmjW1hU/847vEaC OhUqDa6e2rQLRm9vIEJhciAoMSmIXAQTEQIAHAUCONBe8wUJA8JnAAQLCgQDAxUD AgMWAgECF4AACgkQU65ZbvlQ2pz5BwCdET0gdTXPSiXmIu574Tad0crbDkoAn37Y JkfJ3QpAY/ukLbDWwFUtFQw5iEYEEBECAAYFAjjQX8cACgkQVv/RCiYMT6NuLwCf dORipe3h0q7gme02CobFbKRLjcYAnRT0kAgd4oJJ1gahEdxZt7wJEDv6uM0EOJz/ fxADAIgxmC2txMXQXLsB2er2EhMd3JwkzqckZVdnlCP7C6QvdNENjn9VZPak+4g3 +NxKRlccGbEi5t9LRD0VGXpqImiIY9BoX6225AIxbaqbVg0fkVR1NkWApn5t8Kcn d4pc8wADBgL+LzhQ/xMMasmqCWJyDoZTlib6qbZ7M6dN/A3oQ/8+kOQ+Lzee4Bgt kU+lOczPXIOiDbOnxF42W4oqCS55mj3/StgnTrl3uq9bGvsqy41vkkVPAWgvVVVl 5z5WeTxG73w+iEwEGBECAAwFAjic/38FCQPCZwAACgkQU65ZbvlQ2pxQagCeLShZ NrESCT3im8kmmdh4yneEddAAn0Yug2I+wLDO58866cQugR1qhrfd =/tKz -----END PGP PUBLIC KEY BLOCK----- GnuPG-Interface-1.02/test/secret_keys.pgp000644 000765 000024 00000002331 13657001770 021115 0ustar00jbrandtstaff000000 000000 •Ï8œÿeˆüª¥¼ÜÕ „ÔaCôNÑqZ3—”dXÞª ’¯ÓN=Ê,·ß-Üoí÷ÃbZ‹ÚÐgæ?‡HÝvË—0_0˨ø€´¬î×%õVrË›ÚÖ)Šg|»›>ŠàÙ©­wAiz5ò†ŒbÒVp™J’ØHsÜ$&>ê:CÀ¶K *8BÇñv`Ë·Œxü“õ4«šƒãHªeõmèNÜæÚ{ ‘±Ç^ÈÊDo¨Xi¤3P{ÿ6¾Q#…èçà•W‹²ŒãIXs!‚†Þ+Œ†ón¦pT4–zǘ뢅÷ ðÆ¶–ëQ->V8äµ#›ÌePù©&ÇNK…›&êÖò¥VQv¤ÜÙÃŽkØ,Ì´€ÞÈ^0ÉÖ,ù ÿ’z„¥¥ ³S=Ma“þøÅÚïŸø§Õ÷k$O¼dOPÕ$౜Ӥµü-xÚì£þXúdæÇ¹lNæ5C:rï•MýY>„4&™ nœ§ex¬ãØ“¼Í ôpÎö%úø õïuÁŒasã\†u¯‘žWÿ\«{sï@`º’hÊ $AEÈeSœŸáàÉþ×:Üø ö|Ïíˆa!:PÙ €O†;»¨o 4`VÿÑ & O£ S®YnùPÚœО.±ú©i ¬u¯ÿO¦EßaF—£áÇŸRí'صà&Šîˆ"“ë¤J<çÚÙ°´*GnuPG test key (for testing purposes only)ˆ_  €F(éyeGPG S®YnùPÚœ£8Î_Ùº.Á‡Ëþ„´e0NFT>•ž9T ðÉ”'Egä>/7žà-‘O¥9ÌÏ\ƒ¢ ³§Ä^6[Š* .yš=ÿJØ'N¹wº¯[û*Ëo’EOh/UUeç>Vyÿ\«{sï@`©ù¢¡a}ÅÓ¤ÓsÝøm똽è¯è¤Ò*fh¥I¨ò–÷GEXD¤ö-š¥x),+ŒîFðÃ"àÊR¦;OÅvïƒ\ZL_½C©ŸóçM„XsêO-í <’ä9>ÞRícš >¤6ˆNF(é¬eGPG S®YnùPڜ⛺.Føˆ•½î„¢Fù~j+¹É¹™¬«!´b0s±»ˆ«ÞºÓýs¶B°GnuPG-Interface-1.02/test/new_secret.pgp000644 000765 000024 00000007003 13657001770 020734 0ustar00jbrandtstaff000000 000000 -----BEGIN PGP PRIVATE KEY BLOCK----- lQPGBFf9iNIBCACZGF36JFTAggUJK85gweUquqh0kvVQICUtyiHXFXBBPzCK+RWL oc5yeOfILHH7FfOztwPH1oJ7SWQtOgpuoiMHPtF7ne+MYevMf9jTYb/xCT0yZID5 /ieoHwUQQPiowxGewOww23RLQ1Cf46nqGBUD+fsWwT2Eq6ojLp/H72h+2lQ1ZCWd Q/9MSQQgDo5tWptokFGmLBKCS59pYMBaLbKSj7lFa/ekPm9zhcdmmLrLHCS9rIUP VKlWAg02MVmMB4fYm9nbtuwYHWvbDFYzpVr2WNlRZlPy0Y46ahxFbFwhtmOJAgT1 tgaQtDXo3kXRXngYZstDfe61Hqmc44j1vJ4VABEBAAH+BwMCnvb4v9vnhhzmdZdJ EzK3ikXYQp3PcOMDlRE5qtBmXhOJXH2tdEmXjegjWGA501eeoks0VnpBba2m4B36 Z37fjpOEi4QOuTn6emVwijJZgmmTAC7JHNzAW+IsiRvk/2907UZCwa/1UQpC0bik pHTZx+yKp33vGbkbCkKgHFQoHcS9D1by0WOkaLSlcE9CUCKb5LCe2Q1KDwZGrg60 4WUvg9eM2eatixAyOJEoRONlXDcQnUhSnG5+TUPNhVVWIaM/tPAgYmBG5oCSJ/N0 ls8cXoOVup/itBHo2Bfn+nyh0OAWdgdVmB0rPYUCLJV0FiQx5tB59OHmA3Naokj5 rvumyklCg314NnkEXrbPq7kKbX0X8UPoXdzAmalb4++OhgzEwd3NkWxvFSxKkQAt XAU5i9XNHJXLwATAMlEaXMBmfcpjyIx4WpBUSmYMTjh0Nu5ee+kGvMY9fUxOKbet IS9agFSMwVNRsX91+pKtBCQc7Je5tIrLhC8Hbvotn0GA8iFgu6LBqkrUO9Rh30Xs vzz3oXm7WgHbL30m9h+rJ2dmPZOwmW/0zRUec/7alizx0T4sLx7T0qUPUxeEjkeU JWtqfrcXEc3xIR9r5S2xqsUSKx6h1UhHMeMtQaDBgeH/Syq7a2gnkNoY84xxojGj lGkis5PF3xFpYqvjY0thyPFNxQguRlqktN8gNB+V1dShbCpNI9bDzv4pzvogEiM0 EM/xvJSCkARCe6nqOugWV8j5f3+9tuyREqcidHq+PR+USoNYdUWQO14kPY6e62wO lC5B4G7TDQtigCfOyEOiPXYC/qnC8sPVR2u5bCYm2YJT7L+rYRLSN+628qz7BwH3 9XtpnRtBFWpjI5qjn4uMM42e3k5UVB/r4GyrLXhEuO8D81TVzRQhjiqLweguk73h VDjEd0yachHbtCxHbnVQRzo6SW50ZXJmYWNlIFRlc3Qga2V5IDx0ZXN0QGV4YW1w bGUub3JnPokBNwQTAQgAIQUCV/2I0gIbAwULCQgHAgYVCAkKCwIEFgIDAQIeAQIX gAAKCRAbkTzptnR93EZkB/9groVsVMBJtGP1GSFMg2Q9loyijXT2P6hCbUTS4YMz O4jQPB8UQ39XIhyWo7hVGsXeA777+7VTto7q0CG9Ph7FTGKK8W2AnzTUKNdXAC6h qIc+ymvlm71GxhkKFR0vDbFg6CLJ/MX/x1Bd0TKh4RZtgOqX6A7Pzw/AI7f2YJcJ BKPT+/q/F/Wp1r+mxZ5pxUvYm643GVzdnbtuoqgBLng/3n1zjIz+oIz6RGBjzHni 3TUTKe//ewn1lIdTxPdUZA9G4vTE5dCnM4MHTxQSXA+aUexuONswQhiANtfVCW8c sf9MQpkQ/Vqv9hfeYwH4pJ8IPK1No9F0a0fvnq2JaX4gnQPGBFf9iNIBCADEQ6HK s5tWN2Ph/3A6D0A2nSc6m1Mh/AXhdptka0aPhhVgspCmQ1lJP/Kdf6AnlCi6u1G7 QXvGX8OtbKNosLi91nIqvNwckUOvXrLcAk/epkmidopOuHUZhE+1UaLKs7UssBOe TQTtADdl2786E3qbtaNrjDTvbNesU1DEZjNoBWfKYHZYv2wCF170Lwzp7NJhAueO bTwfUO8EusST6d1NYB0zFxbBi60/hJHCfcAuaSn00jFQ+kj8m7jXCgcyB+1+25d2 gpPbs19S4pi9f7eQflhglm0wB13C6yl+YgwVZQxU/fU70jgSYhkXNPx5bEN3WGkg 4hnP53hrsI4p3se1ABEBAAH+BwMCAppvwSTp9Y/mu317D14a9k6m/zC2LrzPx6dl P3GtDJUCs1CVH/wXsUxLY4hAgS188xPhNLuIWuXwQ7qX7E8kanxgPqeK7NTAPKxH CEqJPevFRBtftHq3zqZZF9CHXulDO3KkWxIHANMclq+zcUotrc4GXIxeYjewXv9p tzKEjlt27Q00VvwRM7JVxBlC3xJvKXf6zyRoUt2/Clq+CFkb2s+dAzCI52o7tlB9 El84sTIlJr0+b6+GcwrKonS8HcGUECfYmSiIiNmxlkJ/4OabDlDYlzvmCYv2pMjc Bif70Dowb8TBD/iTFLPY2lkhqBFi3Bcqc51MVecaQk3rRbVyOqhvGaRE084/LmkN gkE6vQKRSbzRmYwyKC/QUKOW5qbl5Jf3lrjVeM5tEnvJeRCfZEokKjIZul4nX4dK zxH+l+sCUA+RnEeGB2y1yhnPkP4dYHEb8iMLINqXQd18FpBFSs9yv9tFWJhdblUK SiS8DXmuoZI2Mk8yMZ0j0bi8mu9eh52dqYgBGD7TgjP5vpYU/zbtpNgMP0Zvne1X gig6NKK1+3VAZaiOvYUUHZERJGp/eggTtF66cD/0EHJjoZ/0pAciEvWYUyXWVBdj eVWBZE/RVOwrTMBVtrxQsPJ3sfeGlLt21IZYKathTZ/dn5PSlU+i4f9VyC/hHd8S xouQU3nB//ihbrR65YH5E53e8+jPaRtFvLbcqmY8YftV0y/5BZwduZoxcOtxD3A0 J/2GVpUhs3WngCksdUAEbrEXzKKSOC7b4KDw2sTIT5xHra4CBK5L5N85ny8tG7A6 wmTt+6PHo51gx/W/0jiMB3rEiGoTZ86uWLaGv5SgqLP49euCIEXNKK9srFK3o7QE 04upH9zOXR8ytvPOLy/K5zT6YH2eyNs19sWfjAfP/bxhnrDYajsZ2WKZiQEfBBgB CAAJBQJX/YjSAhsMAAoJEBuRPOm2dH3c+6kH+wWoEqTlPdPLZcTN8I5a6HHD0Ul8 7xt3OtiRFoMD2M+zgLvImaj8AULap4w/0G+J+7PCUER8JhcePSzLbizfpTczbDP2 E1LhEM8IBE6GT8yL8VB9AL1xW+hXIi5sWW/f900deOhoh7ikrP7KxT0c8zQjaaqV n6bio93CvZ3yBqMO20apwWDyiSoBpXVjLrW00BdL8i9Rsf6v5UwIIy9o7pfjK5zo mAZM2dKzlp9z4q5P6yE4aXI0bHz+XvG7hdpkHmjG5A+EQCnN2qoDNIA4QiRhH8TQ aTaj4AlCiCAV2hEelPYve5QKccAsfC//qr+FMF+0bhZa05X2afxLYtku0Ms= =ftgB -----END PGP PRIVATE KEY BLOCK----- GnuPG-Interface-1.02/test/fake-gpg-v1000755 000765 000024 00000000044 14034136570 020014 0ustar00jbrandtstaff000000 000000 #!/bin/sh echo 'gpg (GnuPG) 1.4.23' GnuPG-Interface-1.02/test/gpg.conf000644 000765 000024 00000000030 13657001767 017511 0ustar00jbrandtstaff000000 000000 no-secmem-warning armor GnuPG-Interface-1.02/test/public-keys/000755 000765 000024 00000000000 14034140255 020305 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/test/public-keys/1.1.test000644 000765 000024 00000000762 12630404540 021512 0ustar00jbrandtstaff000000 000000 test/pubring.gpg ---------------- pub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) sub 768g/2E854A6B 2000-02-06 [expires: 2002-02-05] pub 1024D/260C4FA3 1999-04-22 Frank J. Tobin uid Dekan uid Frank J. Tobin uid Frank J. Tobin sub 2048g/334C9F14 1999-04-22 [expires: 2001-04-21] GnuPG-Interface-1.02/test/public-keys/1.0.test000644 000765 000024 00000000706 12630404540 021507 0ustar00jbrandtstaff000000 000000 test/pubring.gpg ---------------- pub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) sub 768g/2E854A6B 2000-02-06 pub 1024D/260C4FA3 1999-04-22 Frank J. Tobin uid Dekan uid Frank J. Tobin uid Frank J. Tobin sub 2048g/334C9F14 1999-04-22 GnuPG-Interface-1.02/test/public-keys/2.0.test000644 000765 000024 00000000225 12630404540 021504 0ustar00jbrandtstaff000000 000000 pub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) sub 768g/2E854A6B 2000-02-06 GnuPG-Interface-1.02/test/public-keys/2.1.test000644 000765 000024 00000000253 12630404540 021506 0ustar00jbrandtstaff000000 000000 pub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) sub 768g/2E854A6B 2000-02-06 [expires: 2002-02-05] GnuPG-Interface-1.02/test/public-keys-sigs/1.1.test000644 000765 000024 00000002747 12630404540 022462 0ustar00jbrandtstaff000000 000000 test/pubring.gpg ---------------- pub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin uid Foo Bar (1) sig F950DA9C 2000-03-16 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin sub 768g/2E854A6B 2000-02-06 [expires: 2002-02-05] sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) pub 1024D/260C4FA3 1999-04-22 Frank J. Tobin sig 260C4FA3 1999-04-22 Frank J. Tobin sig F40EB65E 1999-04-22 [User id not found] sig 164BDBAE 1999-11-16 [User id not found] uid Dekan sig 260C4FA3 1999-04-22 Frank J. Tobin sig F40EB65E 1999-04-22 [User id not found] sig 164BDBAE 1999-11-16 [User id not found] uid Frank J. Tobin sig 260C4FA3 1999-06-29 Frank J. Tobin sig 164BDBAE 1999-11-16 [User id not found] uid Frank J. Tobin sig 260C4FA3 1999-07-02 Frank J. Tobin sig 164BDBAE 1999-11-16 [User id not found] sub 2048g/334C9F14 1999-04-22 [expires: 2001-04-21] sig 260C4FA3 1999-04-22 Frank J. Tobin GnuPG-Interface-1.02/test/public-keys-sigs/1.0.test000644 000765 000024 00000002673 12630404540 022457 0ustar00jbrandtstaff000000 000000 test/pubring.gpg ---------------- pub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin uid Foo Bar (1) sig F950DA9C 2000-03-16 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin sub 768g/2E854A6B 2000-02-06 sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) pub 1024D/260C4FA3 1999-04-22 Frank J. Tobin sig 260C4FA3 1999-04-22 Frank J. Tobin sig F40EB65E 1999-04-22 [User id not found] sig 164BDBAE 1999-11-16 [User id not found] uid Dekan sig 260C4FA3 1999-04-22 Frank J. Tobin sig F40EB65E 1999-04-22 [User id not found] sig 164BDBAE 1999-11-16 [User id not found] uid Frank J. Tobin sig 260C4FA3 1999-06-29 Frank J. Tobin sig 164BDBAE 1999-11-16 [User id not found] uid Frank J. Tobin sig 260C4FA3 1999-07-02 Frank J. Tobin sig 164BDBAE 1999-11-16 [User id not found] sub 2048g/334C9F14 1999-04-22 sig 260C4FA3 1999-04-22 Frank J. Tobin GnuPG-Interface-1.02/test/public-keys-sigs/2.0.test000644 000765 000024 00000000776 12630404540 022462 0ustar00jbrandtstaff000000 000000 pub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin uid Foo Bar (1) sig F950DA9C 2000-03-16 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin sub 768g/2E854A6B 2000-02-06 sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) GnuPG-Interface-1.02/test/public-keys-sigs/2.1.test000644 000765 000024 00000001024 12630404540 022446 0ustar00jbrandtstaff000000 000000 pub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin uid Foo Bar (1) sig F950DA9C 2000-03-16 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin sub 768g/2E854A6B 2000-02-06 [expires: 2002-02-05] sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) GnuPG-Interface-1.02/test/secret-keys/1.1.test000644 000765 000024 00000000573 13657001772 021533 0ustar00jbrandtstaff000000 000000 test/gnupghome/pubring.kbx -------------------------- sec dsa1024/F950DA9C 2000-02-06 [SCA] uid [ unknown] GnuPG test key (for testing purposes only) uid [ unknown] Foo Bar (1) ssb elg768/2E854A6B 2000-02-06 [E] sec rsa2048/B6747DDC 2016-10-12 [SC] uid [ unknown] GnuPG::Interface Test key ssb rsa2048/AE441D0F 2016-10-12 [E] GnuPG-Interface-1.02/test/secret-keys/1.0.test000644 000765 000024 00000000533 13657001770 021524 0ustar00jbrandtstaff000000 000000 test/gnupghome/secring.gpg -------------------------- sec 1024D/F950DA9C 2000-02-06 uid GnuPG test key (for testing purposes only) uid Foo Bar (1) ssb 768g/2E854A6B 2000-02-06 sec 2048R/B6747DDC 2016-10-12 uid GnuPG::Interface Test key ssb 2048R/AE441D0F 2016-10-12 GnuPG-Interface-1.02/test/secret-keys/2.0.test000644 000765 000024 00000000225 12630404540 021513 0ustar00jbrandtstaff000000 000000 sec 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) ssb 768g/2E854A6B 2000-02-06 GnuPG-Interface-1.02/test/secret-keys/1.2.test000644 000765 000024 00000000673 13657001772 021535 0ustar00jbrandtstaff000000 000000 test/gnupghome/pubring.kbx -------------------------- sec dsa1024 2000-02-06 [SCA] 93AFC4B1B0288A104996B44253AE596EF950DA9C uid [ unknown] GnuPG test key (for testing purposes only) uid [ unknown] Foo Bar (1) ssb elg768 2000-02-06 [E] sec rsa2048 2016-10-12 [SC] 278F850AA702911F1318F0A61B913CE9B6747DDC uid [ unknown] GnuPG::Interface Test key ssb rsa2048 2016-10-12 [E] GnuPG-Interface-1.02/inc/Module/000755 000765 000024 00000000000 14034140255 017075 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/inc/Module/Install/000755 000765 000024 00000000000 14034140255 020503 5ustar00jbrandtstaff000000 000000 GnuPG-Interface-1.02/inc/Module/Install.pm000644 000765 000024 00000027145 14034140244 021050 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install; # For any maintainers: # The load order for Module::Install is a bit magic. # It goes something like this... # # IF ( host has Module::Install installed, creating author mode ) { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install # 3. The installed version of inc::Module::Install loads # 4. inc::Module::Install calls "require Module::Install" # 5. The ./inc/ version of Module::Install loads # } ELSE { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install # 3. The ./inc/ version of Module::Install loads # } use 5.006; use strict 'vars'; use Cwd (); use File::Find (); use File::Path (); use vars qw{$VERSION $MAIN}; BEGIN { # All Module::Install core packages now require synchronised versions. # This will be used to ensure we don't accidentally load old or # different versions of modules. # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. $VERSION = '1.19'; # Storage for the pseudo-singleton $MAIN = undef; *inc::Module::Install::VERSION = *VERSION; @inc::Module::Install::ISA = __PACKAGE__; } sub import { my $class = shift; my $self = $class->new(@_); my $who = $self->_caller; #------------------------------------------------------------- # all of the following checks should be included in import(), # to allow "eval 'require Module::Install; 1' to test # installation of Module::Install. (RT #51267) #------------------------------------------------------------- # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. # If not set, the caller may NOT have loaded the bundled version, and thus # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; unless ( $INC{$file} ) { die <<"END_DIE" } Please invoke ${\__PACKAGE__} with: use inc::${\__PACKAGE__}; not: use ${\__PACKAGE__}; END_DIE # This reportedly fixes a rare Win32 UTC file time issue, but # as this is a non-cross-platform XS module not in the core, # we shouldn't really depend on it. See RT #24194 for detail. # (Also, this module only supports Perl 5.6 and above). eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006; # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. if ( -f $0 ) { my $s = (stat($0))[9]; # If the modification time is only slightly in the future, # sleep briefly to remove the problem. my $a = $s - time; if ( $a > 0 and $a < 5 ) { sleep 5 } # Too far in the future, throw an error. my $t = time; if ( $s > $t ) { die <<"END_DIE" } Your installer $0 has a modification time in the future ($s > $t). This is known to create infinite loops in make. Please correct this, then run $0 again. END_DIE } # Build.PL was formerly supported, but no longer is due to excessive # difficulty in implementing every single feature twice. if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } Module::Install no longer supports Build.PL. It was impossible to maintain duel backends, and has been deprecated. Please remove all Build.PL files and only use the Makefile.PL installer. END_DIE #------------------------------------------------------------- # To save some more typing in Module::Install installers, every... # use inc::Module::Install # ...also acts as an implicit use strict. $^H |= strict::bits(qw(refs subs vars)); #------------------------------------------------------------- unless ( -f $self->{file} ) { foreach my $key (keys %INC) { delete $INC{$key} if $key =~ /Module\/Install/; } local $^W; require "$self->{path}/$self->{dispatch}.pm"; File::Path::mkpath("$self->{prefix}/$self->{author}"); $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); $self->{admin}->init; @_ = ($class, _self => $self); goto &{"$self->{name}::import"}; } local $^W; *{"${who}::AUTOLOAD"} = $self->autoload; $self->preload; # Unregister loader and worker packages so subdirs can use them again delete $INC{'inc/Module/Install.pm'}; delete $INC{'Module/Install.pm'}; # Save to the singleton $MAIN = $self; return 1; } sub autoload { my $self = shift; my $who = $self->_caller; my $cwd = Cwd::getcwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { my $pwd = Cwd::getcwd(); if ( my $code = $sym->{$pwd} ) { # Delegate back to parent dirs goto &$code unless $cwd eq $pwd; } unless ($$sym =~ s/([^:]+)$//) { # XXX: it looks like we can't retrieve the missing function # via $$sym (usually $main::AUTOLOAD) in this case. # I'm still wondering if we should slurp Makefile.PL to # get some context or not ... my ($package, $file, $line) = caller; die <<"EOT"; Unknown function is found at $file line $line. Execution of $file aborted due to runtime errors. If you're a contributor to a project, you may need to install some Module::Install extensions from CPAN (or other repository). If you're a user of a module, please contact the author. EOT } my $method = $1; if ( uc($method) eq $method ) { # Do nothing return; } elsif ( $method =~ /^_/ and $self->can($method) ) { # Dispatch to the root M:I class return $self->$method(@_); } # Dispatch to the appropriate plugin unshift @_, ( $self, $1 ); goto &{$self->can('call')}; }; } sub preload { my $self = shift; unless ( $self->{extensions} ) { $self->load_extensions( "$self->{prefix}/$self->{path}", $self ); } my @exts = @{$self->{extensions}}; unless ( @exts ) { @exts = $self->{admin}->load_all_extensions; } my %seen; foreach my $obj ( @exts ) { while (my ($method, $glob) = each %{ref($obj) . '::'}) { next unless $obj->can($method); next if $method =~ /^_/; next if $method eq uc($method); $seen{$method}++; } } my $who = $self->_caller; foreach my $name ( sort keys %seen ) { local $^W; *{"${who}::$name"} = sub { ${"${who}::AUTOLOAD"} = "${who}::$name"; goto &{"${who}::AUTOLOAD"}; }; } } sub new { my ($class, %args) = @_; delete $INC{'FindBin.pm'}; { # to suppress the redefine warning local $SIG{__WARN__} = sub {}; require FindBin; } # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; $base_path = VMS::Filespec::unixify($base_path) if $^O eq 'VMS'; $args{dispatch} ||= 'Admin'; $args{prefix} ||= 'inc'; $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); $args{bundle} ||= 'inc/BUNDLES'; $args{base} ||= $base_path; $class =~ s/^\Q$args{prefix}\E:://; $args{name} ||= $class; $args{version} ||= $class->VERSION; unless ( $args{path} ) { $args{path} = $args{name}; $args{path} =~ s!::!/!g; } $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; $args{wrote} = 0; bless( \%args, $class ); } sub call { my ($self, $method) = @_; my $obj = $self->load($method) or return; splice(@_, 0, 2, $obj); goto &{$obj->can($method)}; } sub load { my ($self, $method) = @_; $self->load_extensions( "$self->{prefix}/$self->{path}", $self ) unless $self->{extensions}; foreach my $obj (@{$self->{extensions}}) { return $obj if $obj->can($method); } my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE my $obj = $admin->load($method, 1); push @{$self->{extensions}}, $obj; $obj; } sub load_extensions { my ($self, $path, $top) = @_; my $should_reload = 0; unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { unshift @INC, $self->{prefix}; $should_reload = 1; } foreach my $rv ( $self->find_extensions($path) ) { my ($file, $pkg) = @{$rv}; next if $self->{pathnames}{$pkg}; local $@; my $new = eval { local $^W; require $file; $pkg->can('new') }; unless ( $new ) { warn $@ if $@; next; } $self->{pathnames}{$pkg} = $should_reload ? delete $INC{$file} : $INC{$file}; push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); } $self->{extensions} ||= []; } sub find_extensions { my ($self, $path) = @_; my @found; File::Find::find( {no_chdir => 1, wanted => sub { my $file = $File::Find::name; return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; my $subpath = $1; return if lc($subpath) eq lc($self->{dispatch}); $file = "$self->{path}/$subpath.pm"; my $pkg = "$self->{name}::$subpath"; $pkg =~ s!/!::!g; # If we have a mixed-case package name, assume case has been preserved # correctly. Otherwise, root through the file to locate the case-preserved # version of the package name. if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { my $content = Module::Install::_read($File::Find::name); my $in_pod = 0; foreach ( split /\n/, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text next if /^\s*#/; # and comments if ( m/^\s*package\s+($pkg)\s*;/i ) { $pkg = $1; last; } } } push @found, [ $file, $pkg ]; }}, $path ) if -d $path; @found; } ##################################################################### # Common Utility Functions sub _caller { my $depth = 0; my $call = caller($depth); while ( $call eq __PACKAGE__ ) { $depth++; $call = caller($depth); } return $call; } sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; binmode FH; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } sub _readperl { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s; $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg; return $string; } sub _readpod { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; return $string if $_[0] =~ /\.pod\z/; $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg; $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg; $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg; $string =~ s/^\n+//s; return $string; } sub _write { local *FH; open( FH, '>', $_[0] ) or die "open($_[0]): $!"; binmode FH; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } # _version is for processing module versions (eg, 1.03_05) not # Perl versions (eg, 5.8.1). sub _version { my $s = shift || 0; my $d =()= $s =~ /(\.)/g; if ( $d >= 2 ) { # Normalise multipart versions $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg; } $s =~ s/^(\d+)\.?//; my $l = $1 || 0; my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; $l = $l . '.' . join '', @v if @v; return $l + 0; } sub _cmp { _version($_[1]) <=> _version($_[2]); } # Cloned from Params::Util::_CLASS sub _CLASS { ( defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s ) ? $_[0] : undef; } 1; # Copyright 2008 - 2012 Adam Kennedy. GnuPG-Interface-1.02/inc/Module/Install/Fetch.pm000644 000765 000024 00000004627 14034140245 022102 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install::Fetch; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.19'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub get_file { my ($self, %args) = @_; my ($scheme, $host, $path, $file) = $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) { $args{url} = $args{ftp_url} or (warn("LWP support unavailable!\n"), return); ($scheme, $host, $path, $file) = $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return; } $|++; print "Fetching '$file' from $host... "; unless (eval { require Socket; Socket::inet_aton($host) }) { warn "'$host' resolve failed!\n"; return; } return unless $scheme eq 'ftp' or $scheme eq 'http'; require Cwd; my $dir = Cwd::getcwd(); chdir $args{local_dir} or return if exists $args{local_dir}; if (eval { require LWP::Simple; 1 }) { LWP::Simple::mirror($args{url}, $file); } elsif (eval { require Net::FTP; 1 }) { eval { # use Net::FTP to get past firewall my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600); $ftp->login("anonymous", 'anonymous@example.com'); $ftp->cwd($path); $ftp->binary; $ftp->get($file) or (warn("$!\n"), return); $ftp->quit; } } elsif (my $ftp = $self->can_run('ftp')) { eval { # no Net::FTP, fallback to ftp.exe require FileHandle; my $fh = FileHandle->new; local $SIG{CHLD} = 'IGNORE'; unless ($fh->open("|$ftp -n")) { warn "Couldn't open ftp: $!\n"; chdir $dir; return; } my @dialog = split(/\n/, <<"END_FTP"); open $host user anonymous anonymous\@example.com cd $path binary get $file $file quit END_FTP foreach (@dialog) { $fh->print("$_\n") } $fh->close; } } else { warn "No working 'ftp' program available!\n"; chdir $dir; return; } unless (-f $file) { warn "Fetching failed: $@\n"; chdir $dir; return; } return if exists $args{size} and -s $file != $args{size}; system($args{run}) if exists $args{run}; unlink($file) if $args{remove}; print(((!exists $args{check_for} or -e $args{check_for}) ? "done!" : "failed! ($!)"), "\n"); chdir $dir; return !$?; } 1; GnuPG-Interface-1.02/inc/Module/Install/Metadata.pm000644 000765 000024 00000043302 14034140244 022561 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install::Metadata; use strict 'vars'; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.19'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } my @boolean_keys = qw{ sign }; my @scalar_keys = qw{ name module_name abstract version distribution_type tests installdirs }; my @tuple_keys = qw{ configure_requires build_requires requires recommends bundles resources }; my @resource_keys = qw{ homepage bugtracker repository }; my @array_keys = qw{ keywords author }; *authors = \&author; sub Meta { shift } sub Meta_BooleanKeys { @boolean_keys } sub Meta_ScalarKeys { @scalar_keys } sub Meta_TupleKeys { @tuple_keys } sub Meta_ResourceKeys { @resource_keys } sub Meta_ArrayKeys { @array_keys } foreach my $key ( @boolean_keys ) { *$key = sub { my $self = shift; if ( defined wantarray and not @_ ) { return $self->{values}->{$key}; } $self->{values}->{$key} = ( @_ ? $_[0] : 1 ); return $self; }; } foreach my $key ( @scalar_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} = shift; return $self; }; } foreach my $key ( @array_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} ||= []; push @{$self->{values}->{$key}}, @_; return $self; }; } foreach my $key ( @resource_keys ) { *$key = sub { my $self = shift; unless ( @_ ) { return () unless $self->{values}->{resources}; return map { $_->[1] } grep { $_->[0] eq $key } @{ $self->{values}->{resources} }; } return $self->{values}->{resources}->{$key} unless @_; my $uri = shift or die( "Did not provide a value to $key()" ); $self->resources( $key => $uri ); return 1; }; } foreach my $key ( grep { $_ ne "resources" } @tuple_keys) { *$key = sub { my $self = shift; return $self->{values}->{$key} unless @_; my @added; while ( @_ ) { my $module = shift or last; my $version = shift || 0; push @added, [ $module, $version ]; } push @{ $self->{values}->{$key} }, @added; return map {@$_} @added; }; } # Resource handling my %lc_resource = map { $_ => 1 } qw{ homepage license bugtracker repository }; sub resources { my $self = shift; while ( @_ ) { my $name = shift or last; my $value = shift or next; if ( $name eq lc $name and ! $lc_resource{$name} ) { die("Unsupported reserved lowercase resource '$name'"); } $self->{values}->{resources} ||= []; push @{ $self->{values}->{resources} }, [ $name, $value ]; } $self->{values}->{resources}; } # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. sub test_requires { shift->build_requires(@_) } sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } sub install_as_cpan { $_[0]->installdirs('site') } sub install_as_site { $_[0]->installdirs('site') } sub install_as_vendor { $_[0]->installdirs('vendor') } sub dynamic_config { my $self = shift; my $value = @_ ? shift : 1; if ( $self->{values}->{dynamic_config} ) { # Once dynamic we never change to static, for safety return 0; } $self->{values}->{dynamic_config} = $value ? 1 : 0; return 1; } # Convenience command sub static_config { shift->dynamic_config(0); } sub perl_version { my $self = shift; return $self->{values}->{perl_version} unless @_; my $version = shift or die( "Did not provide a value to perl_version()" ); # Normalize the version $version = $self->_perl_version($version); # We don't support the really old versions unless ( $version >= 5.005 ) { die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; } $self->{values}->{perl_version} = $version; } sub all_from { my ( $self, $file ) = @_; unless ( defined($file) ) { my $name = $self->name or die( "all_from called with no args without setting name() first" ); $file = join('/', 'lib', split(/-/, $name)) . '.pm'; $file =~ s{.*/}{} unless -e $file; unless ( -e $file ) { die("all_from cannot find $file from $name"); } } unless ( -f $file ) { die("The path '$file' does not exist, or is not a file"); } $self->{values}{all_from} = $file; # Some methods pull from POD instead of code. # If there is a matching .pod, use that instead my $pod = $file; $pod =~ s/\.pm$/.pod/i; $pod = $file unless -e $pod; # Pull the different values $self->name_from($file) unless $self->name; $self->version_from($file) unless $self->version; $self->perl_version_from($file) unless $self->perl_version; $self->author_from($pod) unless @{$self->author || []}; $self->license_from($pod) unless $self->license; $self->abstract_from($pod) unless $self->abstract; return 1; } sub provides { my $self = shift; my $provides = ( $self->{values}->{provides} ||= {} ); %$provides = (%$provides, @_) if @_; return $provides; } sub auto_provides { my $self = shift; return $self unless $self->is_admin; unless (-e 'MANIFEST') { warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; return $self; } # Avoid spurious warnings as we are not checking manifest here. local $SIG{__WARN__} = sub {1}; require ExtUtils::Manifest; local *ExtUtils::Manifest::manicheck = sub { return }; require Module::Build; my $build = Module::Build->new( dist_name => $self->name, dist_version => $self->version, license => $self->license, ); $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { my $self = shift; my $name = shift; my $features = ( $self->{values}->{features} ||= [] ); my $mods; if ( @_ == 1 and ref( $_[0] ) ) { # The user used ->feature like ->features by passing in the second # argument as a reference. Accomodate for that. $mods = $_[0]; } else { $mods = \@_; } my $count = 0; push @$features, ( $name => [ map { ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ } @$mods ] ); return @$features; } sub features { my $self = shift; while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { $self->feature( $name, @$mods ); } return $self->{values}->{features} ? @{ $self->{values}->{features} } : (); } sub no_index { my $self = shift; my $type = shift; push @{ $self->{values}->{no_index}->{$type} }, @_ if $type; return $self->{values}->{no_index}; } sub read { my $self = shift; $self->include_deps( 'YAML::Tiny', 0 ); require YAML::Tiny; my $data = YAML::Tiny::LoadFile('META.yml'); # Call methods explicitly in case user has already set some values. while ( my ( $key, $value ) = each %$data ) { next unless $self->can($key); if ( ref $value eq 'HASH' ) { while ( my ( $module, $version ) = each %$value ) { $self->can($key)->($self, $module => $version ); } } else { $self->can($key)->($self, $value); } } return $self; } sub write { my $self = shift; return $self unless $self->is_admin; $self->admin->write_meta; return $self; } sub version_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->version( ExtUtils::MM_Unix->parse_version($file) ); # for version integrity check $self->makemaker_args( VERSION_FROM => $file ); } sub abstract_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->abstract( bless( { DISTNAME => $self->name }, 'ExtUtils::MM_Unix' )->parse_abstract($file) ); } # Add both distribution and module name sub name_from { my ($self, $file) = @_; if ( Module::Install::_read($file) =~ m/ ^ \s* package \s* ([\w:]+) [\s|;]* /ixms ) { my ($name, $module_name) = ($1, $1); $name =~ s{::}{-}g; $self->name($name); unless ( $self->module_name ) { $self->module_name($module_name); } } else { die("Cannot determine name from $file\n"); } } sub _extract_perl_version { if ( $_[0] =~ m/ ^\s* (?:use|require) \s* v? ([\d_\.]+) \s* ; /ixms ) { my $perl_version = $1; $perl_version =~ s{_}{}g; return $perl_version; } else { return; } } sub perl_version_from { my $self = shift; my $perl_version=_extract_perl_version(Module::Install::_read($_[0])); if ($perl_version) { $self->perl_version($perl_version); } else { warn "Cannot determine perl version info from $_[0]\n"; return; } } sub author_from { my $self = shift; my $content = Module::Install::_read($_[0]); if ($content =~ m/ =head \d \s+ (?:authors?)\b \s* ([^\n]*) | =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* ([^\n]*) /ixms) { my $author = $1 || $2; # XXX: ugly but should work anyway... if (eval "require Pod::Escapes; 1") { # Pod::Escapes has a mapping table. # It's in core of perl >= 5.9.3, and should be installed # as one of the Pod::Simple's prereqs, which is a prereq # of Pod::Text 3.x (see also below). $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $Pod::Escapes::Name2character_number{$1} ? chr($Pod::Escapes::Name2character_number{$1}) : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) { # Pod::Text < 3.0 has yet another mapping table, # though the table name of 2.x and 1.x are different. # (1.x is in core of Perl < 5.6, 2.x is in core of # Perl < 5.9.3) my $mapping = ($Pod::Text::VERSION < 2) ? \%Pod::Text::HTML_Escapes : \%Pod::Text::ESCAPES; $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $mapping->{$1} ? $mapping->{$1} : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } else { $author =~ s{E}{<}g; $author =~ s{E}{>}g; } $self->author($author); } else { warn "Cannot determine author info from $_[0]\n"; } } #Stolen from M::B my %license_urls = ( perl => 'http://dev.perl.org/licenses/', apache => 'http://apache.org/licenses/LICENSE-2.0', apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1', artistic => 'http://opensource.org/licenses/artistic-license.php', artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php', lgpl => 'http://opensource.org/licenses/lgpl-license.php', lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php', lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html', bsd => 'http://opensource.org/licenses/bsd-license.php', gpl => 'http://opensource.org/licenses/gpl-license.php', gpl2 => 'http://opensource.org/licenses/gpl-2.0.php', gpl3 => 'http://opensource.org/licenses/gpl-3.0.html', mit => 'http://opensource.org/licenses/mit-license.php', mozilla => 'http://opensource.org/licenses/mozilla1.1.php', open_source => undef, unrestricted => undef, restrictive => undef, unknown => undef, ); sub license { my $self = shift; return $self->{values}->{license} unless @_; my $license = shift or die( 'Did not provide a value to license()' ); $license = __extract_license($license) || lc $license; $self->{values}->{license} = $license; # Automatically fill in license URLs if ( $license_urls{$license} ) { $self->resources( license => $license_urls{$license} ); } return 1; } sub _extract_license { my $pod = shift; my $matched; return __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ L(?i:ICEN[CS]E|ICENSING)\b.*?) (=head \d.*|=cut.*|)\z /xms ) || __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ (?:C(?i:OPYRIGHTS?)|L(?i:EGAL))\b.*?) (=head \d.*|=cut.*|)\z /xms ); } sub __extract_license { my $license_text = shift or return; my @phrases = ( '(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1, '(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1, 'Artistic and GPL' => 'perl', 1, 'GNU general public license' => 'gpl', 1, 'GNU public license' => 'gpl', 1, 'GNU lesser general public license' => 'lgpl', 1, 'GNU lesser public license' => 'lgpl', 1, 'GNU library general public license' => 'lgpl', 1, 'GNU library public license' => 'lgpl', 1, 'GNU Free Documentation license' => 'unrestricted', 1, 'GNU Affero General Public License' => 'open_source', 1, '(?:Free)?BSD license' => 'bsd', 1, 'Artistic license 2\.0' => 'artistic_2', 1, 'Artistic license' => 'artistic', 1, 'Apache (?:Software )?license' => 'apache', 1, 'GPL' => 'gpl', 1, 'LGPL' => 'lgpl', 1, 'BSD' => 'bsd', 1, 'Artistic' => 'artistic', 1, 'MIT' => 'mit', 1, 'Mozilla Public License' => 'mozilla', 1, 'Q Public License' => 'open_source', 1, 'OpenSSL License' => 'unrestricted', 1, 'SSLeay License' => 'unrestricted', 1, 'zlib License' => 'open_source', 1, 'proprietary' => 'proprietary', 0, ); while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { $pattern =~ s#\s+#\\s+#gs; if ( $license_text =~ /\b$pattern\b/i ) { return $license; } } return ''; } sub license_from { my $self = shift; if (my $license=_extract_license(Module::Install::_read($_[0]))) { $self->license($license); } else { warn "Cannot determine license info from $_[0]\n"; return 'unknown'; } } sub _extract_bugtracker { my @links = $_[0] =~ m#L<( https?\Q://rt.cpan.org/\E[^>]+| https?\Q://github.com/\E[\w_]+/[\w_]+/issues| https?\Q://code.google.com/p/\E[\w_\-]+/issues/list )>#gx; my %links; @links{@links}=(); @links=keys %links; return @links; } sub bugtracker_from { my $self = shift; my $content = Module::Install::_read($_[0]); my @links = _extract_bugtracker($content); unless ( @links ) { warn "Cannot determine bugtracker info from $_[0]\n"; return 0; } if ( @links > 1 ) { warn "Found more than one bugtracker link in $_[0]\n"; return 0; } # Set the bugtracker bugtracker( $links[0] ); return 1; } sub requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->requires( $module => $version ); } } sub test_requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->test_requires( $module => $version ); } } # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to # numbers (eg, 5.006001 or 5.008009). # Also, convert double-part versions (eg, 5.8) sub _perl_version { my $v = $_[-1]; $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e; $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e; $v =~ s/(\.\d\d\d)000$/$1/; $v =~ s/_.+$//; if ( ref($v) ) { # Numify $v = $v + 0; } return $v; } sub add_metadata { my $self = shift; my %hash = @_; for my $key (keys %hash) { warn "add_metadata: $key is not prefixed with 'x_'.\n" . "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/; $self->{values}->{$key} = $hash{$key}; } } ###################################################################### # MYMETA Support sub WriteMyMeta { die "WriteMyMeta has been deprecated"; } sub write_mymeta_yaml { my $self = shift; # We need YAML::Tiny to write the MYMETA.yml file unless ( eval { require YAML::Tiny; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.yml\n"; YAML::Tiny::DumpFile('MYMETA.yml', $meta); } sub write_mymeta_json { my $self = shift; # We need JSON to write the MYMETA.json file unless ( eval { require JSON; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.json\n"; Module::Install::_write( 'MYMETA.json', JSON->new->pretty(1)->canonical->encode($meta), ); } sub _write_mymeta_data { my $self = shift; # If there's no existing META.yml there is nothing we can do return undef unless -f 'META.yml'; # We need Parse::CPAN::Meta to load the file unless ( eval { require Parse::CPAN::Meta; 1; } ) { return undef; } # Merge the perl version into the dependencies my $val = $self->Meta->{values}; my $perl = delete $val->{perl_version}; if ( $perl ) { $val->{requires} ||= []; my $requires = $val->{requires}; # Canonize to three-dot version after Perl 5.6 if ( $perl >= 5.006 ) { $perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e } unshift @$requires, [ perl => $perl ]; } # Load the advisory META.yml file my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); my $meta = $yaml[0]; # Overwrite the non-configure dependency hashes delete $meta->{requires}; delete $meta->{build_requires}; delete $meta->{recommends}; if ( exists $val->{requires} ) { $meta->{requires} = { map { @$_ } @{ $val->{requires} } }; } if ( exists $val->{build_requires} ) { $meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } }; } return $meta; } 1; GnuPG-Interface-1.02/inc/Module/Install/Win32.pm000644 000765 000024 00000003403 14034140245 021742 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install::Win32; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.19'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # determine if the user needs nmake, and download it if needed sub check_nmake { my $self = shift; $self->load('can_run'); $self->load('get_file'); require Config; return unless ( $^O eq 'MSWin32' and $Config::Config{make} and $Config::Config{make} =~ /^nmake\b/i and ! $self->can_run('nmake') ); print "The required 'nmake' executable not found, fetching it...\n"; require File::Basename; my $rv = $self->get_file( url => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe', ftp_url => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe', local_dir => File::Basename::dirname($^X), size => 51928, run => 'Nmake15.exe /o > nul', check_for => 'Nmake.exe', remove => 1, ); die <<'END_MESSAGE' unless $rv; ------------------------------------------------------------------------------- Since you are using Microsoft Windows, you will need the 'nmake' utility before installation. It's available at: http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe or ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe Please download the file manually, save it to a directory in %PATH% (e.g. C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to that directory, and run "Nmake15.exe" from there; that will create the 'nmake.exe' file needed by this module. You may then resume the installation process described in README. ------------------------------------------------------------------------------- END_MESSAGE } 1; GnuPG-Interface-1.02/inc/Module/Install/ReadmeFromPod.pm000644 000765 000024 00000010164 14034140244 023525 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install::ReadmeFromPod; use 5.006; use strict; use warnings; use base qw(Module::Install::Base); use vars qw($VERSION); $VERSION = '0.30'; { # these aren't defined until after _require_admin is run, so # define them so prototypes are available during compilation. sub io; sub capture(&;@); #line 28 my $done = 0; sub _require_admin { # do this once to avoid redefinition warnings from IO::All return if $done; require IO::All; IO::All->import( '-binary' ); require Capture::Tiny; Capture::Tiny->import ( 'capture' ); return; } } sub readme_from { my $self = shift; return unless $self->is_admin; _require_admin; # Input file my $in_file = shift || $self->_all_from or die "Can't determine file to make readme_from"; # Get optional arguments my ($clean, $format, $out_file, $options); my $args = shift; if ( ref $args ) { # Arguments are in a hashref if ( ref($args) ne 'HASH' ) { die "Expected a hashref but got a ".ref($args)."\n"; } else { $clean = $args->{'clean'}; $format = $args->{'format'}; $out_file = $args->{'output_file'}; $options = $args->{'options'}; } } else { # Arguments are in a list $clean = $args; $format = shift; $out_file = shift; $options = \@_; } # Default values; $clean ||= 0; $format ||= 'txt'; # Generate README print "readme_from $in_file to $format\n"; if ($format =~ m/te?xt/) { $out_file = $self->_readme_txt($in_file, $out_file, $options); } elsif ($format =~ m/html?/) { $out_file = $self->_readme_htm($in_file, $out_file, $options); } elsif ($format eq 'man') { $out_file = $self->_readme_man($in_file, $out_file, $options); } elsif ($format eq 'md') { $out_file = $self->_readme_md($in_file, $out_file, $options); } elsif ($format eq 'pdf') { $out_file = $self->_readme_pdf($in_file, $out_file, $options); } if ($clean) { $self->clean_files($out_file); } return 1; } sub _readme_txt { my ($self, $in_file, $out_file, $options) = @_; $out_file ||= 'README'; require Pod::Text; my $parser = Pod::Text->new( @$options ); my $io = io->file($out_file)->open(">"); my $out_fh = $io->io_handle; $parser->output_fh( *$out_fh ); $parser->parse_file( $in_file ); return $out_file; } sub _readme_htm { my ($self, $in_file, $out_file, $options) = @_; $out_file ||= 'README.htm'; require Pod::Html; my ($o) = capture { Pod::Html::pod2html( "--infile=$in_file", "--outfile=-", @$options, ); }; io->file($out_file)->print($o); # Remove temporary files if needed for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') { if (-e $file) { unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n"; } } return $out_file; } sub _readme_man { my ($self, $in_file, $out_file, $options) = @_; $out_file ||= 'README.1'; require Pod::Man; my $parser = Pod::Man->new( @$options ); my $io = io->file($out_file)->open(">"); my $out_fh = $io->io_handle; $parser->output_fh( *$out_fh ); $parser->parse_file( $in_file ); return $out_file; } sub _readme_pdf { my ($self, $in_file, $out_file, $options) = @_; $out_file ||= 'README.pdf'; eval { require App::pod2pdf; } or die "Could not generate $out_file because pod2pdf could not be found\n"; my $parser = App::pod2pdf->new( @$options ); $parser->parse_from_file($in_file); my ($o) = capture { $parser->output }; io->file($out_file)->print($o); return $out_file; } sub _readme_md { my ($self, $in_file, $out_file, $options) = @_; $out_file ||= 'README.md'; require Pod::Markdown; my $parser = Pod::Markdown->new( @$options ); my $io = io->file($out_file)->open(">"); my $out_fh = $io->io_handle; $parser->output_fh( *$out_fh ); $parser->parse_file( $in_file ); return $out_file; } sub _all_from { my $self = shift; return unless $self->admin->{extensions}; my ($metadata) = grep { ref($_) eq 'Module::Install::Metadata'; } @{$self->admin->{extensions}}; return unless $metadata; return $metadata->{values}{all_from} || ''; } 'Readme!'; __END__ #line 316 GnuPG-Interface-1.02/inc/Module/Install/WriteAll.pm000644 000765 000024 00000002376 14034140245 022573 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install::WriteAll; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.19'; @ISA = qw{Module::Install::Base}; $ISCORE = 1; } sub WriteAll { my $self = shift; my %args = ( meta => 1, sign => 0, inline => 0, check_nmake => 1, @_, ); $self->sign(1) if $args{sign}; $self->admin->WriteAll(%args) if $self->is_admin; $self->check_nmake if $args{check_nmake}; unless ( $self->makemaker_args->{PL_FILES} ) { # XXX: This still may be a bit over-defensive... unless ($self->makemaker(6.25)) { $self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL'; } } # Until ExtUtils::MakeMaker support MYMETA.yml, make sure # we clean it up properly ourself. $self->realclean_files('MYMETA.yml'); if ( $args{inline} ) { $self->Inline->write; } else { $self->Makefile->write; } # The Makefile write process adds a couple of dependencies, # so write the META.yml files after the Makefile. if ( $args{meta} ) { $self->Meta->write; } # Experimental support for MYMETA if ( $ENV{X_MYMETA} ) { if ( $ENV{X_MYMETA} eq 'JSON' ) { $self->Meta->write_mymeta_json; } else { $self->Meta->write_mymeta_yaml; } } return 1; } 1; GnuPG-Interface-1.02/inc/Module/Install/Can.pm000644 000765 000024 00000006405 14034140245 021546 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install::Can; use strict; use Config (); use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.19'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } # check if we can load some module ### Upgrade this to not have to load the module if possible sub can_use { my ($self, $mod, $ver) = @_; $mod =~ s{::|\\}{/}g; $mod .= '.pm' unless $mod =~ /\.pm$/i; my $pkg = $mod; $pkg =~ s{/}{::}g; $pkg =~ s{\.pm$}{}i; local $@; eval { require $mod; $pkg->VERSION($ver || 0); 1 }; } # Check if we can run some command sub can_run { my ($self, $cmd) = @_; my $_cmd = $cmd; return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd)); for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { next if $dir eq ''; require File::Spec; my $abs = File::Spec->catfile($dir, $cmd); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } # Can our C compiler environment build XS files sub can_xs { my $self = shift; # Ensure we have the CBuilder module $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 ); # Do we have the configure_requires checker? local $@; eval "require ExtUtils::CBuilder;"; if ( $@ ) { # They don't obey configure_requires, so it is # someone old and delicate. Try to avoid hurting # them by falling back to an older simpler test. return $self->can_cc(); } # Do we have a working C compiler my $builder = ExtUtils::CBuilder->new( quiet => 1, ); unless ( $builder->have_compiler ) { # No working C compiler return 0; } # Write a C file representative of what XS becomes require File::Temp; my ( $FH, $tmpfile ) = File::Temp::tempfile( "compilexs-XXXXX", SUFFIX => '.c', ); binmode $FH; print $FH <<'END_C'; #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int main(int argc, char **argv) { return 0; } int boot_sanexs() { return 1; } END_C close $FH; # Can the C compiler access the same headers XS does my @libs = (); my $object = undef; eval { local $^W = 0; $object = $builder->compile( source => $tmpfile, ); @libs = $builder->link( objects => $object, module_name => 'sanexs', ); }; my $result = $@ ? 0 : 1; # Clean up all the build files foreach ( $tmpfile, $object, @libs ) { next unless defined $_; 1 while unlink; } return $result; } # Can we locate a (the) C compiler sub can_cc { my $self = shift; if ($^O eq 'VMS') { require ExtUtils::CBuilder; my $builder = ExtUtils::CBuilder->new( quiet => 1, ); return $builder->have_compiler; } my @chunks = split(/ /, $Config::Config{cc}) or return; # $Config{cc} may contain args; try to find out the program part while (@chunks) { return $self->can_run("@chunks") || (pop(@chunks), next); } return; } # Fix Cygwin bug on maybe_command(); if ( $^O eq 'cygwin' ) { require ExtUtils::MM_Cygwin; require ExtUtils::MM_Win32; if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) { *ExtUtils::MM_Cygwin::maybe_command = sub { my ($self, $file) = @_; if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) { ExtUtils::MM_Win32->maybe_command($file); } else { ExtUtils::MM_Unix->maybe_command($file); } } } } 1; __END__ #line 245 GnuPG-Interface-1.02/inc/Module/Install/Makefile.pm000644 000765 000024 00000027437 14034140244 022571 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install::Makefile; use strict 'vars'; use ExtUtils::MakeMaker (); use Module::Install::Base (); use Fcntl qw/:flock :seek/; use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.19'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } sub Makefile { $_[0] } my %seen = (); sub prompt { shift; # Infinite loop protection my @c = caller(); if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) { die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])"; } # In automated testing or non-interactive session, always use defaults if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) { local $ENV{PERL_MM_USE_DEFAULT} = 1; goto &ExtUtils::MakeMaker::prompt; } else { goto &ExtUtils::MakeMaker::prompt; } } # Store a cleaned up version of the MakeMaker version, # since we need to behave differently in a variety of # ways based on the MM version. my $makemaker = eval $ExtUtils::MakeMaker::VERSION; # If we are passed a param, do a "newer than" comparison. # Otherwise, just return the MakeMaker version. sub makemaker { ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0 } # Ripped from ExtUtils::MakeMaker 6.56, and slightly modified # as we only need to know here whether the attribute is an array # or a hash or something else (which may or may not be appendable). my %makemaker_argtype = ( C => 'ARRAY', CONFIG => 'ARRAY', # CONFIGURE => 'CODE', # ignore DIR => 'ARRAY', DL_FUNCS => 'HASH', DL_VARS => 'ARRAY', EXCLUDE_EXT => 'ARRAY', EXE_FILES => 'ARRAY', FUNCLIST => 'ARRAY', H => 'ARRAY', IMPORTS => 'HASH', INCLUDE_EXT => 'ARRAY', LIBS => 'ARRAY', # ignore '' MAN1PODS => 'HASH', MAN3PODS => 'HASH', META_ADD => 'HASH', META_MERGE => 'HASH', PL_FILES => 'HASH', PM => 'HASH', PMLIBDIRS => 'ARRAY', PMLIBPARENTDIRS => 'ARRAY', PREREQ_PM => 'HASH', CONFIGURE_REQUIRES => 'HASH', SKIP => 'ARRAY', TYPEMAPS => 'ARRAY', XS => 'HASH', # VERSION => ['version',''], # ignore # _KEEP_AFTER_FLUSH => '', clean => 'HASH', depend => 'HASH', dist => 'HASH', dynamic_lib=> 'HASH', linkext => 'HASH', macro => 'HASH', postamble => 'HASH', realclean => 'HASH', test => 'HASH', tool_autosplit => 'HASH', # special cases where you can use makemaker_append CCFLAGS => 'APPENDABLE', DEFINE => 'APPENDABLE', INC => 'APPENDABLE', LDDLFLAGS => 'APPENDABLE', LDFROM => 'APPENDABLE', ); sub makemaker_args { my ($self, %new_args) = @_; my $args = ( $self->{makemaker_args} ||= {} ); foreach my $key (keys %new_args) { if ($makemaker_argtype{$key}) { if ($makemaker_argtype{$key} eq 'ARRAY') { $args->{$key} = [] unless defined $args->{$key}; unless (ref $args->{$key} eq 'ARRAY') { $args->{$key} = [$args->{$key}] } push @{$args->{$key}}, ref $new_args{$key} eq 'ARRAY' ? @{$new_args{$key}} : $new_args{$key}; } elsif ($makemaker_argtype{$key} eq 'HASH') { $args->{$key} = {} unless defined $args->{$key}; foreach my $skey (keys %{ $new_args{$key} }) { $args->{$key}{$skey} = $new_args{$key}{$skey}; } } elsif ($makemaker_argtype{$key} eq 'APPENDABLE') { $self->makemaker_append($key => $new_args{$key}); } } else { if (defined $args->{$key}) { warn qq{MakeMaker attribute "$key" is overriden; use "makemaker_append" to append values\n}; } $args->{$key} = $new_args{$key}; } } return $args; } # For mm args that take multiple space-separated args, # append an argument to the current list. sub makemaker_append { my $self = shift; my $name = shift; my $args = $self->makemaker_args; $args->{$name} = defined $args->{$name} ? join( ' ', $args->{$name}, @_ ) : join( ' ', @_ ); } sub build_subdirs { my $self = shift; my $subdirs = $self->makemaker_args->{DIR} ||= []; for my $subdir (@_) { push @$subdirs, $subdir; } } sub clean_files { my $self = shift; my $clean = $self->makemaker_args->{clean} ||= {}; %$clean = ( %$clean, FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_), ); } sub realclean_files { my $self = shift; my $realclean = $self->makemaker_args->{realclean} ||= {}; %$realclean = ( %$realclean, FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_), ); } sub libs { my $self = shift; my $libs = ref $_[0] ? shift : [ shift ]; $self->makemaker_args( LIBS => $libs ); } sub inc { my $self = shift; $self->makemaker_args( INC => shift ); } sub _wanted_t { } sub tests_recursive { my $self = shift; my $dir = shift || 't'; unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } my %tests = map { $_ => 1 } split / /, ($self->tests || ''); require File::Find; File::Find::find( sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 }, $dir ); $self->tests( join ' ', sort keys %tests ); } sub write { my $self = shift; die "&Makefile->write() takes no arguments\n" if @_; # Check the current Perl version my $perl_version = $self->perl_version; if ( $perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; } # Make sure we have a new enough MakeMaker require ExtUtils::MakeMaker; if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) { # This previous attempted to inherit the version of # ExtUtils::MakeMaker in use by the module author, but this # was found to be untenable as some authors build releases # using future dev versions of EU:MM that nobody else has. # Instead, #toolchain suggests we use 6.59 which is the most # stable version on CPAN at time of writing and is, to quote # ribasushi, "not terminally fucked, > and tested enough". # TODO: We will now need to maintain this over time to push # the version up as new versions are released. $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 ); } else { # Allow legacy-compatibility with 5.005 by depending on the # most recent EU:MM that supported 5.005. $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 ); } # Generate the MakeMaker params my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; $args->{NAME} = $self->module_name || $self->name; $args->{NAME} =~ s/-/::/g; $args->{VERSION} = $self->version or die <<'EOT'; ERROR: Can't determine distribution version. Please specify it explicitly via 'version' in Makefile.PL, or set a valid $VERSION in a module, and provide its file path via 'version_from' (or 'all_from' if you prefer) in Makefile.PL. EOT if ( $self->tests ) { my @tests = split ' ', $self->tests; my %seen; $args->{test} = { TESTS => (join ' ', grep {!$seen{$_}++} @tests), }; } elsif ( $Module::Install::ExtraTests::use_extratests ) { # Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness. # So, just ignore our xt tests here. } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { $args->{test} = { TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ), }; } if ( $] >= 5.005 ) { $args->{ABSTRACT} = $self->abstract; $args->{AUTHOR} = join ', ', @{$self->author || []}; } if ( $self->makemaker(6.10) ) { $args->{NO_META} = 1; #$args->{NO_MYMETA} = 1; } if ( $self->makemaker(6.17) and $self->sign ) { $args->{SIGN} = 1; } unless ( $self->is_admin ) { delete $args->{SIGN}; } if ( $self->makemaker(6.31) and $self->license ) { $args->{LICENSE} = $self->license; } my $prereq = ($args->{PREREQ_PM} ||= {}); %$prereq = ( %$prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->requires) ); # Remove any reference to perl, PREREQ_PM doesn't support it delete $args->{PREREQ_PM}->{perl}; # Merge both kinds of requires into BUILD_REQUIRES my $build_prereq = ($args->{BUILD_REQUIRES} ||= {}); %$build_prereq = ( %$build_prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->configure_requires, $self->build_requires) ); # Remove any reference to perl, BUILD_REQUIRES doesn't support it delete $args->{BUILD_REQUIRES}->{perl}; # Delete bundled dists from prereq_pm, add it to Makefile DIR my $subdirs = ($args->{DIR} || []); if ($self->bundles) { my %processed; foreach my $bundle (@{ $self->bundles }) { my ($mod_name, $dist_dir) = @$bundle; delete $prereq->{$mod_name}; $dist_dir = File::Basename::basename($dist_dir); # dir for building this module if (not exists $processed{$dist_dir}) { if (-d $dist_dir) { # List as sub-directory to be processed by make push @$subdirs, $dist_dir; } # Else do nothing: the module is already present on the system $processed{$dist_dir} = undef; } } } unless ( $self->makemaker('6.55_03') ) { %$prereq = (%$prereq,%$build_prereq); delete $args->{BUILD_REQUIRES}; } if ( my $perl_version = $self->perl_version ) { eval "use $perl_version; 1" or die "ERROR: perl: Version $] is installed, " . "but we need version >= $perl_version"; if ( $self->makemaker(6.48) ) { $args->{MIN_PERL_VERSION} = $perl_version; } } if ($self->installdirs) { warn qq{old INSTALLDIRS (probably set by makemaker_args) is overriden by installdirs\n} if $args->{INSTALLDIRS}; $args->{INSTALLDIRS} = $self->installdirs; } my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_} ) } keys %$args; my $user_preop = delete $args{dist}->{PREOP}; if ( my $preop = $self->admin->preop($user_preop) ) { foreach my $key ( keys %$preop ) { $args{dist}->{$key} = $preop->{$key}; } } my $mm = ExtUtils::MakeMaker::WriteMakefile(%args); $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile'); } sub fix_up_makefile { my $self = shift; my $makefile_name = shift; my $top_class = ref($self->_top) || ''; my $top_version = $self->_top->VERSION || ''; my $preamble = $self->preamble ? "# Preamble by $top_class $top_version\n" . $self->preamble : ''; my $postamble = "# Postamble by $top_class $top_version\n" . ($self->postamble || ''); local *MAKEFILE; open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!"; eval { flock MAKEFILE, LOCK_EX }; my $makefile = do { local $/; }; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; # Module::Install will never be used to build the Core Perl # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m; #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m; # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well. $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g; # XXX - This is currently unused; not sure if it breaks other MM-users # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg; seek MAKEFILE, 0, SEEK_SET; truncate MAKEFILE, 0; print MAKEFILE "$preamble$makefile$postamble" or die $!; close MAKEFILE or die $!; 1; } sub preamble { my ($self, $text) = @_; $self->{preamble} = $text . $self->{preamble} if defined $text; $self->{preamble}; } sub postamble { my ($self, $text) = @_; $self->{postamble} ||= $self->admin->postamble; $self->{postamble} .= $text if defined $text; $self->{postamble} } 1; __END__ #line 544 GnuPG-Interface-1.02/inc/Module/Install/Base.pm000644 000765 000024 00000002147 14034140244 021715 0ustar00jbrandtstaff000000 000000 #line 1 package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { $VERSION = '1.19'; } # Suspend handler for "redefined" warnings BEGIN { my $w = $SIG{__WARN__}; $SIG{__WARN__} = sub { $w }; } #line 42 sub new { my $class = shift; unless ( defined &{"${class}::call"} ) { *{"${class}::call"} = sub { shift->_top->call(@_) }; } unless ( defined &{"${class}::load"} ) { *{"${class}::load"} = sub { shift->_top->load(@_) }; } bless { @_ }, $class; } #line 61 sub AUTOLOAD { local $@; my $func = eval { shift->_top->autoload } or return; goto &$func; } #line 75 sub _top { $_[0]->{_top}; } #line 90 sub admin { $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new; } #line 106 sub is_admin { ! $_[0]->admin->isa('Module::Install::Base::FakeAdmin'); } sub DESTROY {} package Module::Install::Base::FakeAdmin; use vars qw{$VERSION}; BEGIN { $VERSION = $Module::Install::Base::VERSION; } my $fake; sub new { $fake ||= bless(\@_, $_[0]); } sub AUTOLOAD {} sub DESTROY {} # Restore warning handler BEGIN { $SIG{__WARN__} = $SIG{__WARN__}->(); } 1; #line 159