[Bps-public-commit] GnuPG-Interface branch, master, updated. 0.51-5-g9663bc7
Alex Vandiver
alexmv at bestpractical.com
Mon Feb 16 20:53:41 EST 2015
The branch, master has been updated
via 9663bc78276c002fc23c6c480482a84a864eb7e7 (commit)
via 93e0ca46ac32b5a9a867d7add79b186d489eebc4 (commit)
via 15a6dec34e91f62e3f2434c068e269d2edf87484 (commit)
via bb83ea915fc5389f29f9c4ef413df4b5ff6c34ce (commit)
via d65a2857d8b7d6df09e67b2d3897fde3eb46dd1a (commit)
from 8cf9d7374d4606da1e8d695c49608b0f1d7fd6ba (commit)
Summary of changes:
Makefile.PL | 1 +
lib/GnuPG/Interface.pm | 4 +--
t/MyTest.pm | 16 +++++-----
t/MyTestSpecific.pm | 66 +++++++++++++++++++-------------------
t/clearsign.t | 12 +++----
t/decrypt.t | 20 ++++++------
t/detach_sign.t | 12 +++----
t/encrypt.t | 35 ++++++++++++++-------
t/encrypt_symmetrically.t | 12 +++----
t/export_keys.t | 12 +++----
t/get_public_keys.t | 80 +++++++++++++++++++++++------------------------
t/get_secret_keys.t | 42 ++++++++++++-------------
t/import_keys.t | 12 +++----
t/list_public_keys.t | 34 ++++++++++----------
t/list_secret_keys.t | 30 +++++++++---------
t/list_sigs.t | 32 +++++++++----------
t/passphrase_handling.t | 18 +++++------
t/sign.t | 12 +++----
t/sign_and_encrypt.t | 12 +++----
t/verify.t | 14 ++++-----
t/wrap_call.t | 28 ++++++++---------
21 files changed, 258 insertions(+), 246 deletions(-)
- Log -----------------------------------------------------------------
commit d65a2857d8b7d6df09e67b2d3897fde3eb46dd1a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Dec 29 11:46:22 2014 -0500
Typo fix
diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index b613680..4d98064 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -659,7 +659,7 @@ sub encrypt( $% ) {
sub encrypt_symmetrically( $% ) {
my ( $self, %args ) = @_;
- # Strip the homedir and put it back after encrpyting; gpg 2.0.x
+ # Strip the homedir and put it back after encrypting; gpg 2.0.x
# fails symmetric encryption when one is passed.
my $homedir = $self->options->homedir;
$self->options->clear_homedir;
commit bb83ea915fc5389f29f9c4ef413df4b5ff6c34ce
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Dec 29 11:50:10 2014 -0500
Skip keygrip records, now generated by GPG 2.1.x
diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 4d98064..7f69294 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -595,7 +595,7 @@ sub get_keys {
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' ) {
+ elsif ( $record_type ne 'tru' and $record_type ne 'grp' ) {
warn "unknown record type $record_type";
}
}
commit 15a6dec34e91f62e3f2434c068e269d2edf87484
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Feb 16 20:02:42 2015 -0500
Add explicit Fatal dependency, for RedHat
Though Fatal is part of core, RedHat's perl does not ship with it, and
thus installing GnuPG::Interface fails. Provide the explicit
dependency.
diff --git a/Makefile.PL b/Makefile.PL
index 3185540..38aca27 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -21,6 +21,7 @@ requires 'Moo' => '0.091011';
requires 'MooX::HandlesVia' => '0.001004';
requires 'MooX::late' => '0.014';
requires 'Math::BigInt' => '1.78';
+requires 'Fatal';
license 'perl';
commit 93e0ca46ac32b5a9a867d7add79b186d489eebc4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Feb 16 20:27:14 2015 -0500
Whitespace cleanup tests
diff --git a/t/MyTest.pm b/t/MyTest.pm
index 4c6efa6..235d729 100644
--- a/t/MyTest.pm
+++ b/t/MyTest.pm
@@ -33,9 +33,9 @@ my $counter = 0;
sub TEST ( & )
{
my ( $code ) = @_;
-
+
$counter++;
-
+
&$code or print "not ";
print "ok $counter\n";
}
@@ -45,17 +45,17 @@ 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*/;
+ $tests++
+ if /^\s*TEST\s*/;
}
-
+
return $tests;
}
diff --git a/t/MyTestSpecific.pm b/t/MyTestSpecific.pm
index 7894ccc..053b749 100644
--- a/t/MyTestSpecific.pm
+++ b/t/MyTestSpecific.pm
@@ -27,25 +27,25 @@ use GnuPG::Interface;
use GnuPG::Handles;
use vars qw( @ISA @EXPORT
- $stdin $stdout $stderr
- $gpg_program $handles $gnupg
- %texts
- );
+ $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_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,
- );
+ armor => 1,
+ meta_interactive => 0,
+ meta_signing_key_id => '0xF950DA9C',
+ always_trust => 1,
+ );
struct( Text => { fn => "\$", fh => "\$", data => "\$" } );
@@ -78,30 +78,30 @@ sub reset_handles
{
foreach ( $stdin, $stdout, $stderr )
{
- $_ = IO::Handle->new();
+ $_ = IO::Handle->new();
}
-
+
$handles = GnuPG::Handles->new
( stdin => $stdin,
- stdout => $stdout,
- stderr => $stderr
+ 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{$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 );
+ my $entry = $texts{temp};
+ my $filename = $entry->fn();
+ my $fh = IO::File->new( $filename, 'w' )
+ or die "cannot open $filename: $ERRNO";
+ $entry->fh( $fh );
}
}
@@ -110,15 +110,15 @@ sub reset_handles
sub file_match
{
my ( $orig, @compares ) = @_;
-
+
my $found_match = 0;
-
+
foreach my $file ( @compares )
{
- return 1
- if compare( $file, $orig ) == 0;
+ return 1
+ if compare( $file, $orig ) == 0;
}
-
+
return 0;
}
diff --git a/t/clearsign.t b/t/clearsign.t
index cc47b4f..8f27ebc 100644
--- a/t/clearsign.t
+++ b/t/clearsign.t
@@ -13,13 +13,13 @@ 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;
};
@@ -27,12 +27,12 @@ TEST
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;
};
diff --git a/t/decrypt.t b/t/decrypt.t
index 9a10e8a..b2639ed 100644
--- a/t/decrypt.t
+++ b/t/decrypt.t
@@ -16,22 +16,22 @@ 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;
};
@@ -39,17 +39,17 @@ TEST
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;
};
diff --git a/t/detach_sign.t b/t/detach_sign.t
index 5011394..f3bde63 100644
--- a/t/detach_sign.t
+++ b/t/detach_sign.t
@@ -13,13 +13,13 @@ 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;
};
@@ -27,12 +27,12 @@ TEST
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;
};
diff --git a/t/encrypt.t b/t/encrypt.t
index 0c26e7c..ffb7e81 100644
--- a/t/encrypt.t
+++ b/t/encrypt.t
@@ -13,17 +13,17 @@ 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;
};
@@ -31,18 +31,18 @@ TEST
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;
};
@@ -50,16 +50,16 @@ TEST
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;
};
diff --git a/t/encrypt_symmetrically.t b/t/encrypt_symmetrically.t
index eeaea57..61535ac 100644
--- a/t/encrypt_symmetrically.t
+++ b/t/encrypt_symmetrically.t
@@ -13,13 +13,13 @@ 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;
};
@@ -28,12 +28,12 @@ TEST
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;
};
diff --git a/t/export_keys.t b/t/export_keys.t
index faab50b..cf5c82b 100644
--- a/t/export_keys.t
+++ b/t/export_keys.t
@@ -13,12 +13,12 @@ use MyTestSpecific;
TEST
{
reset_handles();
-
+
my $pid = $gnupg->export_keys( handles => $handles,
- command_args => '0xF950DA9C' );
+ command_args => '0xF950DA9C' );
close $stdin;
waitpid $pid, 0;
-
+
return $CHILD_ERROR == 0;
};
@@ -26,12 +26,12 @@ TEST
TEST
{
reset_handles();
-
+
$handles->stdout( $texts{temp}->fh() );
$handles->options( 'stdout' )->{direct} = 1;
-
+
my $pid = $gnupg->export_keys( handles => $handles,
- command_args => '0xF950DA9C' );
+ command_args => '0xF950DA9C' );
waitpid $pid, 0;
return $CHILD_ERROR == 0;
};
diff --git a/t/get_public_keys.t b/t/get_public_keys.t
index 38661b7..53db021 100644
--- a/t/get_public_keys.t
+++ b/t/get_public_keys.t
@@ -18,11 +18,11 @@ 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 = [
@@ -35,24 +35,24 @@ TEST
Math::BigInt->from_hex('0x'.
'80DE04C85E30C9D62C13F90CFF927A84A5A59D0900B3533D4D6193FEF8C5DAEF9FF8A7D5F76B244FBC17644F50D524E0B19CD3A4B5FC2D78DAECA3FE58FA1C1A64E6C7B96C4EE618173543163A72EF954DFD593E84342699096E9CA76578AC1DE3D893BCCD0BF470CEF625FAF816A0F503EF75C18C6173E35C8675AF919E5704')
];
-
+
$handmade_key = GnuPG::PrimaryKey->new
( length => 1024,
- algo_num => 17,
- hex_id => '53AE596EF950DA9C',
+ algo_num => 17,
+ hex_id => '53AE596EF950DA9C',
creation_date => 949813093,
- creation_date_string => '2000-02-06',
- owner_trust => '-',
+ 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',
- )
+ '93AFC4B1B0288A104996B44253AE596EF950DA9C',
+ )
);
-
+
my $uid0 = GnuPG::UserId->new( as_string => 'GnuPG test key (for testing purposes only)',
validity => '-');
@@ -123,14 +123,14 @@ TEST
my $subkey_signature = GnuPG::Signature->new
( validity => '!',
algo_num => 17,
- hex_id => '53AE596EF950DA9C',
+ hex_id => '53AE596EF950DA9C',
date => 1177086380,
- date_string => '2007-04-20',
+ 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,
@@ -138,33 +138,33 @@ TEST
date => 953179891,
date_string => '2000-03-16',
);
-
+
my $ftobin_signature = GnuPG::Signature->new
( validity => '!',
algo_num => 17,
- hex_id => '56FFD10A260C4FA3',
+ hex_id => '56FFD10A260C4FA3',
date => 953180097,
- date_string => '2000-03-16',
- );
-
+ date_string => '2000-03-16',
+ );
+
my $designated_revoker_sig = GnuPG::Signature->new
( validity => '!',
algo_num => 17,
- hex_id => '53AE596EF950DA9C',
+ hex_id => '53AE596EF950DA9C',
date => 978325209,
- date_string => '2001-01-01',
+ 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 =>
+ fingerprint => GnuPG::Fingerprint->new( as_hex_string =>
'4F863BBBA8166F0A340F600356FFD10A260C4FA3'),
- );
+ );
$revoker->push_signatures($designated_revoker_sig);
-
+
my $subkey_pub_data = [
Math::BigInt->from_hex('0x'.
'8831982DADC4C5D05CBB01D9EAF612131DDC9C24CEA7246557679423FB0BA42F74D10D8E7F5564F6A4FB8837F8DC4A46571C19B122E6DF4B443D15197A6A22688863D0685FADB6E402316DAA9B560D1F915475364580A67E6DF0A727778A5CF3'),
@@ -176,27 +176,27 @@ TEST
my $subkey = GnuPG::SubKey->new
( validity => 'u',
- length => 768,
- algo_num => 16,
- hex_id => 'ADB99D9C2E854A6B',
+ length => 768,
+ algo_num => 16,
+ hex_id => 'ADB99D9C2E854A6B',
creation_date => 949813119,
- creation_date_string => '2000-02-06',
+ creation_date_string => '2000-02-06',
usage_flags => 'e',
pubkey_data => $subkey_pub_data,
);
-
+
$subkey->fingerprint
( GnuPG::Fingerprint->new( as_hex_string =>
- '7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B'
- )
+ '7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B'
+ )
);
-
+
$subkey->push_signatures( $subkey_signature );
-
+
$handmade_key->push_subkeys( $subkey );
$handmade_key->push_revokers( $revoker );
-
+
$handmade_key->compare( $given_key );
};
@@ -204,19 +204,19 @@ 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 );
};
diff --git a/t/get_secret_keys.t b/t/get_secret_keys.t
index acfeaa2..3a1d99f 100644
--- a/t/get_secret_keys.t
+++ b/t/get_secret_keys.t
@@ -17,27 +17,27 @@ 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',
+ algo_num => 17,
+ hex_id => '53AE596EF950DA9C',
creation_date => 949813093,
- creation_date_string => '2000-02-06',
- owner_trust => '', # secret keys do not report ownertrust?
+ 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',
- )
+ ( GnuPG::Fingerprint->new( as_hex_string =>
+ '93AFC4B1B0288A104996B44253AE596EF950DA9C',
+ )
);
$handmade_key->push_user_ids(
@@ -49,22 +49,22 @@ TEST
my $subkey = GnuPG::SubKey->new
( validity => 'u',
- length => 768,
- algo_num => 16,
- hex_id => 'ADB99D9C2E854A6B',
+ length => 768,
+ algo_num => 16,
+ hex_id => 'ADB99D9C2E854A6B',
creation_date => 949813119,
- creation_date_string => '2000-02-06',
+ creation_date_string => '2000-02-06',
usage_flags => 'e',
);
-
+
$subkey->fingerprint
( GnuPG::Fingerprint->new( as_hex_string =>
- '7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B',
- )
+ '7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B',
+ )
);
-
+
$handmade_key->push_subkeys( $subkey );
-
+
$handmade_key->compare( $given_key );
};
diff --git a/t/import_keys.t b/t/import_keys.t
index 17ae665..dc4a5a2 100644
--- a/t/import_keys.t
+++ b/t/import_keys.t
@@ -13,14 +13,14 @@ 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;
};
@@ -28,12 +28,12 @@ TEST
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;
};
diff --git a/t/list_public_keys.t b/t/list_public_keys.t
index 8232df9..7e563c1 100644
--- a/t/list_public_keys.t
+++ b/t/list_public_keys.t
@@ -16,19 +16,19 @@ 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;
};
@@ -36,21 +36,21 @@ TEST
TEST
{
reset_handles();
-
+
my $pid = $gnupg->list_public_keys( handles => $handles,
- ommand_args => '0xF950DA9C'
- );
+ 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;
};
@@ -59,18 +59,18 @@ TEST
TEST
{
reset_handles();
-
+
$handles->stdout( $texts{temp}->fh() );
$handles->options( 'stdout' )->{direct} = 1;
-
+
my $pid = $gnupg->list_public_keys( handles => $handles,
- command_args => '0xF950DA9C',
- );
-
+ command_args => '0xF950DA9C',
+ );
+
waitpid $pid, 0;
-
+
$outfile = $texts{temp}->fn();
-
+
return $CHILD_ERROR == 0;
};
diff --git a/t/list_secret_keys.t b/t/list_secret_keys.t
index bcb722d..1fe9b7e 100644
--- a/t/list_secret_keys.t
+++ b/t/list_secret_keys.t
@@ -15,10 +15,10 @@ 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";
@@ -26,7 +26,7 @@ TEST
close $stdout;
$out->close();
waitpid $pid, 0;
-
+
return $CHILD_ERROR == 0;
};
@@ -42,38 +42,38 @@ TEST
TEST
{
reset_handles();
-
+
my $pid = $gnupg->list_secret_keys( handles => $handles,
- command_args => '0xF950DA9C' );
+ 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' );
-
+ command_args => '0xF950DA9C' );
+
waitpid $pid, 0;
-
+
$outfile = $texts{temp}->fn();
-
+
return $CHILD_ERROR == 0;
};
diff --git a/t/list_sigs.t b/t/list_sigs.t
index 9f4bb4e..16cfa6a 100644
--- a/t/list_sigs.t
+++ b/t/list_sigs.t
@@ -14,19 +14,19 @@ 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;
};
@@ -34,12 +34,12 @@ TEST
TEST
{
reset_handles();
-
+
my $pid = $gnupg->list_sigs( handles => $handles,
- command_args => '0xF950DA9C',
- );
+ 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";
@@ -47,7 +47,7 @@ TEST
close $stdout;
$out->close();
waitpid $pid, 0;
-
+
return $CHILD_ERROR == 0;
};
@@ -55,17 +55,17 @@ TEST
TEST
{
reset_handles();
-
+
$handles->stdout( $texts{temp}->fh() );
$handles->options( 'stdout' )->{direct} = 1;
-
+
my $pid = $gnupg->list_sigs( handles => $handles,
- command_args => '0xF950DA9C',
- );
-
+ command_args => '0xF950DA9C',
+ );
+
waitpid $pid, 0;
-
+
$outfile = $texts{temp}->fn();
-
+
return $CHILD_ERROR == 0;
};
diff --git a/t/passphrase_handling.t b/t/passphrase_handling.t
index d96a709..bfd0695 100644
--- a/t/passphrase_handling.t
+++ b/t/passphrase_handling.t
@@ -20,22 +20,22 @@ TEST
$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;
};
@@ -47,16 +47,16 @@ 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;
};
diff --git a/t/sign.t b/t/sign.t
index 4404dbe..c854378 100644
--- a/t/sign.t
+++ b/t/sign.t
@@ -13,13 +13,13 @@ 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;
};
@@ -27,12 +27,12 @@ TEST
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;
};
diff --git a/t/sign_and_encrypt.t b/t/sign_and_encrypt.t
index f31a481..5dc1c08 100644
--- a/t/sign_and_encrypt.t
+++ b/t/sign_and_encrypt.t
@@ -13,14 +13,14 @@ 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;
};
@@ -28,12 +28,12 @@ TEST
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;
};
diff --git a/t/verify.t b/t/verify.t
index 1929be9..bd5d0be 100644
--- a/t/verify.t
+++ b/t/verify.t
@@ -13,13 +13,13 @@ 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;
};
@@ -27,13 +27,13 @@ TEST
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;
};
diff --git a/t/wrap_call.t b/t/wrap_call.t
index 22b074c..8677d54 100644
--- a/t/wrap_call.t
+++ b/t/wrap_call.t
@@ -12,21 +12,21 @@ use MyTestSpecific;
TEST
{
reset_handles();
-
+
my $pid = $gnupg->wrap_call
( commands => [ qw( --list-packets ) ],
- command_args => [ qw( test/key.1.asc ) ],
- handles => $handles,
+ 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;
@@ -37,20 +37,20 @@ TEST
TEST
{
reset_handles();
-
+
my $pid = $gnupg->wrap_call
( gnupg_commands => [ qw( --list-packets ) ],
- gnupg_command_args => [ qw( test/key.1.asc ) ],
- handles => $handles,
+ 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
commit 9663bc78276c002fc23c6c480482a84a864eb7e7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Feb 16 20:42:20 2015 -0500
Ensure that the trustdb is created before attempting to encrypt
gpg2 requires that $GNUPGHOME/trustdb.gpg exist, even for commands with
--trust-model=always which need not interact with the trust database.
gpg 1.4 does not have this restriction, and a fix for the gpg2 bug will
appear in 2.0.26; see [1].
This shows up as a test failure if using gpg2, but is also dependent on
test ordering; most other tests result in the creation of the trustdb
implicitly. Unfortunately, as the format of the trustdb depends on the
version, it cannot simply be shipped as part of the distribution.
Explicitly create the trustdb before the one test that is susceptible to
the above gpg2 bug; all other tests currently deal gracefully with the
lack of a trustdb.
[1] http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commitdiff;h=07006c99
diff --git a/t/encrypt.t b/t/encrypt.t
index ffb7e81..3183ac4 100644
--- a/t/encrypt.t
+++ b/t/encrypt.t
@@ -13,6 +13,17 @@ use MyTestSpecific;
TEST
{
reset_handles();
+ my $pid = $gnupg->wrap_call(
+ handles => $handles,
+ commands => ['--update-trustdb'],
+ );
+ waitpid $pid, 0;
+ return $CHILD_ERROR == 0;
+};
+
+TEST
+{
+ reset_handles();
$gnupg->options->clear_recipients();
$gnupg->options->clear_meta_recipients_keys();
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list