summaryrefslogtreecommitdiff
path: root/t/encrypt.t
blob: e6bdc08994f6d12b8c5c55b3aaa89ad5a1707cca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/perl -w
#
# $Id: encrypt.t,v 1.4 2001/05/03 06:00:06 ftobin Exp $
#

use strict;
use English qw( -no_match_vars );

use lib './t';
use MyTest;
use MyTestSpecific;

TEST
{
    reset_handles();
    my $pid = $gnupg->wrap_call(
        handles => $handles,
        commands => ['--update-trustdb'],
    );
    waitpid $pid, 0;
    return $CHILD_ERROR == 0;
};

TEST
{
    reset_handles();

    $gnupg->options->clear_recipients();
    $gnupg->options->clear_meta_recipients_keys();
    $gnupg->options->push_recipients( '0x7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B' );

    my $pid = $gnupg->encrypt( handles => $handles );

    print $stdin @{ $texts{plain}->data() };
    close $stdin;
    waitpid $pid, 0;

    return $CHILD_ERROR == 0;
};


TEST
{
    reset_handles();

    my @keys = $gnupg->get_public_keys( '0x93AFC4B1B0288A104996B44253AE596EF950DA9C' );
    $gnupg->options->clear_recipients();
    $gnupg->options->clear_meta_recipients_keys();
    $gnupg->options->push_meta_recipients_keys( @keys );

    my $pid = $gnupg->encrypt( handles => $handles );

    print $stdin @{ $texts{plain}->data() };
    close $stdin;
    waitpid $pid,  0;

    return $CHILD_ERROR == 0;
};


TEST
{
    reset_handles();

    $gnupg->options->clear_recipients();
    $gnupg->options->clear_meta_recipients_keys();
    $gnupg->options->push_recipients( '0x7466B7E98C4CCB64C2CE738BADB99D9C2E854A6B' );

    $handles->stdin( $texts{plain}->fh() );
    $handles->options( 'stdin' )->{direct} = 1;
    my $pid = $gnupg->encrypt( handles => $handles );

    waitpid $pid, 0;

    return $CHILD_ERROR == 0;
};