summaryrefslogtreecommitdiff
path: root/t/passphrase_handling.t
diff options
context:
space:
mode:
Diffstat (limited to 't/passphrase_handling.t')
-rw-r--r--t/passphrase_handling.t62
1 files changed, 62 insertions, 0 deletions
diff --git a/t/passphrase_handling.t b/t/passphrase_handling.t
new file mode 100644
index 0000000..bfd0695
--- /dev/null
+++ b/t/passphrase_handling.t
@@ -0,0 +1,62 @@
+#!/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;
+};