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