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 A "signer policy" is an object, class, or function used by
10 Mail::DKIM::Signer to determine what signatures to add to the current
11 message. To take advantage of signer policies, create your own Perl
12 class that extends the Mail::DKIM::SignerPolicy class. The only method
13 you need to implement is the apply() method.
14
15 The apply() method takes as a parameter the Mail::DKIM::Signer object.
16 Using this object, it can determine some properties of the message
17 (e.g. what the From: address or Sender: address is). Then it sets
18 various signer properties as desired. The apply() method should return
19 a nonzero value if the message should be signed. If a false value is
20 returned, then the message is "skipped" (i.e. not signed).
21
22 Here is an example of a policy that always returns the same values:
23
24 package MySignerPolicy;
25 use base 'Mail::DKIM::SignerPolicy';
26
27 sub apply
28 {
29 my $self = shift;
30 my $signer = shift;
31
32 $signer->algorithm('rsa-sha1');
33 $signer->method('relaxed');
34 $signer->domain('example.org');
35 $signer->selector('selector1');
36 $signer->key_file('private.key');
37
38 return 1;
39 }
40
41 To use this policy, simply specify the name of the class as the Policy
42 parameter...
43
44 my $dkim = Mail::DKIM::Signer->new(
45 Policy => 'MySignerPolicy',
46 );
47
49 You can also have the policy actually build the signature for the
50 Signer to use. To do this, call the signer's add_signature() method
51 from within your apply() callback. E.g.,
52
53 sub apply
54 {
55 my $self = shift;
56 my $signer = shift;
57
58 $signer->add_signature(
59 new Mail::DKIM::Signature(
60 Algorithm => $signer->algorithm,
61 Method => $signer->method,
62 Headers => $signer->headers,
63 Domain => $signer->domain,
64 Selector => $signer->selector,
65 ));
66 return;
67 }
68
69 Again, if you do not want any signatures, return zero or undef. If you
70 use add_signature() to create a signature, the default signature will
71 not be created, even if you return nonzero.
72
74 Jason Long, <jlong@messiah.edu>
75
77 Copyright (C) 2006-2007 by Messiah College
78
79 This library is free software; you can redistribute it and/or modify it
80 under the same terms as Perl itself, either Perl version 5.8.6 or, at
81 your option, any later version of Perl 5 you may have available.
82
83
84
85perl v5.30.0 2019-07-26 Mail::DKIM::SignerPolicy(3)