GnuPG-Interface-1.04/0000755000076500000240000000000014536157236013716 5ustar sunnavystaffGnuPG-Interface-1.04/inc/0000755000076500000240000000000014536157236014467 5ustar sunnavystaffGnuPG-Interface-1.04/inc/Module/0000755000076500000240000000000014536157236015714 5ustar sunnavystaffGnuPG-Interface-1.04/inc/Module/Install/0000755000076500000240000000000014536157236017322 5ustar sunnavystaffGnuPG-Interface-1.04/inc/Module/Install/Fetch.pm0000644000076500000240000000462714536157234020720 0ustar sunnavystaff#line 1 package Module::Install::Fetch; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.21'; @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.04/inc/Module/Install/Metadata.pm0000644000076500000240000004343714536157234021411 0ustar sunnavystaff#line 1 package Module::Install::Metadata; use strict 'vars'; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.21'; @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', artistic => 'http://opensource.org/licenses/artistic-license.php', lgpl => 'http://opensource.org/licenses/lgpl-license.php', 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, # these are not actually allowed in meta-spec v1.4 but are left here for compatibility: apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1', artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php', lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php', lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html', ); 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.04/inc/Module/Install/Win32.pm0000644000076500000240000000340314536157234020560 0ustar sunnavystaff#line 1 package Module::Install::Win32; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.21'; @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.04/inc/Module/Install/ReadmeFromPod.pm0000644000076500000240000001016414536157234022344 0ustar sunnavystaff#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.04/inc/Module/Install/WriteAll.pm0000644000076500000240000000237614536157234021411 0ustar sunnavystaff#line 1 package Module::Install::WriteAll; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.21'; @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.04/inc/Module/Install/Can.pm0000644000076500000240000000640514536157234020364 0ustar sunnavystaff#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.21'; @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.04/inc/Module/Install/Makefile.pm0000644000076500000240000002743714536157234021410 0ustar sunnavystaff#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.21'; @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.04/inc/Module/Install/Base.pm0000644000076500000240000000214714536157234020534 0ustar sunnavystaff#line 1 package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { $VERSION = '1.21'; } # 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 GnuPG-Interface-1.04/inc/Module/Install.pm0000644000076500000240000002714514536157234017667 0ustar sunnavystaff#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.21'; # 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.04/test/0000755000076500000240000000000014536157236014675 5ustar sunnavystaffGnuPG-Interface-1.04/test/fake-pinentry.pl0000755000076500000240000000132314370111525017773 0ustar sunnavystaff#!/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.04/test/fake-gpg-v20000755000076500000240000000004414370111525016612 0ustar sunnavystaff#!/bin/sh echo 'gpg (GnuPG) 2.2.12' GnuPG-Interface-1.04/test/passphrase0000644000076500000240000000000514370111525016747 0ustar sunnavystafftest GnuPG-Interface-1.04/test/public_keys.pgp0000644000076500000240000000653214370111525017707 0ustar sunnavystaff™¢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.04/test/signed.1.asc0000644000076500000240000000064114370111525016761 0ustar sunnavystaff-----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.04/test/plain.2.txt0000644000076500000240000000001514370111525016660 0ustar sunnavystafftest message GnuPG-Interface-1.04/test/secret-keys/0000755000076500000240000000000014536157236017133 5ustar sunnavystaffGnuPG-Interface-1.04/test/secret-keys/1.1.test0000644000076500000240000000057314370111525020323 0ustar sunnavystafftest/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.04/test/secret-keys/1.0.test0000644000076500000240000000053314370111525020316 0ustar sunnavystafftest/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.04/test/secret-keys/2.0.test0000644000076500000240000000022514370111525020315 0ustar sunnavystaffsec 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.04/test/secret-keys/1.2.2.test0000644000076500000240000000067314536151261020472 0ustar sunnavystafftest/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.04/test/secret-keys/1.2.test0000644000076500000240000000067414536151261020333 0ustar sunnavystafftest/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 [ER] sec rsa2048 2016-10-12 [SC] 278F850AA702911F1318F0A61B913CE9B6747DDC uid [ unknown] GnuPG::Interface Test key ssb rsa2048 2016-10-12 [E] GnuPG-Interface-1.04/test/encrypted.2.gpg0000644000076500000240000000102114370111525017506 0ustar sunnavystaff-----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.04/test/public-keys-sigs/0000755000076500000240000000000014536157236020067 5ustar sunnavystaffGnuPG-Interface-1.04/test/public-keys-sigs/1.1.test0000644000076500000240000000274714370111525021264 0ustar sunnavystafftest/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.04/test/public-keys-sigs/1.0.test0000644000076500000240000000267314370111525021261 0ustar sunnavystafftest/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.04/test/public-keys-sigs/2.0.test0000644000076500000240000000077614370111525021264 0ustar sunnavystaffpub 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.04/test/public-keys-sigs/2.1.test0000644000076500000240000000102414370111525021250 0ustar sunnavystaffpub 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.04/test/plain.1.txt0000644000076500000240000000017414370111525016665 0ustar sunnavystaff"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.04/test/encrypted.1.gpg0000644000076500000240000000113414370111525017512 0ustar sunnavystaff-----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.04/test/key.1.asc0000644000076500000240000000314614370111525016303 0ustar sunnavystaff-----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.04/test/secret_keys.pgp0000644000076500000240000000233114370111525017707 0ustar sunnavystaff•Ï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.04/test/new_secret.pgp0000644000076500000240000000700314370111525017526 0ustar sunnavystaff-----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.04/test/fake-gpg-v10000755000076500000240000000004414370111525016611 0ustar sunnavystaff#!/bin/sh echo 'gpg (GnuPG) 1.4.23' GnuPG-Interface-1.04/test/gpg.conf0000644000076500000240000000003014370111525016275 0ustar sunnavystaffno-secmem-warning armor GnuPG-Interface-1.04/test/public-keys/0000755000076500000240000000000014536157236017124 5ustar sunnavystaffGnuPG-Interface-1.04/test/public-keys/1.1.test0000644000076500000240000000076214370111525020314 0ustar sunnavystafftest/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.04/test/public-keys/1.0.test0000644000076500000240000000070614370111525020311 0ustar sunnavystafftest/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.04/test/public-keys/2.0.test0000644000076500000240000000022514370111525020306 0ustar sunnavystaffpub 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.04/test/public-keys/2.1.test0000644000076500000240000000025314370111525020310 0ustar sunnavystaffpub 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.04/SIGNATURE0000644000076500000240000002076114536157236015210 0ustar sunnavystaffThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.88. 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 SHA256 914b1d734a8bfb2e1790216ae61c994ac01a407ade764fbae8bf3eaed6b3f218 Changes SHA256 9a3d14a50a9fbc4795dd9cf6aeeca3c577d6ac6e08250d51cb8afe3d529f97ec MANIFEST SHA256 93d50f37fd222dbe3a8590a019f39d7a79ba725227b53ea6f9dd195830e2fb77 MANIFEST.SKIP SHA256 65cf2e606a9231947d4c6bf732e196d0bfe06e7d65aede96d221089b94a6df8b META.yml SHA256 d66b805878b178c170e04ea8e8c06bff2b83c43463e191fd38472360f60835b0 Makefile.PL SHA256 5617f493744e229ff25cecf195de7861c322eb6b5d6b316bd1ecb91fc354df6b README SHA256 cd5397bbe618f5bbd4e12a33b0cf5d21114e771c2dbd0ce28e2135beb52c35a8 inc/Module/Install.pm SHA256 798836f9ccb8d204b1be31fc3835631f57e9d818b21a8f0d14bfcfb82ff4a72a inc/Module/Install/Base.pm SHA256 d64cd4c16f83c5baf11f64a44bea3a0abc060a49da5aba040f0eb01394bf75ab inc/Module/Install/Can.pm SHA256 65d7a6098bf3f829e8c1c2865476d3537aa6f0ad0ffc9149e10812c856529043 inc/Module/Install/Fetch.pm SHA256 70c4b77acab3ff51dfb318110369607cb109e1c319459249623b787cf3859750 inc/Module/Install/Makefile.pm SHA256 14556386168007ce913e669fc08a332ccdb6140246fd55a90c879b5190c1b57a inc/Module/Install/Metadata.pm SHA256 53825bc78e4c910b888160bc148c8bc211be58e02b99c8edcbf4854f95faa049 inc/Module/Install/ReadmeFromPod.pm SHA256 4c746c02c5cc19bed4c352e76205b4adff4c45ce8310d71294e1b83c059659c2 inc/Module/Install/Win32.pm SHA256 d3d9b4583243c470ae895defa4c44564485b53693cba1c50ab0320768f443e97 inc/Module/Install/WriteAll.pm SHA256 21170a181c773923aa779477d62eed6357f44c9ab27b2abd216f097d78901c9e lib/GnuPG/Fingerprint.pm SHA256 341fe948514a63dc081708c3a5356e0237ef1f333d964d99e9829a9e956f82d9 lib/GnuPG/Handles.pm SHA256 fa9fca26659ef2baba11543b4cbcb141dc6d66191cea9bc07140a8cb3bccec9f lib/GnuPG/HashInit.pm SHA256 32b0f6871e31bb8dded183e887b65c172b329371b0bc7e6b9b943163119c7379 lib/GnuPG/Interface.pm SHA256 f53d8e10107713b8c72d1e0ae13021964344ed205e412fb49621ada6fd32bf3e lib/GnuPG/Key.pm SHA256 729f79dfaf58ba9d7321a8005f90a9dea1614b61556c50120bc323fe753e0022 lib/GnuPG/Options.pm SHA256 de1dbcd19ece6fd939367f1132f08afdede2553e4c20028d08c186d10ec0d9c8 lib/GnuPG/PrimaryKey.pm SHA256 21e7704eb1b290470661c8d256b5391941203ce42df10ef87862307a18f3a5e8 lib/GnuPG/PublicKey.pm SHA256 797d9e9abebb03aa15e8f4de9285216febbc608e41f099002f6160268d087de5 lib/GnuPG/Revoker.pm SHA256 9e899d4cd41d95203dcfca7041c8ae1dc9c01fa828b11ca09529dc4f0503d999 lib/GnuPG/SecretKey.pm SHA256 8238221e3300ea420ebd92eec784a8d4c8e32ca91a104d854dcb72e42cfd2158 lib/GnuPG/Signature.pm SHA256 879000dc23cbce49d8b6ecb179afa45ea3a91ee8c5272dc3c953fd2253d53c31 lib/GnuPG/SubKey.pm SHA256 89c853903cc9220a8e2ae05483b5b295ef0d100fe91066ab955addf720b26249 lib/GnuPG/UserAttribute.pm SHA256 57892e62bf1291be5dbf56f75691022f344ef3850524e1d65051bdd6dc4797c8 lib/GnuPG/UserId.pm SHA256 dae227d6b1c5dfc5fa0e404c747ed3258a221dea7ab773927bd199530c299b38 t/000_setup.t SHA256 2ba7457456a05dc99a4ad7240127c0fa04655c7bcefd41ca40bf8cc89e72fd0c t/Fingerprint.t SHA256 a1f98f817ab9ed6260f1d5d5afcf06c560074d5630348e88a62e866668a96869 t/Interface.t SHA256 13a39c1c8e9ef2335b01c194caa83b48fd15bee9bc35723df2532fac6cbcb204 t/MyTest.pm SHA256 96050358ec301df2c456a4216817bfd6cb359fae4348a717c4a56325de522fcc t/MyTestSpecific.pm SHA256 ecc3d7593ee9580b2a247a8bbe8384e51f4659d21d21878d0e8925d8520d55a1 t/UserId.t SHA256 1c1105851a3a35632b09fa3f09efb0bbfee788fba38f124e732acc7c18cce0c9 t/clearsign.t SHA256 e06f37b7379b8e970aef4f1b1e0e6d7c0b12fcd15a8890db990dc56fa1dbc4e1 t/decrypt.t SHA256 5dadb07fda0101d02e9a7bcd81142d5f3c79ff0746cc2ec3d02db0056adc2e79 t/detach_sign.t SHA256 d2cd3e45ddcafc924573c675d9613203633fc37c1deeba0f4338781b550a9ab9 t/encrypt.t SHA256 2f9d931effb1b8bfdb20c250ae7ad0cdfac1b9546408e2b1c722b8559f7d57f6 t/encrypt_symmetrically.t SHA256 5bad9360f0e5cfe956c7aed6691da13a233eaf869d6b9c89d8717970f450035d t/export_keys.t SHA256 bba1c007605d318c39e86a32920ab86492032b694c8061471374622c74a8d8fb t/get_public_keys.t SHA256 84c267e9f4b07d19a82340924e6d32733026c4774d8f555b876e7ab65b1237a8 t/get_secret_keys.t SHA256 e6551cf8c9b417e97ad7ae0ba17cba696420d0fd82f6dbfed906ba95c990a3ce t/import_keys.t SHA256 3d1a6a667e365bcfe4fe21af2d13dfb0aced9077bf140cfa859b955ba9def388 t/list_public_keys.t SHA256 36b31c3626ce993f8b383758440f8da9d84269e5bb140c5f0a4c88006501b0e9 t/list_secret_keys.t 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 73e66c46bb07993b2df8b785c90737dc4cd708a3c6ae50a8721d4a20434cd62f test/gpg.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 SHA256 11287dcbac0d9c62a2796ce7d5e26bf3f301a5db8e5ff00c8d69a0c627dab376 test/public-keys/1.1.test SHA256 06a81da24c9a2860b411188577068dd285ba469c5023eb1bac6d3cc489e6bf2c test/public-keys/2.0.test SHA256 ba075f34630a38dcc9d368f23ccfe0d6116d9eb05190bdb01337f76dffe96acd test/public-keys/2.1.test SHA256 6b3ef18f32c501a3cfdd94644594055796271ac2634b21cb82c5126c60454de0 test/public_keys.pgp SHA256 f37f6448e73bdb18977c459e949fa30e59e1d6abb3a0533005191112c8dd0e34 test/secret-keys/1.0.test SHA256 53100dae1939540999ee2dea39e46077fdaa905870dea5e426eb5add32290619 test/secret-keys/1.1.test SHA256 8eb233c6c122e84cb3ccd758c1787300e93aeb38b16e986761a03455e2ed1f8c test/secret-keys/1.2.2.test SHA256 6af01a4c0d8dcab51cf0a022ccc60b85300fc8ed8f9aa22de7710526698b0896 test/secret-keys/1.2.test SHA256 83c081e123ec2453b42388865b8948e8bbc5276c739ee6087aad4cdc98f127a5 test/secret-keys/2.0.test SHA256 b84cf371c144ae5bdb201c7a8fa0461562ac7d87395c94406b8611bc855d5bb3 test/secret_keys.pgp SHA256 1fb329b56306f80d4c23398f2f8076b8f7fffa19fcda7193be24c8792807ea80 test/signed.1.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEExJs3Lyv4ShkBFmAnDfCig/6sgLIFAmV43p4ACgkQDfCig/6s gLIQ6wgAvW45WwBI9uA+ZqdJ0IPj+KSXIhh7anJEe8R0vfMEblgaBtFEHujai6CO IzM0RqwMYa+aWdwjwJv1jmjvwStaz+PR0+KGJyfEanTPGDCmcjwugtkTDj+rpXVV Zwr7vuB1izmyF1q4oXIMh75+w8CaFOoIiEV9FyXZBJfh+N0RKJAnlEhjazQhTMYK O3IG4LJ0/OsIjBOPqCW37DnHPD+GLZLM022jwnGHOsbxKGMXC++Gf0x2JkfxfXCr k8t6l1uZfEG5EcezkSaaih9qKhWffQZzOoctbIyEW2CO7qm/HgKZZnO05pNRwLUl c7J7oBZYYwErVFv+qBfNaF24eAv0tA== =5cp+ -----END PGP SIGNATURE----- GnuPG-Interface-1.04/Changes0000644000076500000240000002127614536157201015211 0ustar sunnavystaffRevision history for GnuPG-Interface 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 - 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.04/MANIFEST0000644000076500000240000000327014536157201015041 0ustar sunnavystaffChanges 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/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/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.2.test test/secret-keys/1.2.test test/secret-keys/2.0.test test/secret_keys.pgp test/signed.1.asc GnuPG-Interface-1.04/t/0000755000076500000240000000000014536157236014161 5ustar sunnavystaffGnuPG-Interface-1.04/t/list_public_keys.t0000644000076500000240000000300414370111525017672 0ustar sunnavystaff#!/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.04/t/passphrase_handling.t0000644000076500000240000000213614370111525020350 0ustar sunnavystaff#!/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.04/t/export_keys.t0000644000076500000240000000142214370111525016704 0ustar sunnavystaff#!/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.04/t/taint_mode.t0000644000076500000240000000067514536151261016471 0ustar sunnavystaff#!/usr/bin/perl -wT # # Ensure we can instatiate in Taint mode. Don't need to # do any work, as GnuPG::Interface runs the command we're going # to use to detect the version. use strict; 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; }; GnuPG-Interface-1.04/t/decrypt.t0000644000076500000240000000316614370111525016011 0ustar sunnavystaff#!/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.04/t/list_sigs.t0000644000076500000240000000270514370111525016335 0ustar sunnavystaff#!/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.04/t/zzz_cleanup.t0000644000076500000240000000136614370111525016703 0ustar sunnavystaff#!/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.04/t/get_secret_keys.t0000644000076500000240000001103414536151261017514 0ustar sunnavystaff#!/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 => $gnupg->cmp_version($gnupg->version, '2.3.8') >= 0 ? 'er' : '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.04/t/MyTestSpecific.pm0000644000076500000240000001034214370111525017375 0ustar sunnavystaff# 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.04/t/UserId.t0000644000076500000240000000062614370111525015530 0ustar sunnavystaff#!/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.04/t/version_updates.t0000644000076500000240000000104214370111525017540 0ustar sunnavystaff#!/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.04/t/detach_sign.t0000644000076500000240000000115614370111525016604 0ustar sunnavystaff#!/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.04/t/Interface.t0000644000076500000240000000063214370111525016232 0ustar sunnavystaff#!/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.04/t/wrap_call.t0000644000076500000240000000165614370111525016305 0ustar sunnavystaff#!/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.04/t/000_setup.t0000644000076500000240000000311314370111525016046 0ustar sunnavystaff#!/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.04/t/MyTest.pm0000644000076500000240000000210214370111525015722 0ustar sunnavystaff# 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.04/t/sign_and_encrypt.t0000644000076500000240000000132314370111525017656 0ustar sunnavystaff#!/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.04/t/list_secret_keys.t0000644000076500000240000000447514536151261017723 0ustar sunnavystaff#!/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'; } elsif ( $gnupg->cmp_version( $gnupg->version, '2.1.11' ) <= 0 ) { $keylist = '1'; } elsif ( $gnupg->cmp_version( $gnupg->version, '2.3.8' ) < 0 ) { $keylist = '2.2'; } 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.04/t/z_delete_keys.t0000644000076500000240000000177414370111525017170 0ustar sunnavystaffuse 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.04/t/encrypt.t0000644000076500000240000000310514370111525016014 0ustar sunnavystaff#!/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.04/t/Fingerprint.t0000644000076500000240000000076214370111525016625 0ustar sunnavystaff#!/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.04/t/sign.t0000644000076500000240000000113114370111525015265 0ustar sunnavystaff#!/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.04/t/get_public_keys.t0000644000076500000240000002360014536151261017507 0ustar sunnavystaff#!/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 => $gnupg->cmp_version($gnupg->version, '2.3.8') >= 0 ? 'er' : '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.04/t/encrypt_symmetrically.t0000644000076500000240000000121514370111525020772 0ustar sunnavystaff#!/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.04/t/verify.t0000644000076500000240000000114214370111525015633 0ustar sunnavystaff#!/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.04/t/clearsign.t0000644000076500000240000000114614370111525016302 0ustar sunnavystaff#!/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.04/t/import_keys.t0000644000076500000240000000120614370111525016675 0ustar sunnavystaff#!/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.04/README0000644000076500000240000004620414536157234014602 0ustar sunnavystaffNAME 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 three supported versions of GnuPG: 1.4.x, 2.2.x, and 2.4.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. 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. 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.04/MANIFEST.SKIP0000644000076500000240000000210614370111525015576 0ustar sunnavystaff #!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.04/META.yml0000644000076500000240000000120014536157234015156 0ustar sunnavystaff--- 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.21' 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.04' GnuPG-Interface-1.04/lib/0000755000076500000240000000000014536157236014464 5ustar sunnavystaffGnuPG-Interface-1.04/lib/GnuPG/0000755000076500000240000000000014536157236015444 5ustar sunnavystaffGnuPG-Interface-1.04/lib/GnuPG/Handles.pm0000644000076500000240000001003214370111525017337 0ustar sunnavystaff# 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.04/lib/GnuPG/Options.pm0000644000076500000240000002170114370111525017421 0ustar sunnavystaff# 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.04/lib/GnuPG/SubKey.pm0000644000076500000240000000437314370111525017176 0ustar sunnavystaff# 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.04/lib/GnuPG/Interface.pm0000644000076500000240000012776214536157201017711 0ustar sunnavystaff# 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.04'; 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 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', ); 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 ); # 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(); } 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 three supported versions of GnuPG: 1.4.x, 2.2.x, and 2.4.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. 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 =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.04/lib/GnuPG/HashInit.pm0000644000076500000240000000027514370111525017500 0ustar sunnavystaffpackage 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.04/lib/GnuPG/SecretKey.pm0000644000076500000240000000235014370111525017663 0ustar sunnavystaff# 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.04/lib/GnuPG/Key.pm0000644000076500000240000001442614370111525016524 0ustar sunnavystaff# 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.04/lib/GnuPG/Fingerprint.pm0000644000076500000240000000341514370111525020257 0ustar sunnavystaff# 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.04/lib/GnuPG/UserId.pm0000644000076500000240000000632614370111525017167 0ustar sunnavystaff# 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.04/lib/GnuPG/PrimaryKey.pm0000644000076500000240000000603414370111525020064 0ustar sunnavystaff# 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.04/lib/GnuPG/UserAttribute.pm0000644000076500000240000000517714370111525020601 0ustar sunnavystaff# 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.04/lib/GnuPG/Signature.pm0000644000076500000240000000770014370111525017732 0ustar sunnavystaff# 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.04/lib/GnuPG/PublicKey.pm0000644000076500000240000000235414370111525017660 0ustar sunnavystaff# 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.04/lib/GnuPG/Revoker.pm0000644000076500000240000000750414370111525017410 0ustar sunnavystaff# 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.04/Makefile.PL0000644000076500000240000000135514370111525015657 0ustar sunnavystaffBEGIN{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();