.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::DKIM::SignerPolicy 3pm" .TH Mail::DKIM::SignerPolicy 3pm 2024-01-28 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Mail::DKIM::SignerPolicy \- determines signing parameters for a message .SH VERSION .IX Header "VERSION" version 1.20240124 .SH DESCRIPTION .IX Header "DESCRIPTION" A "signer policy" is an object, class, or function used by Mail::DKIM::Signer to determine what signatures to add to the current message. To take advantage of signer policies, create your own Perl class that extends the Mail::DKIM::SignerPolicy class. The only method you need to implement is the \fBapply()\fR method. .PP The \fBapply()\fR method takes as a parameter the Mail::DKIM::Signer object. Using this object, it can determine some properties of the message (e.g. what the From: address or Sender: address is). Then it sets various signer properties as desired. The \fBapply()\fR method should return a nonzero value if the message should be signed. If a false value is returned, then the message is "skipped" (i.e. not signed). .PP Here is an example of a policy that always returns the same values: .PP .Vb 2 \& package MySignerPolicy; \& use base \*(AqMail::DKIM::SignerPolicy\*(Aq; \& \& sub apply \& { \& my $self = shift; \& my $signer = shift; \& \& $signer\->algorithm(\*(Aqrsa\-sha1\*(Aq); \& $signer\->method(\*(Aqrelaxed\*(Aq); \& $signer\->domain(\*(Aqexample.org\*(Aq); \& $signer\->selector(\*(Aqselector1\*(Aq); \& $signer\->key_file(\*(Aqprivate.key\*(Aq); \& \& return 1; \& } .Ve .PP To use this policy, simply specify the name of the class as the Policy parameter... .PP .Vb 3 \& my $dkim = Mail::DKIM::Signer\->new( \& Policy => \*(AqMySignerPolicy\*(Aq, \& ); .Ve .SH ADVANCED .IX Header "ADVANCED" You can also have the policy actually build the signature for the Signer to use. To do this, call the signer's \fBadd_signature()\fR method from within your \fBapply()\fR callback. E.g., .PP .Vb 4 \& sub apply \& { \& my $self = shift; \& my $signer = shift; \& \& $signer\->add_signature( \& new Mail::DKIM::Signature( \& Algorithm => $signer\->algorithm, \& Method => $signer\->method, \& Headers => $signer\->headers, \& Domain => $signer\->domain, \& Selector => $signer\->selector, \& )); \& return; \& } .Ve .PP Again, if you do not want any signatures, return zero or undef. If you use \fBadd_signature()\fR to create a signature, the default signature will not be created, even if you return nonzero. .SH AUTHORS .IX Header "AUTHORS" .IP \(bu 4 Jason Long .IP \(bu 4 Marc Bradshaw .IP \(bu 4 Bron Gondwana (ARC) .SH THANKS .IX Header "THANKS" Work on ensuring that this module passes the ARC test suite was generously sponsored by Valimail (https://www.valimail.com/) .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" .IP \(bu 4 Copyright (C) 2013 by Messiah College .IP \(bu 4 Copyright (C) 2010 by Jason Long .IP \(bu 4 Copyright (C) 2017 by Standcore LLC .IP \(bu 4 Copyright (C) 2020 by FastMail Pty Ltd .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.