1Mail::DKIM::DkSignatureU(s3e)r Contributed Perl DocumentaMtaiioln::DKIM::DkSignature(3)
2
3
4
6 Mail::DKIM::DkSignature - represents a DomainKeys-Signature header
7
9 version 1.20200907
10
12 new()
13 Create a new DomainKey signature from parameters
14
15 my $signature = Mail::DKIM::DkSignature->new(
16 [ Algorithm => 'rsa-sha1', ]
17 [ Signature => $base64, ]
18 [ Method => 'simple', ]
19 [ Domain => 'example.org', ]
20 [ Headers => 'from:subject:date:message-id', ]
21 [ Query => 'dns', ]
22 [ Selector => 'alpha', ]
23 [ Key => $private_key, ]
24 );
25
26 parse()
27 Create a new signature from a DomainKey-Signature header
28
29 my $sig = Mail::DKIM::DkSignature->parse(
30 'DomainKey-Signature: a=rsa-sha1; b=yluiJ7+0=; c=nofws'
31 );
32
33 Constructs a signature by parsing the provided DomainKey-Signature
34 header content. You do not have to include the header name (i.e.
35 "DomainKey-Signature:") but it is recommended, so the header name can
36 be preserved and returned the same way in "as_string()".
37
38 Note: The input to this constructor is in the same format as the output
39 of the as_string method.
40
42 as_string()
43 Convert the signature header as a string.
44
45 print $signature->as_string . "\n";
46
47 outputs
48
49 DomainKey-Signature: a=rsa-sha1; b=yluiJ7+0=; c=nofws
50
51 As shown in the example, the as_string method can be used to generate
52 the DomainKey-Signature that gets prepended to a signed message.
53
54 algorithm()
55 Get or set the algorithm (a=) field
56
57 The algorithm used to generate the signature. Defaults to "rsa-sha1",
58 an RSA-signed SHA-1 digest.
59
60 canonicalization()
61 Get or set the canonicalization (c=) field.
62
63 $signature->canonicalization('nofws');
64 $signature->canonicalization('simple');
65
66 $method = $signature->canonicalization;
67
68 Message canonicalization (default is "simple"). This informs the
69 verifier of the type of canonicalization used to prepare the message
70 for signing.
71
72 domain()
73 Get or set the domain (d=) field.
74
75 my $d = $signature->domain; # gets the domain value
76 $signature->domain('example.org'); # sets the domain value
77
78 The domain of the signing entity, as specified in the signature. This
79 is the domain that will be queried for the public key.
80
81 headerlist()
82 Get or set the signed header fields (h=) field.
83
84 $signature->headerlist('a:b:c');
85
86 my $headerlist = $signature->headerlist;
87
88 my @headers = $signature->headerlist;
89
90 Signed header fields. A colon-separated list of header field names that
91 identify the header fields presented to the signing algorithm.
92
93 In scalar context, the list of header field names will be returned as a
94 single string, with the names joined together with colons. In list
95 context, the header field names will be returned as a list.
96
97 identity()
98 Get the signing identity.
99
100 my $i = $signature->identity;
101
102 In DomainKey signatures, the signing identity is the first address
103 found in the Sender header or the From header. This field is populated
104 by the Verifier when processing a DomainKey signature.
105
106 identity_source()
107 Determine which header had the identity.
108
109 my $source = $signature->identity_source;
110
111 If the message is being verified, this method will tell you which of
112 the message headers was used to determine the signature identity.
113 Possible values are "header.sender" and "header.from".
114
115 protocol()
116 Get or set the query methods (q=) field.
117
118 A colon-separated list of query methods used to retrieve the public key
119 (default is "dns").
120
121 selector()
122 Get or set the selector (s=) field.
123
124 The selector subdivides the namespace for the "d=" (domain) tag.
125
126 signature()
127 Get or set the signature data (b=) field.
128
129 The signature data. Whitespace is automatically stripped from the
130 returned value.
131
133 Mail::DKIM::Signature for DKIM-Signature headers
134
136 • Jason Long <jason@long.name>
137
138 • Marc Bradshaw <marc@marcbradshaw.net>
139
140 • Bron Gondwana <brong@fastmailteam.com> (ARC)
141
143 Work on ensuring that this module passes the ARC test suite was
144 generously sponsored by Valimail (https://www.valimail.com/)
145
147 • Copyright (C) 2013 by Messiah College
148
149 • Copyright (C) 2010 by Jason Long
150
151 • Copyright (C) 2017 by Standcore LLC
152
153 • Copyright (C) 2020 by FastMail Pty Ltd
154
155 This library is free software; you can redistribute it and/or modify it
156 under the same terms as Perl itself, either Perl version 5.8.6 or, at
157 your option, any later version of Perl 5 you may have available.
158
159
160
161perl v5.32.1 2021-01-27 Mail::DKIM::DkSignature(3)