GnuPG-Interface-0.46/0000755000175000017500000000000012042334655013335 5ustar chmrrchmrrGnuPG-Interface-0.46/lib/0000755000175000017500000000000012042334655014103 5ustar chmrrchmrrGnuPG-Interface-0.46/lib/GnuPG/0000755000175000017500000000000012042334655015063 5ustar chmrrchmrrGnuPG-Interface-0.46/lib/GnuPG/Key.pm0000644000175000017500000001422011653666333016160 0ustar chmrrchmrr# 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 Any::Moose; 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 ); foreach $field (@can_be_undef) { return 0 unless (defined $self->$field) == (defined $other->$field); if (defined $self->$field) { 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; } __PACKAGE__->meta->make_immutable; 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). 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-0.46/lib/GnuPG/Handles.pm0000644000175000017500000001006611653656514017012 0ustar chmrrchmrr# 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 Any::Moose; 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); } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/UserId.pm0000644000175000017500000000636111653662645016634 0ustar chmrrchmrr# 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 Any::Moose; 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(); } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/HashInit.pm0000644000175000017500000000030511653656514017136 0ustar chmrrchmrrpackage GnuPG::HashInit; use Any::Moose 'Role'; sub hash_init { my ($self, %args) = @_; while ( my ( $method, $value ) = each %args ) { $self->$method($value); } } 1; __END__ GnuPG-Interface-0.46/lib/GnuPG/SubKey.pm0000644000175000017500000000442611653662645016643 0ustar chmrrchmrr# 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 Any::Moose; use Carp; 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; } } } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/PrimaryKey.pm0000644000175000017500000000603511653662645017533 0ustar chmrrchmrr# 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 Any::Moose; BEGIN { extends qw( GnuPG::Key ) } for my $list (qw(user_ids subkeys user_attributes)) { has $list => ( isa => 'ArrayRef', is => 'rw', default => sub { [] }, auto_deref => 1, ); __PACKAGE__->meta->add_method("push_$list" => sub { my $self = shift; push @{ $self->$list }, @_; }); } has $_ => ( isa => 'Any', is => 'rw', clearer => 'clear_' . $_, ) for qw( local_id owner_trust ); sub compare { my ($self, $other, $deep) = @_; # not comparing local_id because it is meaningless in modern # versions of GnuPG. 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); } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/SecretKey.pm0000644000175000017500000000242311653656514017330 0ustar chmrrchmrr# 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 Any::Moose; BEGIN { extends qw( GnuPG::PrimaryKey ) } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/Revoker.pm0000644000175000017500000000753711653662645017064 0ustar chmrrchmrr# 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 Any::Moose; 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; } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/PublicKey.pm0000644000175000017500000000242711653656566017334 0ustar chmrrchmrr# 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 Any::Moose; BEGIN { extends qw( GnuPG::PrimaryKey ) } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/Signature.pm0000644000175000017500000000773311653662645017406 0ustar chmrrchmrr# 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 Any::Moose; 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; } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/UserAttribute.pm0000644000175000017500000000523211653662645020237 0ustar chmrrchmrr# 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 Any::Moose; 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 }, @_; } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/Fingerprint.pm0000644000175000017500000000346011653662645017725 0ustar chmrrchmrr# 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 Any::Moose; 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(); } __PACKAGE__->meta->make_immutable; 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-0.46/lib/GnuPG/Interface.pm0000644000175000017500000011644412042334640017325 0ustar chmrrchmrr# Jnterface.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 Any::Moose; 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; $VERSION = '0.46'; has $_ => ( isa => 'Any', is => 'rw', clearer => 'clear_' . $_, ) for qw(call passphrase); 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' ); $self->hash_init(%$args); } struct( fh_setup => { parent_end => '$', child_end => '$', direct => '$', is_std => '$', parent_is_source => '$', name_shows_dup => '$', } ); ################################################################# # 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(); # so call me sexist; English just doen't cope well my $needs_passphrase_handled_for_him = ( $self->passphrase() and not $handles->passphrase() ) ? 1 : 0; if ($needs_passphrase_handled_for_him) { $handles->passphrase( IO::Handle->new() ); } my $pid = $self->fork_attach_exec(%args); if ($needs_passphrase_handled_for_him) { 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'; # 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 @command = ( $self->call(), $self->options->get_args(), @commands, @command_args ); 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' ) { 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 ) = @_; return $self->wrap_call( %args, commands => ['--symmetric'] ); } 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 ); $self->wrap_call( commands => [ '--version' ], handles => $handles ); my $line = $out->getline; $line =~ /(\d+\.\d+\.\d+)/; return $1; } 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/) { 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; # settting 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 Any::Moose 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 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 convience. 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. =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', '0xABCD1234' ], meta_interactive => 0 , ); =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 # convience 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', '0xABCD1234' ); # 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', '0xABCD1234' ]; 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 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. I don't know yet how well this modules handles parsing OpenPGP v3 keys. =head1 SEE ALSO L, L, L, L, L, L =head1 AUTHOR GnuPg::Interface is currently maintained by Jesse Vincent . Frank J. Tobin, ftobin@cpan.org was the original author of the package. =cut __PACKAGE__->meta->make_immutable; 1; GnuPG-Interface-0.46/lib/GnuPG/Options.pm0000644000175000017500000002043211653662645017067 0ustar chmrrchmrr# 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 Any::Moose; 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 ); 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 ); 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) { has $list => ( isa => 'ArrayRef', is => 'rw', lazy => 1, clearer => "clear_$list", default => sub { [] }, auto_deref => 1, ); __PACKAGE__->meta->add_method("push_$list" => sub { my $self = shift; push @{ $self->$list }, @_; }); } sub BUILD { my ( $self, $args ) = @_; $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, '--always-trust' 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(); 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; } __PACKAGE__->meta->make_immutable; 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', '0xABCD1234' ); =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-0.46/ChangeLog0000644000175000017500000005064712042277606015125 0ustar chmrrchmrr0.46 Thu Oct 25 14:04:17 EDT 2012 Add a ->search_keys method Add a ->version method Remove dead code for finding gnupg2 binary 0.45 Wed Oct 26 00:11:17 EDT 2011 Include trailing columns when parsing --fixed-list-mode output 0.44 Mon May 2 21:36:13 EDT 2011 Bump Math::BigInt dependency to get the new 'try GMP' syntax. 0.43 Tue Mar 8 09:13:31 EST 2011 Stable release 0.42_02 Additional cleanups from dkg 0.42_01 Mon May 10 10:50:49 EDT 2010 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 - jesse Fix POD errors - alexmv 0.42 Wed Sep 30 23:20:58 JST 2009 * Support for GPG2 0.41_01 Fri Sep 25 02:56:33 JST 2009 * Beginnings of support for GPG2 0.40_04 Tue Apr 21 19:50:12 JST 2009 * Use Any::Moose instead of Moose for Mouse celerity (Sartak) 0.40_1 Sat Nov 15 12:35:59 EST 2008 * [rt.cpan.org #40963] Replace Class::MethodMaker with Moose (Chris Prather) 0.36 Mon Aug 13 12:16:38 EDT 2007 * [rt.cpan.org #28814] - Performance improvement from mehradek (Radoslaw Zielinski) -use English; +use English qw( -no_match_vars ); 0.35 Fri Apr 20 12:33:53 EDT 2007 - Jesse Vincent * 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/) 2002-09-26 15:47 ftobin * THANKS: add Walter Stanish for a docfix 2002-09-26 11:51 ftobin * NEWS, lib/GnuPG/Interface.pm: documentation fixes, bump version 2002-06-17 14:06 ftobin * Makefile.PL: put test in to see if GnuPG is on the system 2002-06-14 12:18 ftobin * .cvsignore, test/public-keys/.cvsignore, test/public-keys-sigs/.cvsignore, test/secret-keys/.cvsignore, test/.cvsignore: I like .cvsignore files 2002-06-14 12:10 ftobin * NEWS, lib/GnuPG/Interface.pm: add NEWS, bump version 2002-06-14 12:08 ftobin * THANKS, lib/GnuPG/Interface.pm: fix debian bug #149966, thanks to Peter Palfrader Seems import-keys doesn't need '-' passed anymore. 2002-06-11 12:01 ftobin * NEWS, lib/GnuPG/Interface.pm: add news about latest version, bump version 2002-02-06 00:08 ftobin * NEWS, test/pubring.gpg, test/secring.gpg: extended the expiration date on the test keys 4 years so that the test suite works 2001-12-09 20:29 ftobin * lib/GnuPG/Key.pm: minor code layout change 2001-12-08 21:24 ftobin * lib/GnuPG/Handles.pm: small doc example fix 2001-12-08 21:13 ftobin * lib/GnuPG/Interface.pm: doc example typo fix 2001-09-14 08:34 ftobin * lib/GnuPG/PrimaryKey.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/SubKey.pm, t/GnuPG/ComparableFingerprint.pm, t/GnuPG/ComparableKey.pm, t/GnuPG/ComparablePrimaryKey.pm, t/GnuPG/ComparablePublicKey.pm, t/GnuPG/ComparableSecretKey.pm, t/GnuPG/ComparableSignature.pm, t/GnuPG/ComparableSubKey.pm, t/GnuPG/ComparableUserId.pm: use "use base" instead of ISA junk 2001-08-22 08:53 ftobin * lib/GnuPG/Interface.pm: change some 'dies' to 'croak' 2001-08-21 09:31 ftobin * README, THANKS, lib/GnuPG/Fingerprint.pm, lib/GnuPG/Handles.pm, lib/GnuPG/Interface.pm, lib/GnuPG/Key.pm, lib/GnuPG/Options.pm, lib/GnuPG/PrimaryKey.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/Signature.pm, lib/GnuPG/SubKey.pm, lib/GnuPG/UserId.pm, t/MyTest.pm, t/MyTestSpecific.pm, t/GnuPG/ComparableFingerprint.pm, t/GnuPG/ComparableKey.pm, t/GnuPG/ComparablePrimaryKey.pm, t/GnuPG/ComparablePublicKey.pm, t/GnuPG/ComparableSecretKey.pm, t/GnuPG/ComparableSignature.pm, t/GnuPG/ComparableSubKey.pm, t/GnuPG/ComparableUserId.pm: change my mail addr to ftobin@cpan.org 2001-05-07 06:27 ftobin * NEWS, README, lib/GnuPG/Interface.pm: documentation fixes, GnupG -> GnuPG 2001-05-03 03:40 ftobin * lib/GnuPG/Interface.pm: put in example of how to use wrap_call() 2001-05-03 03:37 ftobin * README: add footer stuff to readme 2001-05-03 03:32 ftobin * MANIFEST, NEWS, lib/GnuPG/Interface.pm, t/wrap_call.t: bump version, add news, fix test 2001-05-03 02:02 ftobin * t/passphrase_handling.t: remove spuriuos backtick 2001-05-03 02:00 ftobin * lib/GnuPG/Interface.pm, t/clearsign.t, t/decrypt.t, t/detach_sign.t, t/encrypt.t, t/encrypt_symmetrically.t, t/export_keys.t, t/get_public_keys.t, t/get_secret_keys.t, t/import_keys.t, t/list_public_keys.t, t/list_secret_keys.t, t/list_sigs.t, t/passphrase_handling.t, t/sign.t, t/sign_and_encrypt.t, t/verify.t: use waitpid instead of wait for everything, and remove some deprecated uses of gnupg_command_args in test cases 2001-04-30 22:38 ftobin * MANIFEST: add ComparablePrimaryKey 2001-04-30 22:36 ftobin * t/GnuPG/ComparablePrimaryKey.pm: forgot to add this before 2001-04-30 22:34 ftobin * NEWS, lib/GnuPG/Interface.pm: bump version 2001-04-30 22:31 ftobin * lib/GnuPG/PrimaryKey.pm: add SYNOPSIS to pod 2001-04-30 22:27 ftobin * MANIFEST: add t/Interface.t 2001-04-30 01:03 ftobin * lib/GnuPG/PrimaryKey.pm: forgot to add this file 2001-04-29 22:04 ftobin * t/Interface.t: has deprecation tests 2001-04-29 22:04 ftobin * NEWS, lib/GnuPG/Interface.pm: deprecate a bunch of gnupg_x in favor of just x 2001-04-29 21:36 ftobin * MANIFEST, lib/GnuPG/Fingerprint.pm, lib/GnuPG/Interface.pm, lib/GnuPG/UserId.pm, t/Fingerprint.t, t/UserId.t, t/get_public_keys.t: deprecate some fields 2001-04-29 20:09 ftobin * lib/GnuPG/Fingerprint.pm, lib/GnuPG/Interface.pm, lib/GnuPG/Key.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/SubKey.pm, t/get_public_keys.t, t/get_secret_keys.t, t/GnuPG/ComparableFingerprint.pm, t/GnuPG/ComparableKey.pm, t/GnuPG/ComparablePublicKey.pm, t/GnuPG/ComparableSecretKey.pm, t/GnuPG/ComparableSignature.pm, t/GnuPG/ComparableSubKey.pm: GnuPG::SubKey's signature, and GnuPG::Key's fingerprint are not auto-created anymore. I just don't like doing it. Introduced GnuPG::PrimaryKey, the super-class for GnuPG::PublicKey and GnuPG::SecretKey GnuPG::Fingerprint's primary data member is now named as_hex_string 2001-04-28 00:51 ftobin * Makefile.PL: update C::MM requirements 2001-04-28 00:49 ftobin * MANIFEST, NEWS, README: don't ship with C::MM 2001-04-28 00:45 ftobin * MANIFEST, Makefile.PL, NEWS, THANKS, lib/GnuPG/Interface.pm: fix SF Bug Id #229315 2001-04-28 00:02 ftobin * NEWS: update news concerning latest commits 2001-04-28 00:01 ftobin * lib/GnuPG/Fingerprint.pm, lib/GnuPG/Key.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/Signature.pm, lib/GnuPG/SubKey.pm, lib/GnuPG/UserId.pm, t/get_public_keys.t, t/get_secret_keys.t, t/list_public_keys.t, t/list_secret_keys.t, t/list_sigs.t, t/GnuPG/ComparableFingerprint.pm, t/GnuPG/ComparableKey.pm, t/GnuPG/ComparablePublicKey.pm, t/GnuPG/ComparableSecretKey.pm, t/GnuPG/ComparableSignature.pm, t/GnuPG/ComparableSubKey.pm, t/GnuPG/ComparableUserId.pm: rework testing structure so that comparable stuff is in inherited classes used specifically for testing also, testing is less strict on many objects, since GnuPG is becoming wild and unpredicable :) 2001-04-27 20:58 ftobin * lib/GnuPG/Interface.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/SubKey.pm, t/MyTestSpecific.pm, t/export_keys.t, t/get_public_keys.t, t/get_secret_keys.t, t/list_public_keys.t, t/list_secret_keys.t, t/list_sigs.t: don't close stdout early; I think it's triggering a buffering issue 2001-01-25 20:52 ftobin * lib/GnuPG/: Interface.pm, Options.pm: doc updates 2001-01-02 01:09 ftobin * lib/GnuPG/Interface.pm: fix up docs for GnuPG::Interface::wrap_call() and in general all around for Interface.pm POD 2000-11-21 13:03 ftobin * NEWS, lib/GnuPG/Fingerprint.pm, lib/GnuPG/Handles.pm, lib/GnuPG/Interface.pm, lib/GnuPG/Key.pm, lib/GnuPG/Options.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/Signature.pm, lib/GnuPG/SubKey.pm, lib/GnuPG/UserId.pm, t/MyTest.pm, t/MyTestSpecific.pm: new licensing 2000-11-21 12:56 ftobin * COPYING: new licensing 2000-08-05 15:22 ftobin * THANKS: thanks for AutoLoader fix 2000-08-05 15:12 ftobin * MANIFEST: for sanity, trustdb.gpg is no longer shipped 2000-08-04 00:42 ftobin * NEWS, lib/GnuPG/Interface.pm: wrote up news for 0.11, and ready for 0.11 2000-07-31 15:50 ftobin * lib/GnuPG/Interface.pm: finally, the proper AutoLoader fix 2000-07-27 12:26 ftobin * lib/GnuPG/Options.pm: cosmetic typo 2000-07-23 02:05 ftobin * lib/GnuPG/Options.pm: doc fixes 2000-07-22 21:46 ftobin * t/MyTestSpecific.pm, test/trustdb.gpg: instead of having trustdb in the CVS repository, which keeps getting altered anyways, let's use GnuPG's --always-trust option. 2000-07-22 21:43 ftobin * lib/GnuPG/Options.pm: removed GnuPG::Options->no_comment() because it doesn't do what you think it does, and comment(), if defined but blank should allow GnuPG to use no comment. 2000-07-22 21:39 ftobin * lib/GnuPG/Interface.pm, test/trustdb.gpg: require all those extra modules at runtime in the get_keys() method 2000-07-13 02:51 ftobin * README: oops, README had wrong version of C::MM in it 2000-07-13 02:36 ftobin * MANIFEST, NEWS, lib/GnuPG/Interface.pm, test/trustdb.gpg: getting ready for 0.10 2000-07-12 18:29 ftobin * lib/GnuPG/Key.pm, t/export_keys.t, test/trustdb.gpg: Okay, I've finally removed the epixration-field comparison test for GnuPG::Keys cause Werner has released 1.0.2 without addressing my complaints :( 2000-07-12 04:29 ftobin * lib/GnuPG/Interface.pm: added a FAQ item about filehandles 'stopping' (buffers and such) 2000-07-12 04:21 ftobin * lib/GnuPG/Handles.pm, lib/GnuPG/Interface.pm, t/clearsign.t, t/decrypt.t, t/detach_sign.t, t/encrypt.t, t/encrypt_symmetrically.t, t/export_keys.t, t/import_keys.t, t/list_public_keys.t, t/list_secret_keys.t, t/list_sigs.t, t/passphrase_handling.t, t/sign.t, t/sign_and_encrypt.t, t/verify.t, test/trustdb.gpg: let's call this new GnuPG::Handles option 'direct' instead of 'dup'. 'dup' is unintuitive, inunderstandable by users who don't care what is actually happening, and more 'generic' (read portable, time-standing) 2000-07-12 04:10 ftobin * lib/GnuPG/Interface.pm, test/trustdb.gpg: whoops, I really do need to explictly dup, as well as compensate when it's an already-opened filehandle. Maybe I'll change the name to direct instead of dup. 2000-07-12 04:01 ftobin * lib/GnuPG/Interface.pm: We really do need to dup the filehandles, not just use the originals because sometimes the user will pass ">&STDOUT" :) 2000-07-12 03:43 ftobin * NEWS, lib/GnuPG/Fingerprint.pm, lib/GnuPG/Handles.pm, lib/GnuPG/Interface.pm, lib/GnuPG/Key.pm, lib/GnuPG/Options.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/SubKey.pm, lib/GnuPG/UserId.pm, test/trustdb.gpg: small doc changes, NEWS updates to reflect recent important commits, and small Interface changes 2000-07-11 22:56 ftobin * lib/GnuPG/Handles.pm, lib/GnuPG/Interface.pm, lib/GnuPG/Options.pm, t/MyTestSpecific.pm, t/clearsign.t, t/decrypt.t, t/detach_sign.t, t/encrypt.t, t/encrypt_symmetrically.t, t/export_keys.t, t/get_public_keys.t, t/get_secret_keys.t, t/import_keys.t, t/list_public_keys.t, t/list_secret_keys.t, t/list_sigs.t, t/passphrase_handling.t, t/sign.t, t/sign_and_encrypt.t, t/verify.t, test/key.1.asc, test/options, test/passphrase, test/trustdb.gpg: Lots of stuff on this commit. We now have better, 'option'-oriented fh dupping support, instead of that crappy auto-magic stuff looking for >& and the like at the beginning of fhs. Most of the test files include a test with dupping from/to a file, and a new command GnuPG::Handles data member has been introduced, which links into the command-fd option of GnuPG. 2000-06-28 15:36 ftobin * lib/GnuPG/Interface.pm: put in documentation about the returned PID from 'normal' GnuPG calls 2000-06-28 15:00 ftobin * lib/GnuPG/Interface.pm: formatting changes in pod code 2000-06-25 20:21 ftobin * NEWS, lib/GnuPG/Interface.pm: Now allow fh's like >&=$fh, which are really fd's Also, ready for 0.09 2000-06-25 06:10 ftobin * NEWS, lib/GnuPG/Interface.pm: documented how one can use file descriptor numbers to use as dups 2000-06-25 05:16 ftobin * lib/GnuPG/Interface.pm: /tmp/cvsk16160 2000-06-20 18:22 ftobin * MANIFEST: forgot some files 2000-06-20 18:17 ftobin * NEWS, lib/GnuPG/Interface.pm: ready for 0.08 2000-06-18 22:10 ftobin * README: 'make' should be a separate step from 'make test', as it seems manifying doesn't happen during 'make test'. 2000-06-18 21:25 ftobin * NEWS, lib/GnuPG/Interface.pm: use AutoLoading now. 2000-06-18 21:17 ftobin * Makefile.PL: more fun simple changes 2000-06-18 20:26 ftobin * Makefile.PL: clarification 2000-06-18 20:22 ftobin * Makefile.PL: Need C::MM 0.96 2000-06-18 05:57 ftobin * MANIFEST: typo 2000-06-18 03:53 ftobin * t/get_secret_keys.t: oops, typo 2000-06-18 03:47 ftobin * MANIFEST, t/get_public_keys.t, t/get_secret_keys.t: MANIFEST changed to reflect new 'test' directory little better information on GnuPG creating errors in the test scripts due to GnuPG versions 2000-06-18 03:35 ftobin * test/: public-keys-sigs.1.txt, public-keys-sigs.2.txt, public-keys.1.txt, public-keys.2.txt, secret-keys.1.txt, secret-keys.2.txt, trustdb.gpg, public-keys/1.0.test, public-keys/1.1.test, public-keys/2.0.test, public-keys/2.1.test, public-keys-sigs/1.0.test, public-keys-sigs/1.1.test, public-keys-sigs/2.0.test, public-keys-sigs/2.1.test, secret-keys/1.0.test, secret-keys/2.0.test: file tree rearrangement 2000-06-18 03:33 ftobin * NEWS, lib/GnuPG/Key.pm, t/get_public_keys.t, t/get_secret_keys.t, t/list_public_keys.t, t/list_secret_keys.t, t/list_sigs.t: Updates so that tests work better with GnuPG 1.0.1e, or are knowledgeable about errors with it. rearrangement of 'test' directory 2000-06-11 05:36 ftobin * Makefile.PL: bumped up C::MM requirements to 0.95 because of how new methods changing. 2000-06-10 22:07 ftobin * lib/GnuPG/Options.pm: typo in pod 2000-05-24 21:22 ftobin * t/MyTestSpecific.pm: More about GnuPG::Options meta methods changing 2000-05-24 21:21 ftobin * NEWS, lib/GnuPG/Interface.pm: Version 0.07 trying to be ready. * 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. 2000-05-24 21:20 ftobin * lib/GnuPG/Options.pm: * 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. 2000-05-17 16:43 ftobin * NEWS: bumped up version to 0.06 since I missed changing the version in Interface.pm the last time 2000-05-17 16:30 ftobin * NEWS, lib/GnuPG/Options.pm: GnuPG::Options now makes use of C::MM's booleans, and textmode option added 2000-05-11 05:08 ftobin * lib/GnuPG/Interface.pm: waitpid() are now implemented in various functions that totally encapsulate the call to GnuPG. 2000-05-11 05:07 ftobin * t/passphrase_handling.t: The passphrase was never really passed down through the pipe before; the error was gotten from the previous call to GnuPG. 2000-04-25 18:02 ftobin * NEWS: put in 0.04 NEWS 2000-04-25 17:58 ftobin * lib/GnuPG/Interface.pm: ready for 0.04 0.04 is a repackaging release of 0.03 2000-04-25 17:41 ftobin * NEWS, lib/GnuPG/Interface.pm: ready for 0.03 2000-04-25 17:01 ftobin * MANIFEST: added NEWS to MANIFEST 2000-04-25 16:40 ftobin * MANIFEST: added ChangeLog to the MANIFEST 2000-04-25 16:29 ftobin * NEWS, lib/GnuPG/Interface.pm: ready for 2.8.0 2000-04-25 16:23 ftobin * lib/GnuPG/Options.pm: fixed bug with meta-pgp-5-compatibility which was using underscores in the option passed to GnuPG instead of dashes 2000-04-20 22:13 ftobin * lib/GnuPG/Interface.pm: removed debugging filehandle stuff from Interface.pm This caused problems when the user does funky stuff like close the STDOUT or does stuff with STDERR 2000-04-20 10:30 ftobin * lib/GnuPG/: Fingerprint.pm, Handles.pm, Interface.pm, Key.pm, Options.pm, PublicKey.pm, SecretKey.pm, SubKey.pm, UserId.pm: POD cleanups, mainly providing L<>'s in the SEE ALSO sections. 2000-04-19 17:06 ftobin * COPYING, MANIFEST, Makefile.PL, README, THANKS, lib/GnuPG/Fingerprint.pm, lib/GnuPG/Handles.pm, lib/GnuPG/Interface.pm, lib/GnuPG/Key.pm, lib/GnuPG/Options.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/Signature.pm, lib/GnuPG/SubKey.pm, lib/GnuPG/UserId.pm, t/MyTest.pm, t/MyTestSpecific.pm, t/clearsign.t, t/decrypt.t, t/detach_sign.t, t/encrypt.t, t/encrypt_symmetrically.t, t/export_keys.t, t/get_public_keys.t, t/get_secret_keys.t, t/import_keys.t, t/list_public_keys.t, t/list_secret_keys.t, t/list_sigs.t, t/passphrase_handling.t, t/sign.t, t/sign_and_encrypt.t, t/verify.t, test/encrypted.1.gpg, test/key.1.asc, test/options, test/plain.1.txt, test/public-keys-sigs.1.txt, test/public-keys-sigs.2.txt, test/public-keys.1.txt, test/public-keys.2.txt, test/pubring.gpg, test/secret-keys.1.txt, test/secret-keys.2.txt, test/secring.gpg, test/signed.1.asc, test/trustdb.gpg: Initial revision 2000-04-19 17:06 ftobin * COPYING, MANIFEST, Makefile.PL, README, THANKS, lib/GnuPG/Fingerprint.pm, lib/GnuPG/Handles.pm, lib/GnuPG/Interface.pm, lib/GnuPG/Key.pm, lib/GnuPG/Options.pm, lib/GnuPG/PublicKey.pm, lib/GnuPG/SecretKey.pm, lib/GnuPG/Signature.pm, lib/GnuPG/SubKey.pm, lib/GnuPG/UserId.pm, t/MyTest.pm, t/MyTestSpecific.pm, t/clearsign.t, t/decrypt.t, t/detach_sign.t, t/encrypt.t, t/encrypt_symmetrically.t, t/export_keys.t, t/get_public_keys.t, t/get_secret_keys.t, t/import_keys.t, t/list_public_keys.t, t/list_secret_keys.t, t/list_sigs.t, t/passphrase_handling.t, t/sign.t, t/sign_and_encrypt.t, t/verify.t, test/encrypted.1.gpg, test/key.1.asc, test/options, test/plain.1.txt, test/public-keys-sigs.1.txt, test/public-keys-sigs.2.txt, test/public-keys.1.txt, test/public-keys.2.txt, test/pubring.gpg, test/secret-keys.1.txt, test/secret-keys.2.txt, test/secring.gpg, test/signed.1.asc, test/trustdb.gpg: initial sourceforge deposit GnuPG-Interface-0.46/README0000644000175000017500000005113311173400104014203 0ustar chmrrchmrrGnuPG::Interface(3) User Contributed Perl Documentation GnuPG::Interface(3) NNAAMMEE GnuPG::Interface − Perl interface to GnuPG SSYYNNOOPPSSIISS # A simple example use IO::Handle; use GnuPG::Interface; # settting 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; DDEESSCCRRIIPPTTIIOONN GnuPG::Interface and its associated modules are designed to provide an object‐oriented method for interacting with GnuPG, being able to per‐ form functions such as but not limited to encrypting, signing, decryp‐ tion, verification, and key‐listing parsing. HHooww DDaattaa MMeemmbbeerr AAcccceessssoorr MMeetthhooddss aarree CCrreeaatteedd Each module in the GnuPG::Interface bundle relies on Class::MethodMaker to generate the get/set methods used to set the object’s data members. _T_h_i_s _i_s _v_e_r_y _i_m_p_o_r_t_a_n_t _t_o _r_e_a_l_i_z_e_. This means that any data member which is a list has special methods assigned to it for pushing, pop‐ ping, and clearing the list. UUnnddeerrssttaannddiinngg BBiiddiirreeccttiioonnaall CCoommmmuunniiccaattiioonn It is also imperative to realize that this package uses interprocess communication methods similar to those used in IPC::Open3 and "Bidirec‐ tional 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 creat‐ ing a GnuPG::Interface object, creating a GnuPG::Handles object, set‐ ting some options in its ooppttiioonnss data member, and then calling a method which invokes GnuPG, such as cclleeaarrssiiggnn. One then interacts with with the handles appropriately, as described in "Bidirectional Communication with Another Process" in perlipc. OOBBJJEECCTT MMEETTHHOODDSS IInniittiiaalliizzaattiioonn MMeetthhooddss new( _%_i_n_i_t_i_a_l_i_z_a_t_i_o_n___a_r_g_s ) This methods creates a new object. The optional arguments are ini‐ tialization of data members; the initialization is done in a manner according to the method created as described in "new_hash_init" in Class::MethodMaker. hash_init( _%_a_r_g_s ). This methods work as described in "new_hash_init" in Class::Method‐ Maker. OObbjjeecctt MMeetthhooddss wwhhiicchh uussee aa GGnnuuPPGG::::HHaannddlleess OObbjjeecctt 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( % ) 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 hhaannddlleess which has the value of a GnuPG::Handles object. Another optional key is ccoomm‐‐ mmaanndd__aarrggss which should have the value of an array reference; these arguments will be passed to GnuPG as command arguments. These com‐ mand arguments are used for such things as determining the keys to list in the eexxppoorrtt__kkeeyyss method. _P_l_e_a_s_e _n_o_t_e _t_h_a_t _G_n_u_P_G _c_o_m_m_a_n_d _a_r_g_u_m_e_n_t_s _a_r_e _n_o_t _t_h_e _s_a_m_e _a_s _G_n_u_P_G _o_p_t_i_o_n_s. 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 hhaannddlleess object to the running GnuPG object, so that bidirectional communi‐ cation can be established. That is, the optionally‐defined ssttddiinn, ssttddoouutt, ssttddeerrrr, ssttaattuuss, llooggggeerr, and ppaasssspphhrraassee handles will be attached to GnuPG’s input, output, standard error, the handle cre‐ ated by setting ssttaattuuss‐‐ffdd, the handle created by setting llooggggeerr‐‐ffdd, and the handle created by setting ppaasssspphhrraassee‐‐ffdd respectively. This tying of handles of similar to the process done in _I_P_C_:_:_O_p_e_n_3. If you want the GnuPG process to read or write directly to an already‐opened filehandle, you cannot do this via the normal _I_P_C_:_:_O_p_e_n_3 mechanisms. In order to accomplish this, set the appro‐ priate hhaannddlleess data member to the already‐opened filehandle, and then set the option ddiirreecctt to be true for that handle, as described in "options" in GnuPG::Handles. For example, to have GnuPG read from the file _i_n_p_u_t_._t_x_t and write to _o_u_t_p_u_t_._t_x_t, 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 hhaannddlleess 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 ssttaattuuss or llooggggeerr handle is not defined, this channel of communication is never established with GnuPG, and so this information is not gener‐ ated and does not come into play. If the ppaasssspphhrraassee data member handle of the hhaannddlleess object is not defined, but the the ppaasssspphhrraassee data member handle of GnuPG::Interface object is, GnuPG::Interface will handle passing this information into GnuPG for the user as a convience. 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. OOtthheerr MMeetthhooddss 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::Pub‐ licKey or GnuPG::SecretKey respectively. This is done by parsing the output of GnuPG with the option wwiitthh‐‐ccoolloonnss enabled. The objects created do or do not have signature information stored in them, depending if the method ends in ___s_i_g_s; this separation of functionality is there because of performance hits when listing information with signatures. _t_e_s_t___d_e_f_a_u_l_t___k_e_y___p_a_s_s_p_h_r_a_s_e_(_) 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 ppaasssspphhrraassee data member, and the default key specified in the ooppttiioonnss data member. IInnvvookkiinngg GGnnuuPPGG wwiitthh aa ccuussttoomm ccaallll 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 pro‐ vided, "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, hhaannddlleess 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. OOBBJJEECCTT DDAATTAA MMEEMMBBEERRSS Note that these data members are interacted with via object methods created using the methods described in "get_set" in Class::MethodMaker, or "object" in Class::MethodMaker. Please read there for more informa‐ tion. 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 call‐ ing GnuPG via _a_n_y of the object methods described in this package. See GnuPG::Options for more information. EEXXAAMMPPLLEESS 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’, ’0xABCD1234’ ], meta_interactive( 0 ), ); EEnnccrryyppttiinngg # 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 SSiiggnniinngg # 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 # convience 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 DDeeccrryyppttiioonn # 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_fd $passphrase; close $passphrase_fd; # 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 PPrriinnttiinngg KKeeyyss # 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’, ’0xABCD1234’ ]; # 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; CCrreeaattiinngg GGnnuuPPGG::::PPuubblliiccKKeeyy OObbjjeeccttss my @ids = [ ’ftobin’, ’0xABCD1234’ ]; my @keys = $gnupg‐>get_public_keys( @ids ); # no wait is required this time; it’s handled internally # since the entire call is encapsulated CCuussttoomm GGnnuuPPGG ccaallll # 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; FFAAQQ How do I get GnuPG::Interface to read/write directly from a filehandle? You need to set GnuPG::Handles ddiirreecctt 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 infor‐ mation. Why do you make it so difficult to get GnuPG to write/read from a file‐ handle? 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 nnoonn‐‐ddiirreecctt 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. NNOOTTEESS 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 wwaaiitt to clean up GnuPG from the process table. BBUUGGSS 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. I don’t know yet how well this modules handles parsing OpenPGP v3 keys. SSEEEE AALLSSOO GnuPG::Options, GnuPG::Handles, GnuPG::PublicKey, GnuPG::SecretKey, gpg, Class::MethodMaker, "Bidirectional Communication with Another Process" in perlipc AAUUTTHHOORR GnuPg::Interface is currently maintained by Jesse Vincent . Frank J. Tobin, ftobin@cpan.org was the original author of the package. perl v5.8.8 2007‐04‐24 GnuPG::Interface(3) GnuPG-Interface-0.46/inc/0000755000175000017500000000000012042334655014106 5ustar chmrrchmrrGnuPG-Interface-0.46/inc/Module/0000755000175000017500000000000012042334655015333 5ustar chmrrchmrrGnuPG-Interface-0.46/inc/Module/Install.pm0000644000175000017500000003013512042334654017300 0ustar chmrrchmrr#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.005; 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.06'; # 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::cwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { my $pwd = Cwd::cwd(); 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::cwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; $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( 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($subpath . '.pm'); my $in_pod = 0; foreach ( split //, $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; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_NEW sub _read { local *FH; open( FH, "< $_[0]" ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_OLD 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; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _write { local *FH; open( FH, '>', $_[0] ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_NEW sub _write { local *FH; open( FH, "> $_[0]" ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_OLD # _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-0.46/inc/Module/Install/0000755000175000017500000000000012042334655016741 5ustar chmrrchmrrGnuPG-Interface-0.46/inc/Module/Install/Fetch.pm0000644000175000017500000000462712042334655020341 0ustar chmrrchmrr#line 1 package Module::Install::Fetch; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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-0.46/inc/Module/Install/Base.pm0000644000175000017500000000214712042334654020154 0ustar chmrrchmrr#line 1 package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { $VERSION = '1.06'; } # 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-0.46/inc/Module/Install/Can.pm0000644000175000017500000000615712042334655020011 0ustar chmrrchmrr#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.06'; @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; 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 236 GnuPG-Interface-0.46/inc/Module/Install/Makefile.pm0000644000175000017500000002743712042334655021031 0ustar chmrrchmrr#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.06'; @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-seperated 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-0.46/inc/Module/Install/WriteAll.pm0000644000175000017500000000237612042334655021032 0ustar chmrrchmrr#line 1 package Module::Install::WriteAll; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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-0.46/inc/Module/Install/Metadata.pm0000644000175000017500000004327712042334654021033 0ustar chmrrchmrr#line 1 package Module::Install::Metadata; use strict 'vars'; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } my @boolean_keys = qw{ sign }; my @scalar_keys = qw{ name module_name abstract version distribution_type tests installdirs }; my @tuple_keys = qw{ configure_requires build_requires requires recommends bundles resources }; my @resource_keys = qw{ homepage bugtracker repository }; my @array_keys = qw{ keywords author }; *authors = \&author; sub Meta { shift } sub Meta_BooleanKeys { @boolean_keys } sub Meta_ScalarKeys { @scalar_keys } sub Meta_TupleKeys { @tuple_keys } sub Meta_ResourceKeys { @resource_keys } sub Meta_ArrayKeys { @array_keys } foreach my $key ( @boolean_keys ) { *$key = sub { my $self = shift; if ( defined wantarray and not @_ ) { return $self->{values}->{$key}; } $self->{values}->{$key} = ( @_ ? $_[0] : 1 ); return $self; }; } foreach my $key ( @scalar_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} = shift; return $self; }; } foreach my $key ( @array_keys ) { *$key = sub { my $self = shift; return $self->{values}->{$key} if defined wantarray and !@_; $self->{values}->{$key} ||= []; push @{$self->{values}->{$key}}, @_; return $self; }; } foreach my $key ( @resource_keys ) { *$key = sub { my $self = shift; unless ( @_ ) { return () unless $self->{values}->{resources}; return map { $_->[1] } grep { $_->[0] eq $key } @{ $self->{values}->{resources} }; } return $self->{values}->{resources}->{$key} unless @_; my $uri = shift or die( "Did not provide a value to $key()" ); $self->resources( $key => $uri ); return 1; }; } foreach my $key ( grep { $_ ne "resources" } @tuple_keys) { *$key = sub { my $self = shift; return $self->{values}->{$key} unless @_; my @added; while ( @_ ) { my $module = shift or last; my $version = shift || 0; push @added, [ $module, $version ]; } push @{ $self->{values}->{$key} }, @added; return map {@$_} @added; }; } # Resource handling my %lc_resource = map { $_ => 1 } qw{ homepage license bugtracker repository }; sub resources { my $self = shift; while ( @_ ) { my $name = shift or last; my $value = shift or next; if ( $name eq lc $name and ! $lc_resource{$name} ) { die("Unsupported reserved lowercase resource '$name'"); } $self->{values}->{resources} ||= []; push @{ $self->{values}->{resources} }, [ $name, $value ]; } $self->{values}->{resources}; } # Aliases for build_requires that will have alternative # meanings in some future version of META.yml. sub test_requires { shift->build_requires(@_) } sub install_requires { shift->build_requires(@_) } # Aliases for installdirs options sub install_as_core { $_[0]->installdirs('perl') } sub install_as_cpan { $_[0]->installdirs('site') } sub install_as_site { $_[0]->installdirs('site') } sub install_as_vendor { $_[0]->installdirs('vendor') } sub dynamic_config { my $self = shift; my $value = @_ ? shift : 1; if ( $self->{values}->{dynamic_config} ) { # Once dynamic we never change to static, for safety return 0; } $self->{values}->{dynamic_config} = $value ? 1 : 0; return 1; } # Convenience command sub static_config { shift->dynamic_config(0); } sub perl_version { my $self = shift; return $self->{values}->{perl_version} unless @_; my $version = shift or die( "Did not provide a value to perl_version()" ); # Normalize the version $version = $self->_perl_version($version); # We don't support the really old versions unless ( $version >= 5.005 ) { die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; } $self->{values}->{perl_version} = $version; } sub all_from { my ( $self, $file ) = @_; unless ( defined($file) ) { my $name = $self->name or die( "all_from called with no args without setting name() first" ); $file = join('/', 'lib', split(/-/, $name)) . '.pm'; $file =~ s{.*/}{} unless -e $file; unless ( -e $file ) { die("all_from cannot find $file from $name"); } } unless ( -f $file ) { die("The path '$file' does not exist, or is not a file"); } $self->{values}{all_from} = $file; # Some methods pull from POD instead of code. # If there is a matching .pod, use that instead my $pod = $file; $pod =~ s/\.pm$/.pod/i; $pod = $file unless -e $pod; # Pull the different values $self->name_from($file) unless $self->name; $self->version_from($file) unless $self->version; $self->perl_version_from($file) unless $self->perl_version; $self->author_from($pod) unless @{$self->author || []}; $self->license_from($pod) unless $self->license; $self->abstract_from($pod) unless $self->abstract; return 1; } sub provides { my $self = shift; my $provides = ( $self->{values}->{provides} ||= {} ); %$provides = (%$provides, @_) if @_; return $provides; } sub auto_provides { my $self = shift; return $self unless $self->is_admin; unless (-e 'MANIFEST') { warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; return $self; } # Avoid spurious warnings as we are not checking manifest here. local $SIG{__WARN__} = sub {1}; require ExtUtils::Manifest; local *ExtUtils::Manifest::manicheck = sub { return }; require Module::Build; my $build = Module::Build->new( dist_name => $self->name, dist_version => $self->version, license => $self->license, ); $self->provides( %{ $build->find_dist_packages || {} } ); } sub feature { my $self = shift; my $name = shift; my $features = ( $self->{values}->{features} ||= [] ); my $mods; if ( @_ == 1 and ref( $_[0] ) ) { # The user used ->feature like ->features by passing in the second # argument as a reference. Accomodate for that. $mods = $_[0]; } else { $mods = \@_; } my $count = 0; push @$features, ( $name => [ map { ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ } @$mods ] ); return @$features; } sub features { my $self = shift; while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { $self->feature( $name, @$mods ); } return $self->{values}->{features} ? @{ $self->{values}->{features} } : (); } sub no_index { my $self = shift; my $type = shift; push @{ $self->{values}->{no_index}->{$type} }, @_ if $type; return $self->{values}->{no_index}; } sub read { my $self = shift; $self->include_deps( 'YAML::Tiny', 0 ); require YAML::Tiny; my $data = YAML::Tiny::LoadFile('META.yml'); # Call methods explicitly in case user has already set some values. while ( my ( $key, $value ) = each %$data ) { next unless $self->can($key); if ( ref $value eq 'HASH' ) { while ( my ( $module, $version ) = each %$value ) { $self->can($key)->($self, $module => $version ); } } else { $self->can($key)->($self, $value); } } return $self; } sub write { my $self = shift; return $self unless $self->is_admin; $self->admin->write_meta; return $self; } sub version_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->version( ExtUtils::MM_Unix->parse_version($file) ); # for version integrity check $self->makemaker_args( VERSION_FROM => $file ); } sub abstract_from { require ExtUtils::MM_Unix; my ( $self, $file ) = @_; $self->abstract( bless( { DISTNAME => $self->name }, 'ExtUtils::MM_Unix' )->parse_abstract($file) ); } # Add both distribution and module name sub name_from { my ($self, $file) = @_; if ( Module::Install::_read($file) =~ m/ ^ \s* package \s* ([\w:]+) \s* ; /ixms ) { my ($name, $module_name) = ($1, $1); $name =~ s{::}{-}g; $self->name($name); unless ( $self->module_name ) { $self->module_name($module_name); } } else { die("Cannot determine name from $file\n"); } } sub _extract_perl_version { if ( $_[0] =~ m/ ^\s* (?:use|require) \s* v? ([\d_\.]+) \s* ; /ixms ) { my $perl_version = $1; $perl_version =~ s{_}{}g; return $perl_version; } else { return; } } sub perl_version_from { my $self = shift; my $perl_version=_extract_perl_version(Module::Install::_read($_[0])); if ($perl_version) { $self->perl_version($perl_version); } else { warn "Cannot determine perl version info from $_[0]\n"; return; } } sub author_from { my $self = shift; my $content = Module::Install::_read($_[0]); if ($content =~ m/ =head \d \s+ (?:authors?)\b \s* ([^\n]*) | =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* ([^\n]*) /ixms) { my $author = $1 || $2; # XXX: ugly but should work anyway... if (eval "require Pod::Escapes; 1") { # Pod::Escapes has a mapping table. # It's in core of perl >= 5.9.3, and should be installed # as one of the Pod::Simple's prereqs, which is a prereq # of Pod::Text 3.x (see also below). $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $Pod::Escapes::Name2character_number{$1} ? chr($Pod::Escapes::Name2character_number{$1}) : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) { # Pod::Text < 3.0 has yet another mapping table, # though the table name of 2.x and 1.x are different. # (1.x is in core of Perl < 5.6, 2.x is in core of # Perl < 5.9.3) my $mapping = ($Pod::Text::VERSION < 2) ? \%Pod::Text::HTML_Escapes : \%Pod::Text::ESCAPES; $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $mapping->{$1} ? $mapping->{$1} : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } else { $author =~ s{E}{<}g; $author =~ s{E}{>}g; } $self->author($author); } else { warn "Cannot determine author info from $_[0]\n"; } } #Stolen from M::B my %license_urls = ( perl => 'http://dev.perl.org/licenses/', apache => 'http://apache.org/licenses/LICENSE-2.0', apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1', artistic => 'http://opensource.org/licenses/artistic-license.php', artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php', lgpl => 'http://opensource.org/licenses/lgpl-license.php', lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php', lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html', bsd => 'http://opensource.org/licenses/bsd-license.php', gpl => 'http://opensource.org/licenses/gpl-license.php', gpl2 => 'http://opensource.org/licenses/gpl-2.0.php', gpl3 => 'http://opensource.org/licenses/gpl-3.0.html', mit => 'http://opensource.org/licenses/mit-license.php', mozilla => 'http://opensource.org/licenses/mozilla1.1.php', open_source => undef, unrestricted => undef, restrictive => undef, unknown => undef, ); sub license { my $self = shift; return $self->{values}->{license} unless @_; my $license = shift or die( 'Did not provide a value to license()' ); $license = __extract_license($license) || lc $license; $self->{values}->{license} = $license; # Automatically fill in license URLs if ( $license_urls{$license} ) { $self->resources( license => $license_urls{$license} ); } return 1; } sub _extract_license { my $pod = shift; my $matched; return __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ L(?i:ICEN[CS]E|ICENSING)\b.*?) (=head \d.*|=cut.*|)\z /xms ) || __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ (?:C(?i:OPYRIGHTS?)|L(?i:EGAL))\b.*?) (=head \d.*|=cut.*|)\z /xms ); } sub __extract_license { my $license_text = shift or return; my @phrases = ( '(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1, '(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1, 'Artistic and GPL' => 'perl', 1, 'GNU general public license' => 'gpl', 1, 'GNU public license' => 'gpl', 1, 'GNU lesser general public license' => 'lgpl', 1, 'GNU lesser public license' => 'lgpl', 1, 'GNU library general public license' => 'lgpl', 1, 'GNU library public license' => 'lgpl', 1, 'GNU Free Documentation license' => 'unrestricted', 1, 'GNU Affero General Public License' => 'open_source', 1, '(?:Free)?BSD license' => 'bsd', 1, 'Artistic license 2\.0' => 'artistic_2', 1, 'Artistic license' => 'artistic', 1, 'Apache (?:Software )?license' => 'apache', 1, 'GPL' => 'gpl', 1, 'LGPL' => 'lgpl', 1, 'BSD' => 'bsd', 1, 'Artistic' => 'artistic', 1, 'MIT' => 'mit', 1, 'Mozilla Public License' => 'mozilla', 1, 'Q Public License' => 'open_source', 1, 'OpenSSL License' => 'unrestricted', 1, 'SSLeay License' => 'unrestricted', 1, 'zlib License' => 'open_source', 1, 'proprietary' => 'proprietary', 0, ); while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { $pattern =~ s#\s+#\\s+#gs; if ( $license_text =~ /\b$pattern\b/i ) { return $license; } } return ''; } sub license_from { my $self = shift; if (my $license=_extract_license(Module::Install::_read($_[0]))) { $self->license($license); } else { warn "Cannot determine license info from $_[0]\n"; return 'unknown'; } } sub _extract_bugtracker { my @links = $_[0] =~ m#L<( https?\Q://rt.cpan.org/\E[^>]+| https?\Q://github.com/\E[\w_]+/[\w_]+/issues| https?\Q://code.google.com/p/\E[\w_\-]+/issues/list )>#gx; my %links; @links{@links}=(); @links=keys %links; return @links; } sub bugtracker_from { my $self = shift; my $content = Module::Install::_read($_[0]); my @links = _extract_bugtracker($content); unless ( @links ) { warn "Cannot determine bugtracker info from $_[0]\n"; return 0; } if ( @links > 1 ) { warn "Found more than one bugtracker link in $_[0]\n"; return 0; } # Set the bugtracker bugtracker( $links[0] ); return 1; } sub requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->requires( $module => $version ); } } sub test_requires_from { my $self = shift; my $content = Module::Install::_readperl($_[0]); my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg; while ( @requires ) { my $module = shift @requires; my $version = shift @requires; $self->test_requires( $module => $version ); } } # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to # numbers (eg, 5.006001 or 5.008009). # Also, convert double-part versions (eg, 5.8) sub _perl_version { my $v = $_[-1]; $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e; $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e; $v =~ s/(\.\d\d\d)000$/$1/; $v =~ s/_.+$//; if ( ref($v) ) { # Numify $v = $v + 0; } return $v; } sub add_metadata { my $self = shift; my %hash = @_; for my $key (keys %hash) { warn "add_metadata: $key is not prefixed with 'x_'.\n" . "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/; $self->{values}->{$key} = $hash{$key}; } } ###################################################################### # MYMETA Support sub WriteMyMeta { die "WriteMyMeta has been deprecated"; } sub write_mymeta_yaml { my $self = shift; # We need YAML::Tiny to write the MYMETA.yml file unless ( eval { require YAML::Tiny; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.yml\n"; YAML::Tiny::DumpFile('MYMETA.yml', $meta); } sub write_mymeta_json { my $self = shift; # We need JSON to write the MYMETA.json file unless ( eval { require JSON; 1; } ) { return 1; } # Generate the data my $meta = $self->_write_mymeta_data or return 1; # Save as the MYMETA.yml file print "Writing MYMETA.json\n"; Module::Install::_write( 'MYMETA.json', JSON->new->pretty(1)->canonical->encode($meta), ); } sub _write_mymeta_data { my $self = shift; # If there's no existing META.yml there is nothing we can do return undef unless -f 'META.yml'; # We need Parse::CPAN::Meta to load the file unless ( eval { require Parse::CPAN::Meta; 1; } ) { return undef; } # Merge the perl version into the dependencies my $val = $self->Meta->{values}; my $perl = delete $val->{perl_version}; if ( $perl ) { $val->{requires} ||= []; my $requires = $val->{requires}; # Canonize to three-dot version after Perl 5.6 if ( $perl >= 5.006 ) { $perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e } unshift @$requires, [ perl => $perl ]; } # Load the advisory META.yml file my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); my $meta = $yaml[0]; # Overwrite the non-configure dependency hashs 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-0.46/inc/Module/Install/Win32.pm0000644000175000017500000000340312042334655020201 0ustar chmrrchmrr#line 1 package Module::Install::Win32; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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-0.46/MANIFEST.SKIP0000644000175000017500000000020111653662645015236 0ustar chmrrchmrrTODO Makefile$ Makefile.old$ blib pm_to_blib .swp$ ~$ .tmp$ .bak$ .git/ .gitignore$ .shipit$ test/random_seed$ test/trustdb.gpg$ GnuPG-Interface-0.46/t/0000755000175000017500000000000012042334655013600 5ustar chmrrchmrrGnuPG-Interface-0.46/t/passphrase_handling.t0000644000175000017500000000220211653656514020006 0ustar chmrrchmrr#!/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-0.46/t/clearsign.t0000644000175000017500000000117611653656514015751 0ustar chmrrchmrr#!/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-0.46/t/MyTest.pm0000644000175000017500000000211411653656514015371 0ustar chmrrchmrr# 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-0.46/t/list_secret_keys.t0000644000175000017500000000271711653656514017357 0ustar chmrrchmrr#!/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(); 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"; $out->print( <$stdout> ); close $stdout; $out->close(); waitpid $pid, 0; return $CHILD_ERROR == 0; }; TEST { my @files_to_test = ( 'test/secret-keys/1.0.test' ); return file_match( $outfile, @files_to_test ); }; TEST { reset_handles(); my $pid = $gnupg->list_secret_keys( handles => $handles, command_args => '0xF950DA9C' ); 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 => '0xF950DA9C' ); waitpid $pid, 0; $outfile = $texts{temp}->fn(); return $CHILD_ERROR == 0; }; GnuPG-Interface-0.46/t/wrap_call.t0000644000175000017500000000166711173400104015726 0ustar chmrrchmrr#!/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-0.46/t/Fingerprint.t0000644000175000017500000000076211173400104016244 0ustar chmrrchmrr#!/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-0.46/t/verify.t0000644000175000017500000000117611653656514015306 0ustar chmrrchmrr#!/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-0.46/t/detach_sign.t0000644000175000017500000000120611653656514016244 0ustar chmrrchmrr#!/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-0.46/t/Interface.t0000644000175000017500000000057611173400104015660 0ustar chmrrchmrr#!/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 = 'gpg'; my $v2 = 'gnupg'; 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-0.46/t/encrypt_symmetrically.t0000644000175000017500000000124511653656514020441 0ustar chmrrchmrr#!/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-0.46/t/sign.t0000644000175000017500000000116111653656514014734 0ustar chmrrchmrr#!/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-0.46/t/list_sigs.t0000644000175000017500000000252311653656514015777 0ustar chmrrchmrr#!/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 => '0xF950DA9C', ); 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 => '0xF950DA9C', ); waitpid $pid, 0; $outfile = $texts{temp}->fn(); return $CHILD_ERROR == 0; }; GnuPG-Interface-0.46/t/get_public_keys.t0000644000175000017500000002021311653666337017147 0ustar chmrrchmrr#!/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( '0xF950DA9C' ); 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', ) ); 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( date => 953180097, algo_num => 17, is_exportable => 1, user_id_string => 'Frank J. Tobin ', date_string => '2000-03-16', hex_id => '56FFD10A260C4FA3', sig_class => 0x10, validity => '!'), 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 => '!')); 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( date => 953180103, algo_num => 17, is_exportable => 1, user_id_string => 'Frank J. Tobin ', date_string => '2000-03-16', hex_id => '56FFD10A260C4FA3', sig_class => 0x10, validity => '!'), 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 => 'u', length => 768, algo_num => 16, hex_id => 'ADB99D9C2E854A6B', creation_date => 949813119, creation_date_string => '2000-02-06', usage_flags => 'e', pubkey_data => $subkey_pub_data, ); $subkey->fingerprint ( GnuPG::Fingerprint->new( as_hex_string => '7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B' ) ); $subkey->push_signatures( $subkey_signature ); $handmade_key->push_subkeys( $subkey ); $handmade_key->push_revokers( $revoker ); $handmade_key->compare( $given_key ); }; TEST { my $subkey1 = $given_key->subkeys()->[0]; my $subkey2 = $handmade_key->subkeys()->[0]; bless $subkey1, 'GnuPG::SubKey'; my $equal = $subkey1->compare( $subkey2 ); warn 'subkeys fail comparison; this is a known issue with GnuPG 1.0.1' if not $equal; return $equal; }; TEST { $handmade_key->compare( $given_key, 1 ); }; GnuPG-Interface-0.46/t/decrypt.t0000644000175000017500000000172211653656514015451 0ustar chmrrchmrr#!/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; }; GnuPG-Interface-0.46/t/UserId.t0000644000175000017500000000062611173400104015147 0ustar chmrrchmrr#!/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-0.46/t/encrypt.t0000644000175000017500000000252311653656514015463 0ustar chmrrchmrr#!/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(); $gnupg->options->clear_recipients(); $gnupg->options->clear_meta_recipients_keys(); $gnupg->options->push_recipients( '0x2E854A6B' ); 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( '0xF950DA9C' ); $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( '0x2E854A6B' ); $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-0.46/t/export_keys.t0000644000175000017500000000125211653656514016351 0ustar chmrrchmrr#!/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 => '0xF950DA9C' ); 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 => '0xF950DA9C' ); waitpid $pid, 0; return $CHILD_ERROR == 0; }; GnuPG-Interface-0.46/t/MyTestSpecific.pm0000644000175000017500000000540511671431205017031 0ustar chmrrchmrr# 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 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 ); $gnupg = GnuPG::Interface->new( passphrase => 'test' ); $gnupg->options->hash_init( homedir => 'test', armor => 1, meta_interactive => 0, meta_signing_key_id => '0xF950DA9C', always_trust => 1, ); struct( Text => { fn => "\$", fh => "\$", data => "\$" } ); $texts{plain} = Text->new(); $texts{plain}->fn( 'test/plain.1.txt' ); $texts{encrypted} = Text->new(); $texts{encrypted}->fn( 'test/encrypted.1.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 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 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; } 1; GnuPG-Interface-0.46/t/get_secret_keys.t0000644000175000017500000000363611653663074017163 0ustar chmrrchmrr#!/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( '0xF950DA9C' ); return 0 unless @returned_keys == 1; $given_key = shift @returned_keys; $handmade_key = GnuPG::PrimaryKey->new ( length => 1024, algo_num => 17, hex_id => '53AE596EF950DA9C', creation_date => 949813093, creation_date_string => '2000-02-06', owner_trust => '', # secret keys do not report ownertrust? usage_flags => 'scaESCA', ); $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 => ''), # secret keys do not report uid validity? GnuPG::UserId->new( as_string => 'Foo Bar (1)', validity => '')); # secret keys do not report uid validity? my $subkey = GnuPG::SubKey->new ( validity => 'u', length => 768, algo_num => 16, hex_id => 'ADB99D9C2E854A6B', creation_date => 949813119, creation_date_string => '2000-02-06', usage_flags => 'e', ); $subkey->fingerprint ( GnuPG::Fingerprint->new( as_hex_string => '7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B', ) ); $handmade_key->push_subkeys( $subkey ); $handmade_key->compare( $given_key ); }; TEST { $handmade_key->compare( $given_key, 1 ); }; GnuPG-Interface-0.46/t/import_keys.t0000644000175000017500000000123611653656514016344 0ustar chmrrchmrr#!/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-0.46/t/sign_and_encrypt.t0000644000175000017500000000131311653656514017321 0ustar chmrrchmrr#!/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( '0x2E854A6B' ); 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-0.46/t/list_public_keys.t0000644000175000017500000000257111653656514017346 0ustar chmrrchmrr#!/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, ommand_args => '0xF950DA9C' ); 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 => '0xF950DA9C', ); waitpid $pid, 0; $outfile = $texts{temp}->fn(); return $CHILD_ERROR == 0; }; GnuPG-Interface-0.46/COPYING0000644000175000017500000000015411173400104014353 0ustar chmrrchmrrThis module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. GnuPG-Interface-0.46/SIGNATURE0000644000175000017500000001335312042334655014626 0ustar chmrrchmrrThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.68. 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: SHA1 SHA1 187c2cfc1fc31d42c18d5b1653afa1a905bf266c COPYING SHA1 b9db27c778702df04650d3cdb6f791fca8cc727c ChangeLog SHA1 37e4d07c43f08f41a24fd1157ab530a4a06aab37 MANIFEST SHA1 0c5f7bda8a3ce57e27dcd7f32459d8b286f1339e MANIFEST.SKIP SHA1 863944080648e823e852f3b58c768897a709de59 META.yml SHA1 7782ec3ebf4194b81b83f39f0c0f5564e0363149 Makefile.PL SHA1 d6e32c5128419cdbfe6e6f846ff7f64fc0adac2f NEWS SHA1 1047dc54823b1321e939274dd261d8e40febee24 README SHA1 df07bf5a2dd74ffe4b69dff3063f68879cf9e355 THANKS SHA1 8a924add836b60fb23b25c8506d45945e02f42f4 inc/Module/Install.pm SHA1 2d0fad3bf255f8c1e7e1e34eafccc4f595603ddc inc/Module/Install/Base.pm SHA1 f0e01fff7d73cd145fbf22331579918d4628ddb0 inc/Module/Install/Can.pm SHA1 7328966e4fda0c8451a6d3850704da0b84ac1540 inc/Module/Install/Fetch.pm SHA1 b62ca5e2d58fa66766ccf4d64574f9e1a2250b34 inc/Module/Install/Makefile.pm SHA1 1aa925be410bb3bfcd84a16985921f66073cc1d2 inc/Module/Install/Metadata.pm SHA1 e4196994fa75e98bdfa2be0bdeeffef66de88171 inc/Module/Install/Win32.pm SHA1 c3a6d0d5b84feb3280622e9599e86247d58b0d18 inc/Module/Install/WriteAll.pm SHA1 9a2b6c9e5434daf32bc2a3e15e25175fc49fd604 lib/GnuPG/Fingerprint.pm SHA1 8852195e80823c93b6aed673e69433ae3ea46d26 lib/GnuPG/Handles.pm SHA1 779e6a921fa104e8f16fd4a6d38f670074592811 lib/GnuPG/HashInit.pm SHA1 d959f3b7feeacc017836b1652dfdc35fa75cce04 lib/GnuPG/Interface.pm SHA1 bb75d45acb8268096348740e261812519b7258cb lib/GnuPG/Key.pm SHA1 697b1408b404e4dff0ae553646fb3c12f821fcd4 lib/GnuPG/Options.pm SHA1 5fbf442fc1586b88139508b838700b7a3992ced7 lib/GnuPG/PrimaryKey.pm SHA1 1cf3880965f6a600af7713252b42c624b748c493 lib/GnuPG/PublicKey.pm SHA1 1b0323f31492f4564b5983b8d7f1e99f8a794d6f lib/GnuPG/Revoker.pm SHA1 1aa4521f22337b6a8d8c7980a97ea9f692528038 lib/GnuPG/SecretKey.pm SHA1 b7777eef0e5517d58f04ec06c942df24eca1724a lib/GnuPG/Signature.pm SHA1 91edc51255f9bf5882af027c0489d76f11894f4c lib/GnuPG/SubKey.pm SHA1 6d70018973ec4fd4b224b2eb7bf77b2b007f72b2 lib/GnuPG/UserAttribute.pm SHA1 145730a6ccc5d543a65ee25411bb6d8119dc8fce lib/GnuPG/UserId.pm SHA1 367fdb308292a9c005afffef49ff9096a20a4da3 t/Fingerprint.t SHA1 8791d014e4efd4cf11998386e1651cc4eb16dd26 t/Interface.t SHA1 698ec633be083b7e762331f1a5106c1618c74dd3 t/MyTest.pm SHA1 a3aef62cb9ec31d2d398548114685ba8c5cdeb93 t/MyTestSpecific.pm SHA1 ccd942d9f00627253d7eb9c011116dc5671639b8 t/UserId.t SHA1 16ac3a802f059cad9b7a0567eebe8b9599cc2551 t/clearsign.t SHA1 fab3deb7f60a0b5aae2f92b1c39804d1a4df2848 t/decrypt.t SHA1 67364d69fda2826735c8e39d50ea81a80d529a6c t/detach_sign.t SHA1 54d40d0d5233ad3097c5ca79032f38171334c7a4 t/encrypt.t SHA1 eeb2c355817cf641ad9e90e90f01007efce29cbe t/encrypt_symmetrically.t SHA1 a95b669219675ac2fadc8b5d3c49dcfd69609fe2 t/export_keys.t SHA1 889e4ea15ae0ddd169f03ee03307ece5f0debbe7 t/get_public_keys.t SHA1 fdca3db7bb332108d5a9011cb0f2c61f123c04fa t/get_secret_keys.t SHA1 a0f7dfa3778defadaf3600a7cfd69bfd027fdad2 t/import_keys.t SHA1 3355815cd188313a39116a661669ff92cebd701f t/list_public_keys.t SHA1 2ccb69c8a216e7f6db9faa2d6127561aeaa8130c t/list_secret_keys.t SHA1 17bccf75d6920c3d75dc3c8dbcdc0d0855275350 t/list_sigs.t SHA1 a8d213b81f23469460d8466520590bbeaee14aed t/passphrase_handling.t SHA1 1a20b9dac32bb1b40294e966de09eb89589a8891 t/sign.t SHA1 fa87a1405c58a951518003efd95700a9ca4b60ed t/sign_and_encrypt.t SHA1 6732202eb77e2d90af01f557d3e534812ec672af t/verify.t SHA1 09f7e2320231cfb923325fd474d76ff20d8c6c6b t/wrap_call.t SHA1 58f58338a2922798c59c5e852bd0110541f27e2d test/encrypted.1.gpg SHA1 b012a47f295ee9dcc955560b9a78c0ad3a61e137 test/key.1.asc SHA1 1290379acadab2cc713d659c7c3feff2b0923f75 test/options SHA1 4e1243bd22c66e76c2ba9eddc1f91394e57f9f83 test/passphrase SHA1 59c0e6436b38645144d17ce11ac4aabfdd43e960 test/plain.1.txt SHA1 7d94ea032bdbb0104c1dc73583ec64ade6294495 test/public-keys-sigs/1.0.test SHA1 63d93054decf9ff6c2dc99eb03f131b55af4ee43 test/public-keys-sigs/1.1.test SHA1 a007df3963780784b12a31408bf7972c9686220f test/public-keys-sigs/1.out SHA1 bd9892a93f802c68109b11b756f79f6b0292eb1a test/public-keys-sigs/2.0.test SHA1 73d90696020a01753cda984262a2831dcc6ac0d7 test/public-keys-sigs/2.1.test SHA1 343df38fd93847e5646f84679fe50e277b0a12c5 test/public-keys-sigs/2.out SHA1 82d483adc6d203c79856a70dd259370f6efdeef7 test/public-keys/1.0.test SHA1 86056ad37b8bb67d55ac61b5d5a27ac4bbd1cceb test/public-keys/1.1.test SHA1 18365fae169164b18e855861e74fa2a84031b53b test/public-keys/1.out SHA1 a8e97a2439671dae0dd29a2404c321ccb686ba7a test/public-keys/2.0.test SHA1 54d2c13bf3b73b7582edef091175dfe3763ddf59 test/public-keys/2.1.test SHA1 18365fae169164b18e855861e74fa2a84031b53b test/public-keys/2.out SHA1 4349906c08f65af3b13e7b441ac4dd2e637bfeae test/pubring.gpg SHA1 e740841597775e3da265ec14e411ed0432bae5e2 test/secret-keys/1.0.test SHA1 e740841597775e3da265ec14e411ed0432bae5e2 test/secret-keys/1.out SHA1 3bd6135279f9ae23e32680707c6170910421e5de test/secret-keys/2.0.test SHA1 d15fbde50ae625d033b9cb903a03596fe3cb7e2e test/secret-keys/2.out SHA1 9ce5508cd8cefadc4c9bf2842864b52e87b1826e test/secring.gpg SHA1 981418a80bf7dab91b63608cfd1ddf5091f89ad7 test/signed.1.asc SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 test/temp -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAlCJua0ACgkQMflWJZZAbqAi2gCeILIoMJtmSIWZy84mCc/R3QLu GhcAn3kzvFOY1WcfRT6ayUD9GoJvQ5kz =6FyK -----END PGP SIGNATURE----- GnuPG-Interface-0.46/test/0000755000175000017500000000000012042334655014314 5ustar chmrrchmrrGnuPG-Interface-0.46/test/signed.1.asc0000644000175000017500000000064111173400104016400 0ustar chmrrchmrr-----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-0.46/test/temp0000644000175000017500000000000012042334654015171 0ustar chmrrchmrrGnuPG-Interface-0.46/test/passphrase0000644000175000017500000000000511173400104016366 0ustar chmrrchmrrtest GnuPG-Interface-0.46/test/plain.1.txt0000644000175000017500000000017411173400104016304 0ustar chmrrchmrr"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-0.46/test/public-keys-sigs/0000755000175000017500000000000012042334655017506 5ustar chmrrchmrrGnuPG-Interface-0.46/test/public-keys-sigs/2.1.test0000644000175000017500000000102411173400104020667 0ustar chmrrchmrrpub 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-0.46/test/public-keys-sigs/2.out0000644000175000017500000000140412042334652020374 0ustar chmrrchmrrpub 1024D/F950DA9C 2000-02-06 sig R F950DA9C 2001-01-01 GnuPG test key (for testing purposes only) uid GnuPG test key (for testing purposes only) sig 3 F950DA9C 2007-04-20 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin sig 3 F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) sig 3 F950DA9C 2007-04-20 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin sig 3 F950DA9C 2000-03-16 GnuPG test key (for testing purposes only) sub 768g/2E854A6B 2000-02-06 sig F950DA9C 2007-04-20 GnuPG test key (for testing purposes only) GnuPG-Interface-0.46/test/public-keys-sigs/1.out0000644000175000017500000000322012042334652020371 0ustar chmrrchmrrtest/pubring.gpg ---------------- pub 1024D/F950DA9C 2000-02-06 sig R F950DA9C 2001-01-01 GnuPG test key (for testing purposes only) uid GnuPG test key (for testing purposes only) sig 3 F950DA9C 2007-04-20 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin sig 3 F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) sig 3 F950DA9C 2007-04-20 GnuPG test key (for testing purposes only) sig 260C4FA3 2000-03-16 Frank J. Tobin sig 3 F950DA9C 2000-03-16 GnuPG test key (for testing purposes only) sub 768g/2E854A6B 2000-02-06 sig F950DA9C 2007-04-20 GnuPG test key (for testing purposes only) pub 1024D/260C4FA3 1999-04-22 [expired: 2001-04-21] uid Frank J. Tobin sig 3 260C4FA3 1999-07-02 Frank J. Tobin sig 164BDBAE 1999-11-16 [User ID not found] uid Frank J. Tobin sig 3 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 3 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 3 260C4FA3 1999-06-29 Frank J. Tobin sig 164BDBAE 1999-11-16 [User ID not found] GnuPG-Interface-0.46/test/public-keys-sigs/2.0.test0000644000175000017500000000077611173400104020703 0ustar chmrrchmrrpub 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-0.46/test/public-keys-sigs/1.1.test0000644000175000017500000000274711173400104020703 0ustar chmrrchmrrtest/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-0.46/test/public-keys-sigs/1.0.test0000644000175000017500000000267311173400104020700 0ustar chmrrchmrrtest/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-0.46/test/key.1.asc0000644000175000017500000000314611173400104015722 0ustar chmrrchmrr-----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-0.46/test/pubring.gpg0000644000175000017500000000653211653662645016501 0ustar chmrrchmrr8e aCNqZ3dX N=,-obZg?Hv˗0_0˨%Vr˛)g|>٩wAiz5bVpJHs$&>:CK*8Bv`˷x4HªemN{ ^DoXi3P{6Q#WIXs!+npT4zǘ뢅 ƶQ->V8#eP&NK&VQvÎk,̴^0, z S=Mak$OdOP$౜Ӥ-xXdǹlN5C:rMY>4& nexؓ p%uas\uWa!:P O;o 4`V & O SYnPڜ.i uOEaFRí'ص&"J<ٰ*GnuPG test key (for testing purposes only)b  F(eGPG SYnPڜnw-\j>EVz(MLp tsx`mx;sF8_ V & Ov&%>p(vh9Oɫ!y[XT;F:* ڰ\8e g  SYnPڜDMy'֊byF i>k1{Q/%>և Foo Bar (1)_  F(zeGPG SYnPڜOuC}qW~DB!2ԖyH#F8_ V & On/tbҮ6 lKIY ;\8^ g  SYnPڜ= u5J%"{6J~&G @c-U- 981-\ܜ$Χ$eWg# /t Ud7JFW"KD=zj"hch_1mV Tu6E~m'w\/8P jɪ brS&{3M C>>/7-O9\ ^6[* .y=J'Nw[*ˍoEOh/UUe>VyNF(eGPG SYnPڜ.FF~j+ɹ!b0s޺sB7ɱ4Kk1fgJ a/b+/QoZ \?*I5r@# b% 3ɫ}]g QjpxEAx8m,Љ1_HUfF&N0ׇJ<\~(QNzp).STa\8r3_;O ԩaGӫ؉ Bc;)qeOBw"gty. F,iL$liRdn=  z79jc!ފݏyb!5H*%|+Du w8:)kaMLٴb'd}A<~3Ӹ7(u\jd>0vEuP:Q ٨b>J(6EVS2O#Frank J. Tobin [7ɲ g  V & OO= 2MW5kb@E7<.&HMl7u|dT<F7 P:^&u /H;)غmC.J#oMF80 턄KۮfK'Wr?e >xqBV]'[f{@Dekan[7- g  V & OQQ vdc L e3&@ֲ@fN>HqF7 P:^ ;Lܡؗg1jՄ/ߘw)KVF80/ 턄Kۮ\L^)D;D QqA;L5` Frank J. Tobin [7x g  V & OӜ9u/0G$<{nJ1PShpfeLEe E80/ 턄KۮyiJsuFi銌`a6-԰K)b}y'rf'Frank J. Tobin [7|f g  V & OY,axijpx%v(gW[_$F80/ 턄Kۮ_վ:κPܿ /rziE3_o֪'@ 7˦'q @+Z, HT#RbPKіyyVߤ8\O[%[$kFYh9r;z9G}~4ANq,+)hBmA-ęayaNgBk%f[Ժ/[INʊXIxژ[˳gk~ Iv@cAE4U'.b?XUvj) AP9⢷%M%Dk+JsAe|v6`w,ڦRNHX[HgPi9ݍjW3Wım5#Y-_k.^7QjOł@n4//>)-$\gqZ2;ʬMa޾)<(TtHM~+mX3sKӝvzNۜ&+Qjxg~"L 7˦ g V & Ol\@lj߿ f);Qzޘ?GnuPG-Interface-0.46/test/options0000644000175000017500000000003011173400104015706 0ustar chmrrchmrrno-secmem-warning armor GnuPG-Interface-0.46/test/public-keys/0000755000175000017500000000000012042334655016543 5ustar chmrrchmrrGnuPG-Interface-0.46/test/public-keys/2.1.test0000644000175000017500000000025311173400104017727 0ustar chmrrchmrrpub 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-0.46/test/public-keys/2.out0000644000175000017500000000070212042334651017430 0ustar chmrrchmrrtest/pubring.gpg ---------------- pub 1024D/F950DA9C 2000-02-06 uid GnuPG test key (for testing purposes only) uid Foo Bar (1) sub 768g/2E854A6B 2000-02-06 pub 1024D/260C4FA3 1999-04-22 [expired: 2001-04-21] uid Frank J. Tobin uid Frank J. Tobin uid Dekan uid Frank J. Tobin GnuPG-Interface-0.46/test/public-keys/1.out0000644000175000017500000000070212042334651017427 0ustar chmrrchmrrtest/pubring.gpg ---------------- pub 1024D/F950DA9C 2000-02-06 uid GnuPG test key (for testing purposes only) uid Foo Bar (1) sub 768g/2E854A6B 2000-02-06 pub 1024D/260C4FA3 1999-04-22 [expired: 2001-04-21] uid Frank J. Tobin uid Frank J. Tobin uid Dekan uid Frank J. Tobin GnuPG-Interface-0.46/test/public-keys/2.0.test0000644000175000017500000000022511173400104017725 0ustar chmrrchmrrpub 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) sub 768g/2E854A6B 2000-02-06 GnuPG-Interface-0.46/test/public-keys/1.1.test0000644000175000017500000000076211173400104017733 0ustar chmrrchmrrtest/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-0.46/test/public-keys/1.0.test0000644000175000017500000000070611173400104017730 0ustar chmrrchmrrtest/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-0.46/test/secring.gpg0000644000175000017500000000233111653662645016456 0ustar chmrrchmrr8e aCNqZ3dX N=,-obZg?Hv˗0_0˨%Vr˛)g|>٩wAiz5bVpJHs$&>:CK*8Bv`˷x4HªemN{ ^DoXi3P{6Q#WIXs!+npT4zǘ뢅 ƶQ->V8#eP&NK&VQvÎk,̴^0, z S=Mak$OdOP$౜Ӥ-xXdǹlN5C:rMY>4& nexؓ p%uas\uW\{s@`h $AEeSɐ: |a!:P O;o 4`V & O SYnPڜ.i uOEaFRí'ص&"J<ٰ*GnuPG test key (for testing purposes only)_  F(yeGPG SYnPڜ8_ٺ.e0NFT>9T ɔ'Eg>/7-O9\ ^6[* .y=J'Nw[*ˍoEOh/UUe>Vy\{s@`a}Ӥsm되*fhIGEXD-x),+F"R;Ov\ZL_CMXsO- <9>Rc >6NF(eGPG SYnPڜ.FF~j+ɹ!b0s޺sBGnuPG-Interface-0.46/test/encrypted.1.gpg0000644000175000017500000000113411173400104017131 0ustar chmrrchmrr-----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-0.46/test/secret-keys/0000755000175000017500000000000012042334655016552 5ustar chmrrchmrrGnuPG-Interface-0.46/test/secret-keys/2.out0000644000175000017500000000024212042334651017436 0ustar chmrrchmrrsec 1024D/F950DA9C 2000-02-06 uid GnuPG test key (for testing purposes only) uid Foo Bar (1) ssb 768g/2E854A6B 2000-02-06 GnuPG-Interface-0.46/test/secret-keys/1.out0000644000175000017500000000030412042334651017434 0ustar chmrrchmrrtest/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 GnuPG-Interface-0.46/test/secret-keys/2.0.test0000644000175000017500000000022511173400104017734 0ustar chmrrchmrrsec 1024D/F950DA9C 2000-02-06 GnuPG test key (for testing purposes only) uid Foo Bar (1) ssb 768g/2E854A6B 2000-02-06 GnuPG-Interface-0.46/test/secret-keys/1.0.test0000644000175000017500000000030411173400104017731 0ustar chmrrchmrrtest/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 GnuPG-Interface-0.46/MANIFEST0000644000175000017500000000305211653662645014500 0ustar chmrrchmrrChangeLog COPYING 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/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 NEWS README SIGNATURE t/clearsign.t t/decrypt.t t/detach_sign.t t/encrypt.t t/encrypt_symmetrically.t t/export_keys.t t/Fingerprint.t t/get_public_keys.t t/get_secret_keys.t t/import_keys.t t/Interface.t t/list_public_keys.t t/list_secret_keys.t t/list_sigs.t t/MyTest.pm t/MyTestSpecific.pm t/passphrase_handling.t t/sign.t t/sign_and_encrypt.t t/UserId.t t/verify.t t/wrap_call.t test/encrypted.1.gpg test/key.1.asc test/options test/passphrase test/plain.1.txt test/public-keys-sigs/1.0.test test/public-keys-sigs/1.1.test test/public-keys-sigs/1.out test/public-keys-sigs/2.0.test test/public-keys-sigs/2.1.test test/public-keys-sigs/2.out test/public-keys/1.0.test test/public-keys/1.1.test test/public-keys/1.out test/public-keys/2.0.test test/public-keys/2.1.test test/public-keys/2.out test/pubring.gpg test/secret-keys/1.0.test test/secret-keys/1.out test/secret-keys/2.0.test test/secret-keys/2.out test/secring.gpg test/signed.1.asc test/temp THANKS GnuPG-Interface-0.46/Makefile.PL0000644000175000017500000000110311671431155015302 0ustar chmrrchmrruse 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 'Frank J. Tobin'; abstract 'supply object methods for interacting with GnuPG'; name 'GnuPG-Interface'; version_from 'lib/GnuPG/Interface.pm'; requires 'Any::Moose' => '0.04'; requires 'Math::BigInt' => '1.78'; license 'perl'; sign(); WriteAll(); GnuPG-Interface-0.46/THANKS0000644000175000017500000000065611173400104014242 0ustar chmrrchmrrGnuPG::Interface was originally written by Frank Tobin. Other people contributed by reporting problems, suggesting various improvements or submitting actual code. Here is a list of those people. Help me keep it complete and free of errors. Daniel Kendall DKendall@osl1.co.uk Frank Tobin ftobin@cpan.org Paul Walmsley the_shag@users.sourceforge.net Peter Palfrader weasel@debian.org Walter Stanish walter@pratyeka.org GnuPG-Interface-0.46/META.yml0000644000175000017500000000107012042334655014604 0ustar chmrrchmrr--- abstract: 'supply object methods for interacting with GnuPG' author: - 'Frank J. Tobin' build_requires: ExtUtils::MakeMaker: 6.36 configure_requires: ExtUtils::MakeMaker: 6.36 distribution_type: module dynamic_config: 1 generated_by: 'Module::Install version 1.06' 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: Any::Moose: 0.04 Math::BigInt: 1.78 resources: license: http://dev.perl.org/licenses/ version: 0.46 GnuPG-Interface-0.46/NEWS0000644000175000017500000001157211173400104014025 0ustar chmrrchmrrNoteworthy changes in 0.35 ----------------------------------------------------------------- * Changes are now tracked in the 'ChangeLog' file. (See that file for noteworthy changes) Noteworthy changes in 0.34 ----------------------------------------------------------------- * Documentation fixes. Noteworthy changes in 0.33 ----------------------------------------------------------------- * 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. Noteworthy changes in 0.32 ----------------------------------------------------------------- * Extended the expiration on the test keys another 4 years so that the test suite works. * Documentation fixes. * Other small cleanups. Noteworthy changes in 0.31 ----------------------------------------------------------------- * Fixed stalling test cases. * Added deprecation support for fields of GnuPG::Interface::wrap_call Noteworthy changes in 0.30 ----------------------------------------------------------------- * 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(). Noteworthy changes in 0.20 ----------------------------------------------------------------- * 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 Noteworthy changes in 0.11 ----------------------------------------------------------------- * 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. Noteworthy changes in 0.10 ----------------------------------------------------------------- * 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. Noteworthy changes in 0.09 ----------------------------------------------------------------- * 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. Noteworthy changes in 0.08 ----------------------------------------------------------------- * 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. Noteworthy changes in 0.07 ----------------------------------------------------------------- * 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. Noteworthy changes in 0.06 ----------------------------------------------------------------- * textmode option added to GnuPG::Options, and booleans of GnuPG::Options now make use of Class::MethodMaker's boolean usability. Noteworthy changes in 0.04 ----------------------------------------------------------------- * This is a re-packaging release of 0.03. Noteworty changes in 0.03 ----------------------------------------------------------------- * Documenation fixes. * GnuPG::Option meta-pgp5-compatibility bug fixed. Noteworty changes in 0.01 ----------------------------------------------------------------- * Initial release