forked from sympa-community/sympa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Message_smime.t
44 lines (30 loc) · 1003 Bytes
/
Message_smime.t
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
# -*- indent-tabs-mode: nil; -*-
# vim:ft=perl:et:sw=4
# $Id$
use strict;
use warnings;
use English qw(-no_match_vars);
use Test::More;
use Sympa::Log;
use Sympa::Message;
%Conf::Conf = (sender_headers => 'From',);
Sympa::Log->instance->{log_to_stderr} = 'err';
# ToDo: smime_encrypt()
# ToDo: smime_decrypt()
# ToDo: smime_sign()
# ToDo: check_smime_signature()
# is_signed()
is test_is_signed('t/samples/unsigned.eml'), 0, 'never signed';
is test_is_signed('t/samples/signed.eml'), 1, 'multipart/signed S/MIME';
#is test_is_signed('t/samples/signed-pkcs7.eml'), 1, 'PKCS#7 S/MIME';
#is test_is_signed('t/samples/signed-pgp.eml'), 0, 'multipart/signed PGP/MIME';
#is test_is_signed('t/samples/signed-pgp-inline.eml'), 0, 'PGP inline';
done_testing();
sub test_is_signed {
my $path = shift;
open my $fh, '<', $path or die $ERRNO;
my $str = do { local $RS; <$fh> };
close $fh;
my $message = Sympa::Message->new($str, context => '*');
return $message->is_signed;
}