view release on metacpan or search on metacpan
Revision history for GnuPG-Interface
1.06 - 2026-03-26
- Make tests pass for GnuPG 2.5.18
1.05 - 2025-08-12
- Make tests pass for GnuPG 2.4 versions (2.4.0 - 2.4.8)
1.04 - 2023-12-12
- Use the included fake gpg for better test portability
- Update tests for gpg 2.4
1.03 - 2023-09-14
- Add fix for running in taint mode for Perl 5.38.0(thanks to Andrew Ruthven)
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
- 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.
- 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
t/passphrase_handling.t
t/sign.t
t/sign_and_encrypt.t
t/taint_mode.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/gpg1.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
MANIFEST.SKIP view on Meta::CPAN
# 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
Makefile.PL view on Meta::CPAN
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';
handles appropriately, as described in "Bidirectional Communication with
Another Process" in perlipc.
GnuPG Versions
As of this version of GnuPG::Interface, there are three supported
versions of GnuPG: 1.4.x, 2.2.x, and 2.4.x. The GnuPG download page
<https://gnupg.org/download/index.html> 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. 2.0 and 2.1 versions are not
supported, 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.
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
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 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
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>;
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
<BPS@cpan.org>.
SHA256 233a3438cadd21602d821271e4f4d117e131b7d09098543c556689f3a00bb840 t/list_sigs.t
SHA256 998f85987922a9f55895b696808c677b036e199ba6054773cc0318ab55f21150 t/passphrase_handling.t
SHA256 dbba8768ec668f5963cda97b50ebf0bd4759cf53c7d584afe724e05f2e3ecc32 t/sign.t
SHA256 58dd4921945ed7347ba028f52c87fe5ea43487ec3c4765afb73e97686e277a15 t/sign_and_encrypt.t
SHA256 831355318808cb3be7b32afeec1ec8fbd2f6b9a90fb5d5e3c7f33f1c616ef16a t/taint_mode.t
SHA256 845140735d2be4acc0ae4c3459ef06646d26843584d370b18f49fcc17d27ccae t/verify.t
SHA256 f7c37ee27283212cbbbe15046060ae76007c346041a8111528a0a64efe4b4db1 t/version_updates.t
SHA256 4fe916000a3a23c7a06386252ae5731ffb5c08d2f03c07826908529844cc3c27 t/wrap_call.t
SHA256 f66b46159fc5b72ba6ef6cb1808fab5a92ed2f0564ec12ca60bc5a9852d62e6e t/z_delete_keys.t
SHA256 a38c6762ac3bc3fe324a3e2a729259f780cb6d5d1f5fec24a2b362010be475e0 t/zzz_cleanup.t
SHA256 5a829fe0270a33d5157563fe555f395aae1c0fa6ed0aaf68308af50f880fa259 test/encrypted.1.gpg
SHA256 d595ad88a2af6192660ef386fb36ac90d55088e5a9e55294fb54c06d9260fd97 test/encrypted.2.gpg
SHA256 88667f20118c71b9d2051e65d1d44a4a83b5c1ecac4351d3364f401863e582dd test/fake-gpg-v1
SHA256 5e6ff767d39a313bfb4a9fd2fdae747aca4b50830fe79dc2394f693d275b24ca test/fake-gpg-v2
SHA256 90de0e214326e6cc05c49813836ebc9f0b67805b8d8d37bd160dd34c02334b12 test/fake-pinentry.pl
SHA256 cea9f43ca8a6e8bb40b67bbd1348b2d69e4c1b89ebbfeee5cec10ae4220e4ffa test/gpg.conf
SHA256 73e66c46bb07993b2df8b785c90737dc4cd708a3c6ae50a8721d4a20434cd62f test/gpg1.conf
SHA256 d51ec60087f52f6f4e7dfc2cd2eca5b2130c06051fadaf99994eeb14954d80a5 test/key.1.asc
SHA256 b9d3444cdd0a8bee742dccf550d090a8ad36415fc5e96831fd3ec82dc1c574d3 test/new_secret.pgp
SHA256 f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2 test/passphrase
SHA256 369c75d88ce40c4f2440cc3e0b1149990eed0702f1ea7d613489eb48adfa42ea test/plain.1.txt
SHA256 a6e9c6e238daf6212dfc51a42dc5c6809b3100a68d2323b6a598995e81a4a100 test/plain.2.txt
SHA256 fda2ddcbe111a6e41f5a0866e93174d6517941c1ca67c84e62d8a576ee02dada test/public-keys-sigs/1.0.test
SHA256 ac786cf67af312cc69070cbef261616cc6dde6b4a01ea82cbf3258ed6ee5bb6d test/public-keys-sigs/1.1.test
SHA256 ff749cc7df40c450355d411e1e21b525836dd65d3b6f63d2924cbf3cdd5dba15 test/public-keys-sigs/2.0.test
SHA256 db9438e4c0c6cbcb9c6484c1b09ba332609631fe2966ba553821a526c96e0d2d test/public-keys-sigs/2.1.test
SHA256 384b4f167fe72745bb69e1e987fc927bd92677d3d51276198b43b1b6d10873df test/public-keys/1.0.test
lib/GnuPG/Interface.pm view on Meta::CPAN
trigger => 1,
clearer => 'clear_call',
);
# NB: GnuPG versions
#
# There are now three supported versions of GnuPG: legacy 1.4, 2.2, and 2.4.
# 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',
lib/GnuPG/Interface.pm view on Meta::CPAN
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 ) = @_;
lib/GnuPG/Interface.pm view on Meta::CPAN
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";
lib/GnuPG/Interface.pm view on Meta::CPAN
if $use_loopback_pinentry;
my @command = (
$self->call(), @args,
@commands, @command_args
);
# On Unix, PATH is by default '.' and Perl >= v5.38 rejects '.'
# being in the path when in taint mode. Set a path, if running
# in taint mode whomever is calling us should be providing the
# path to the gpg program to use.
local $ENV{PATH} = '/usr/bin' 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();
lib/GnuPG/Interface.pm view on Meta::CPAN
L<perlipc/"Bidirectional Communication with Another Process">.
=head1 GnuPG Versions
As of this version of GnuPG::Interface, there are three supported
versions of GnuPG: 1.4.x, 2.2.x, and 2.4.x. The
L<GnuPG download page|https://gnupg.org/download/index.html> 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<gpg>,
C<gnupg>, C<gnupg2>, etc. packages. 2.0 and 2.1 versions are not
supported, 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
lib/GnuPG/Interface.pm view on Meta::CPAN
=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<gpg>. Each of these methods
takes a hash, which currently must contain a key of B<handles>
which has the value of a GnuPG::Handles object.
Another optional key is B<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 B<export_keys> method. I<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 L<gpg/"COMMANDS"> and L<gpg/"OPTIONS">.
Each of these calls returns the PID for the resulting GnuPG process.
One can use this PID in a C<waitpid> call instead of a C<wait> call
if more precise process reaping is needed.
These methods will attach the handles specified in the B<handles> object
to the running GnuPG object, so that bidirectional communication
can be established. That is, the optionally-defined B<stdin>,
B<stdout>, B<stderr>, B<status>, B<logger>, and
B<passphrase> handles will be attached to
lib/GnuPG/Interface.pm view on Meta::CPAN
If the B<passphrase> data member handle of the B<handles> object
is not defined, but the the B<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 B<passphrase> data member of the GnuPG::Interface nor
the B<passphrase> data member of the B<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.
=back
=head2 Other Methods
=over 4
=item get_public_keys( @search_strings )
lib/GnuPG/Interface.pm view on Meta::CPAN
=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<GnuPG::Handles/passphrase>.
=item options
lib/GnuPG/Interface.pm view on Meta::CPAN
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>;
lib/GnuPG/Interface.pm view on Meta::CPAN
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<GnuPG::Options>,
L<GnuPG::Handles>,
L<GnuPG::PublicKey>,
L<GnuPG::SecretKey>,
L<gpg>,
L<perlipc/"Bidirectional Communication with Another Process">
=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 <BPS@cpan.org>.
lib/GnuPG/Signature.pm view on Meta::CPAN
=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
t/000_setup.t view on Meta::CPAN
use File::Path qw (make_path);
use File::Copy;
TEST
{
my $homedir = $gnupg->options->homedir();
make_path($homedir, { mode => 0700 });
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";
}
}
if ($gnupg->cmp_version($gnupg->version, '2.4') >= 0) {
copy('test/gpg.conf', $homedir . '/gpg.conf');
}
else {
copy('test/gpg1.conf', $homedir . '/gpg.conf');
}
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;
t/Interface.t view on Meta::CPAN
# $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
t/MyTestSpecific.pm view on Meta::CPAN
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;
t/MyTestSpecific.pm view on Meta::CPAN
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' );
t/list_secret_keys.t view on Meta::CPAN
{
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( $_ );
}
}
t/taint_mode.t view on Meta::CPAN
use lib './t';
use MyTest;
use GnuPG::Interface;
my $gnupg;
# See that we instantiate an object in Taint mode
TEST
{
$gnupg = GnuPG::Interface->new( call => './test/fake-gpg-v2' );
};
# See that version is set
TEST
{
defined $gnupg->version;
};
t/version_updates.t view on Meta::CPAN
#!/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');
}
t/zzz_cleanup.t view on Meta::CPAN
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;
};
test/fake-gpg-v1 view on Meta::CPAN
#!/bin/sh
echo 'gpg (GnuPG) 1.4.23'
test/fake-gpg-v2 view on Meta::CPAN
#!/bin/sh
echo 'gpg (GnuPG) 2.2.12'
test/public-keys-sigs/1.0.test view on Meta::CPAN
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 <ftobin@bigfoot.com>
uid Foo Bar (1)
sig F950DA9C 2000-03-16 GnuPG test key (for testing purposes only)
sig 260C4FA3 2000-03-16 Frank J. Tobin <ftobin@bigfoot.com>
sub 768g/2E854A6B 2000-02-06
sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only)
test/public-keys-sigs/1.1.test view on Meta::CPAN
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 <ftobin@bigfoot.com>
uid Foo Bar (1)
sig F950DA9C 2000-03-16 GnuPG test key (for testing purposes only)
sig 260C4FA3 2000-03-16 Frank J. Tobin <ftobin@bigfoot.com>
sub 768g/2E854A6B 2000-02-06 [expires: 2002-02-05]
sig F950DA9C 2000-02-06 GnuPG test key (for testing purposes only)
test/public-keys/1.0.test view on Meta::CPAN
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 <ftobin@bigfoot.com>
uid Dekan
uid Frank J. Tobin <ftobin@uiuc.edu>
uid Frank J. Tobin <ftobin@neverending.org>
sub 2048g/334C9F14 1999-04-22
test/public-keys/1.1.test view on Meta::CPAN
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 <ftobin@bigfoot.com>
uid Dekan
uid Frank J. Tobin <ftobin@uiuc.edu>
uid Frank J. Tobin <ftobin@neverending.org>
sub 2048g/334C9F14 1999-04-22 [expires: 2001-04-21]
test/secret-keys/1.0.test view on Meta::CPAN
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 <test@example.org>
ssb 2048R/AE441D0F 2016-10-12