summaryrefslogtreecommitdiff
path: root/t/passphrase_handling.t
diff options
context:
space:
mode:
authorAndrew Ruthven <andrew@etc.gen.nz>2021-08-18 04:12:35 +0200
committerAndrew Ruthven <andrew@etc.gen.nz>2021-08-18 04:12:35 +0200
commit136c25e277302900abd4ea997ce28721c59b5676 (patch)
tree7f2461afd6381e23d4990d7501c8872eb5d40a0f /t/passphrase_handling.t
Import libgnupg-interface-perl_1.02.orig.tar.gz
[dgit import orig libgnupg-interface-perl_1.02.orig.tar.gz]
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;
+};