summaryrefslogtreecommitdiffstats
path: root/t/901-secure-mail-loop.t
blob: bfecb82c74343dc407fcb60e711b8820697fbdde (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
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
use strict;
use warnings;
use 5.10.1;
use Test::More tests => 1;

use Crypt::OpenPGP;

my $pubring = new Crypt::OpenPGP::KeyRing(Data => PUBLIC_KEY());
my $pgp = new Crypt::OpenPGP(PubRing => $pubring);
{
    local $SIG{ALRM} = sub { fail("stuck in a loop"); exit; };
    alarm(5);
    my $encrypted = $pgp->encrypt(
        Data       => "hello, world",
        Recipients => "@",
        Cipher     => 'CAST5',
        Armour     => 0
    );
    alarm(0);
}
pass("didn't get stuck in a loop");

sub PUBLIC_KEY {
    return <<'KEY';
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.9 (GNU/Linux)

mQGiBEkjw1kRBADkcYTvXYkfcDwkYquDUU7OPsGSlF2MOQssJ+lF5MT8XdyzoVU1
eEYV/1U4IrzC6kKsjzTrZUp1ky8sVEiOiAf5SXD9EllCh+uNuYn/FO2cUvAjUcMa
KNtdwndIO7L6uNE6foQIM+lzqYTVxCTXJsDN0T4yPPlhmv4E46T67lYe1wCg3ovM
55bNNShd6oHTq6r+OuGqh8ED/2GMK4V0DL5xjKDgIwfdrCTmhBXnQS9BYy4qvuIF
xECD0t2+VFNnLNrQawXzy8JYbzPYsnkGDgilk2fIwQ31Vv7A1bIhrkw6K0Doml4R
dDUo1+5BqWCM/4UYiqeWrXoVd/pmCIf7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