README
1NAME
2 Mail::OpenDKIM - Provides an interface to libOpenDKIM
3
4SYNOPSIS
5 # sign outgoing message
6
7 use Mail::DKIM::Signer;
8
9 # create a signer object
10 my $dkim = Mail::OpenDKIM::Signer->new(
11 Algorithm => 'rsa-sha1',
12 Method => 'relaxed',
13 Domain => 'example.org',
14 Selector => 'selector1',
15 KeyFile => 'private.key',
16 );
17
18 # read an email and pass it into the signer, one line at a time
19 while(<STDIN>) {
20 # remove local line terminators
21 chomp;
22 s/\015$//;
23
24 # use SMTP line terminators
25 $dkim->PRINT("$_\015\012");
26 }
27 $dkim->CLOSE();
28
29 # what is the signature result?
30 my $signature = $dkim->signature;
31 print $signature->as_string;
32
33 # check validity of incoming message
34 my $o = Mail::OpenDKIM->new();
35 $o->dkim_init();
36
37 my $d = $o->dkim_verify({
38 id => 'MLM',
39 });
40
41 $msg =~ s/\n/\r\n/g;
42
43 $d->dkim_chunk({ chunkp => $msg, len => length($msg) });
44
45 $d->dkim_chunk({ chunkp => '', len => 0 });
46
47 $d->dkim_eom();
48
49 my $sig = $d->dkim_getsignature();
50
51 $d->dkim_sig_process({ sig => $sig });
52
53 printf "0x\n", $d->dkim_sig_getflags({ sig => $sig });
54
55 $d->dkim_free();
56
57 $o->dkim_close();
58
59DESCRIPTION
60 Mail::OpenDKIM, coupled with Mail::OpenDKIM::DKIM, provides a means of
61 calling libOpenDKIM from Perl. Mail::OpenDKIM implements those routine
62 taking a DKIM_LIB argument; those taking a DKIM argument have been
63 implemented in Mail::OpenDKIM::DKIM.
64
65 Mail::OpenDKIM::Signer provides a drop in replacement for the signature
66 process provided by Mail::DKIM::Signer.
67
68 When an error is encountered, an Error::Simple object is thrown.
69
70SUBROUTINES/METHODS
71 new
72 Create a new signing/verifying object. After doing this you will need to
73 call the dkim_init method before you can do much else.
74
75 dkim_init
76 For further information, refer to http://www.opendkim.org/libopendkim/
77
78 dkim_close
79 For further information, refer to http://www.opendkim.org/libopendkim/
80
81 dkim_flush_cache
82 For further information, refer to http://www.opendkim.org/libopendkim/
83
84 dkim_libfeature
85 For further information, refer to http://www.opendkim.org/libopendkim/
86
87 dkim_sign
88 For further information, refer to http://www.opendkim.org/libopendkim/
89
90 Returns a Mail::OpenDKIM::DKIM object.
91
92 dkim_verify
93 For further information, refer to http://www.opendkim.org/libopendkim/
94
95 Returns a Mail::OpenDKIM::DKIM object. The memclosure argument is
96 ignored.
97
98 dkim_getcachestats
99 For further information, refer to http://www.opendkim.org/libopendkim/
100
101 dkim_set_dns_callback
102 For further information, refer to http://www.opendkim.org/libopendkim/
103
104 dkim_set_key_lookup
105 For further information, refer to http://www.opendkim.org/libopendkim/
106
107 dkim_set_signature_handle
108 For further information, refer to http://www.opendkim.org/libopendkim/
109
110 dkim_set_signature_handle_free
111 For further information, refer to http://www.opendkim.org/libopendkim/
112
113 dkim_set_signature_tagvalues
114 For further information, refer to http://www.opendkim.org/libopendkim/
115
116 dkim_dns_set_query_cancel
117 For further information, refer to http://www.opendkim.org/libopendkim/
118
119 dkim_dns_set_query_service
120 For further information, refer to http://www.opendkim.org/libopendkim/
121
122 dkim_dns_set_query_start
123 For further information, refer to http://www.opendkim.org/libopendkim/
124
125 dkim_dns_set_query_waitreply
126 For further information, refer to http://www.opendkim.org/libopendkim/
127
128 dkim_options
129 For further information, refer to http://www.opendkim.org/libopendkim/
130
131 dkim_libversion
132 Static method.
133
134 dkim_ssl_version
135 Static method.
136
137 dkim_getcachestats
138 Static method.
139
140 dkim_getresultstr
141 Calls C routine of same name.
142
143 dkim_sig_geterrorstr
144 Calls C routine of same name.
145
146 dkim_mail_parse
147 Calls C routine of same name.
148
149EXPORT
150 Many DKIM_* constants, e.g. DKIM_STAT_OK are exported.
151
152SEE ALSO
153 Mail::DKIM
154
155 http://www.opendkim.org/libopendkim/
156
157 RFC 4870, RFC 4871
158
159REPOSITORY
160 <https://github.com/infracaninophile/Mail-OpenDKIM.git>
161
162DEPENDENCIES
163 This module requires these other modules and libraries:
164
165 Test::More
166 libOpenDKIM 2.10 (http://www.opendkim.org/libopendkim/)
167 C compiler
168
169NOTES
170 Tested against libOpenDKIM 2.10.3.
171
172 Only portions of Mail::DKIM::Signer interface, and the support for it,
173 have been implemented.
174
175 Please report any bugs or feature requests to "bug-mail-opendkim at
176 rt.cpan.org", or through the web interface at
177 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mail-OpenDKIM>. I will
178 be notified, and then you'll automatically be notified of progress on
179 your bug as I make changes.
180
181 The signature creation rountines have been tested more thoroughly than
182 the signature verification routines.
183
184 Feedback will be greatfully received.
185
186AUTHOR
187 Nigel Horne
188
189 Vick Khera, "<vivek at khera.org>"
190
191 Matthew Seaman, "<m.seaman@infracaninophile.co.uk>"
192
193SUPPORT
194 You can find documentation for this module with the perldoc command.
195
196 perldoc Mail::OpenDKIM
197
198 You can also look for information at:
199
200 * MailerMailer Project page
201
202 <http://www.mailermailer.com/labs/projects/Mail-OpenDKIM.rwp>
203
204 * RT: CPAN's request tracker
205
206 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mail-OpenDKIM>
207
208 * AnnoCPAN: Annotated CPAN documentation
209
210 <http://annocpan.org/dist/Mail-OpenDKIM>
211
212 * CPAN Ratings
213
214 <http://cpanratings.perl.org/d/Mail-OpenDKIM>
215
216 * Search CPAN
217
218 <http://search.cpan.org/dist/Mail-OpenDKIM/>
219
220SPONSOR
221 This code has been developed under sponsorship of MailerMailer LLC,
222 http://www.mailermailer.com/
223
224COPYRIGHT AND LICENCE
225 This module is Copyright 2014 Khera Communications, Inc. Copyright 2015
226 Matthew Seaman It is licensed under the same terms as Perl itself.
227
228