1Mail::DKIM::SignerPolicUys(e3r)Contributed Perl DocumentMaatiilo:n:DKIM::SignerPolicy(3)
2
3
4
6 Mail::DKIM::SignerPolicy - determines signing parameters for a message
7
9 version 1.20200907
10
12 A "signer policy" is an object, class, or function used by
13 Mail::DKIM::Signer to determine what signatures to add to the current
14 message. To take advantage of signer policies, create your own Perl
15 class that extends the Mail::DKIM::SignerPolicy class. The only method
16 you need to implement is the apply() method.
17
18 The apply() method takes as a parameter the Mail::DKIM::Signer object.
19 Using this object, it can determine some properties of the message
20 (e.g. what the From: address or Sender: address is). Then it sets
21 various signer properties as desired. The apply() method should return
22 a nonzero value if the message should be signed. If a false value is
23 returned, then the message is "skipped" (i.e. not signed).
24
25 Here is an example of a policy that always returns the same values:
26
27 package MySignerPolicy;
28 use base 'Mail::DKIM::SignerPolicy';
29
30 sub apply
31 {
32 my $self = shift;
33 my $signer = shift;
34
35 $signer->algorithm('rsa-sha1');
36 $signer->method('relaxed');
37 $signer->domain('example.org');
38 $signer->selector('selector1');
39 $signer->key_file('private.key');
40
41 return 1;
42 }
43
44 To use this policy, simply specify the name of the class as the Policy
45 parameter...
46
47 my $dkim = Mail::DKIM::Signer->new(
48 Policy => 'MySignerPolicy',
49 );
50
52 You can also have the policy actually build the signature for the
53 Signer to use. To do this, call the signer's add_signature() method
54 from within your apply() callback. E.g.,
55
56 sub apply
57 {
58 my $self = shift;
59 my $signer = shift;
60
61 $signer->add_signature(
62 new Mail::DKIM::Signature(
63 Algorithm => $signer->algorithm,
64 Method => $signer->method,
65 Headers => $signer->headers,
66 Domain => $signer->domain,
67 Selector => $signer->selector,
68 ));
69 return;
70 }
71
72 Again, if you do not want any signatures, return zero or undef. If you
73 use add_signature() to create a signature, the default signature will
74 not be created, even if you return nonzero.
75
77 • Jason Long <jason@long.name>
78
79 • Marc Bradshaw <marc@marcbradshaw.net>
80
81 • Bron Gondwana <brong@fastmailteam.com> (ARC)
82
84 Work on ensuring that this module passes the ARC test suite was
85 generously sponsored by Valimail (https://www.valimail.com/)
86
88 • Copyright (C) 2013 by Messiah College
89
90 • Copyright (C) 2010 by Jason Long
91
92 • Copyright (C) 2017 by Standcore LLC
93
94 • Copyright (C) 2020 by FastMail Pty Ltd
95
96 This library is free software; you can redistribute it and/or modify it
97 under the same terms as Perl itself, either Perl version 5.8.6 or, at
98 your option, any later version of Perl 5 you may have available.
99
100
101
102perl v5.34.0 2021-07-22 Mail::DKIM::SignerPolicy(3)