This file is indexed.

/usr/share/perl5/Mail/DKIM/Signature.pm is in libmail-dkim-perl 0.39-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
#!/usr/bin/perl

# Copyright 2005-2007 Messiah College. All rights reserved.
# Jason Long <jlong@messiah.edu>

# Copyright (c) 2004 Anthony D. Urso. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.

use strict;
use warnings;

use Mail::DKIM::PublicKey;
use Mail::DKIM::Algorithm::rsa_sha1;
use Mail::DKIM::Algorithm::rsa_sha256;

package Mail::DKIM::Signature;
use base "Mail::DKIM::KeyValueList";
use Carp;

=head1 NAME

Mail::DKIM::Signature - represents a DKIM-Signature header

=head1 CONSTRUCTORS

=head2 new() - create a new signature from parameters

  my $signature = Mail::DKIM::Signature->new(
                      [ Algorithm => "rsa-sha1", ]
                      [ Signature => $base64, ]
                      [ Method => "relaxed", ]
                      [ Domain => "example.org", ]
                      [ Identity => 'user@example.org', ]
                      [ Headers => "from:subject:date:message-id", ]
                      [ Query => "dns", ]
                      [ Selector => "alpha", ]
                      [ Timestamp => time(), ]
                      [ Expiration => time() + 86400, ]
                  );

=cut

sub new
{
	my $class = shift;
	my %prms = @_;
	my $self = {};
	bless $self, $class;

	$self->version("1");
	$self->algorithm($prms{'Algorithm'} || "rsa-sha1");
	$self->signature($prms{'Signature'});
	$self->canonicalization($prms{'Method'}) if exists $prms{'Method'};
	$self->domain($prms{'Domain'});
	$self->headerlist($prms{'Headers'});
	$self->protocol($prms{'Query'}) if exists $prms{'Query'};
	$self->selector($prms{'Selector'});
	$self->identity($prms{'Identity'}) if exists $prms{'Identity'};
	$self->timestamp($prms{'Timestamp'}) if defined $prms{'Timestamp'};
	$self->expiration($prms{'Expiration'}) if defined $prms{'Expiration'};
	$self->key($prms{'Key'}) if defined $prms{'Key'};

	return $self;
}

=head2 parse() - create a new signature from a DKIM-Signature header

  my $sig = Mail::DKIM::Signature->parse(
                  "DKIM-Signature: a=rsa-sha1; b=yluiJ7+0=; c=relaxed"
            );

Constructs a signature by parsing the provided DKIM-Signature header
content. You do not have to include the header name (i.e. "DKIM-Signature:")
but it is recommended, so the header name can be preserved and returned
the same way in as_string().

Note: The input to this constructor is in the same format as the output
of the as_string method.

=cut

sub parse
{
	my $class = shift;
	croak "wrong number of arguments" unless (@_ == 1);
	my ($string) = @_;

	# remove line terminator, if present
	$string =~ s/\015\012\z//;

	# remove field name, if present
	my $prefix;
	if ($string =~ /^(dkim-signature:)(.*)/si)
	{
		# save the field name (capitalization), so that it can be
		# restored later
		$prefix = $1;
		$string = $2;
	}

	my $self = $class->SUPER::parse($string);
	$self->{prefix} = $prefix;

	return $self;
}


=head1 METHODS

=cut

# deprecated
sub wantheader {
	my $self = shift;
	my $attr = shift;

	$self->headerlist or
		return 1;
	
	foreach my $key ($self->headerlist) {
		lc $attr eq lc $key and
			return 1;
	}

	return;
}

=head2 algorithm() - get or set the algorithm (a=) field

The algorithm used to generate the signature. Should be either "rsa-sha1",
an RSA-signed SHA-1 digest, or "rsa-sha256", an RSA-signed SHA-256 digest.

See also hash_algorithm().

=cut

sub algorithm
{
	my $self = shift;

	if (@_)
	{
		$self->set_tag("a", shift);
	}

	my $a = $self->get_tag("a");
	return defined $a ? lc $a : undef;
}	

=head2 as_string() - the signature header as a string

  print $signature->as_string . "\n";

outputs

  DKIM-Signature: a=rsa-sha1; b=yluiJ7+0=; c=relaxed

As shown in the example, the as_string method can be used to generate
the DKIM-Signature that gets prepended to a signed message.

=cut

sub as_string
{
	my $self = shift;

	my $prefix = $self->{prefix} || $self->DEFAULT_PREFIX;

	return $prefix . $self->SUPER::as_string;
}

# undocumented method
sub as_string_debug
{
	my $self = shift;

	my $prefix = $self->{prefix} || $self->DEFAULT_PREFIX;

	return $prefix . join(";", map { ">" . $_->{raw} . "<" } @{$self->{tags}});
}

=head2 as_string_without_data() - signature without the signature data

  print $signature->as_string_without_data . "\n";

outputs

  DKIM-Signature: a=rsa-sha1; b=; c=relaxed

This is similar to the as_string() method, but it always excludes the "data"
part. This is used by the DKIM canonicalization methods, which require
incorporating this part of the signature into the signed message.

=cut

sub as_string_without_data
{
	my $self = shift;
	croak "wrong number of arguments" unless (@_ == 0);

	my $alt = $self->clone;
	$alt->signature("");

	return $alt->as_string;
}

=head2 body_count() - get or set the body count (l=) field

  my $i = $signature->body_count;

Informs the verifier of the number of bytes in the body of the email
included in the cryptographic hash, starting from 0 immediately
following the CRLF preceding the body. Also known as the l= tag.

When creating a signature, this tag may be either omitted, or set after
the selected canonicalization system has received the entire message
body (but before it canonicalizes the DKIM-Signature).

=cut

sub body_count
{
	my $self = shift;

	# set new body count if provided
	(@_) and
		$self->set_tag("l", shift);

	return $self->get_tag("l");
}

=head2 body_hash() - get or set the body hash (bh=) field

  my $bh = $signature->body_hash;

The hash of the body part of the message. Whitespace is ignored in this
value. This tag is required.

When accessing this value, whitespace is stripped from the tag for you.

=cut

sub body_hash
{
	my $self = shift;

	# set new body hash if provided
	(@_) and
		$self->set_tag("bh", shift);

	my $result = $self->get_tag("bh");
	if (defined $result)
	{
		$result =~ s/\s+//gs;
	}
	return $result;
}

=head2 canonicalization() - get or set the canonicalization (c=) field

  $signature->canonicalization("relaxed", "simple");

  ($header, $body) = $signature->canonicalization;

Message canonicalization (default is "simple/simple"). This informs the
verifier of the type of canonicalization used to prepare the message for
signing.

In scalar context, this returns header/body canonicalization as a single
string separated by /. In list context, it returns a two element array,
containing first the header canonicalization, then the body.

=cut

sub canonicalization
{
	my $self = shift;

	if (@_)
	{
		$self->set_tag("c", join("/", @_));
	}

	my $c = $self->get_tag("c");
	$c = lc $c  if defined $c;
	if (not $c)
	{
		$c = "simple/simple";
	}
	my ($c1, $c2) = split(/\//, $c, 2);
	if (not defined $c2)
	{
		# default body canonicalization is "simple"
		$c2 = "simple";
	}

	if (wantarray)
	{
		return ($c1, $c2);
	}
	else
	{
		return "$c1/$c2";
	}
}	

use MIME::Base64;

# checks whether this signature specifies a legal canonicalization method
# returns true if the canonicalization is acceptable, false otherwise
#
sub check_canonicalization
{
	my $self = shift;

	my ($c1, $c2) = $self->canonicalization;

	my @known = ("nowsp", "simple", "relaxed");
	return undef unless (grep { $_ eq $c1 } @known);
	return undef unless (grep { $_ eq $c2 } @known);
	return 1;
}

# checks whether the expiration time on this signature is acceptable
# returns a true value if acceptable, false otherwise
#
sub check_expiration
{
	my $self = shift;
	my $x = $self->expiration;
	return 1 if not defined $x;

	$self->{_verify_time} ||= time();
	return ($self->{_verify_time} <= $x);
}

# checks whether the protocol found on this signature is valid for
# fetching the public key
# returns a true value if protocol is "dns/txt", false otherwise
#
sub check_protocol
{
	my $self = shift;

	my ($type, $options) = split(/\//, $self->protocol, 2);
	return unless ($type eq "dns");
	return if ($options && $options ne "txt");

	my $v = $self->version;
	if ($v)
	{
		# in v=1 signatures, the /txt option is REQUIRED
		return unless ($options && $options eq "txt");
	}
	return 1;
}

# checks whether the version tag has an acceptable value
# returns true if so, otherwise false
#
sub check_version
{
	my $self = shift;

	# check version
	if (my $version = $self->version)
	{
		my @ALLOWED_VERSIONS = ("0.5", "1");
		return (grep {$_ eq $version} @ALLOWED_VERSIONS);
	}

	# we still consider a missing v= tag acceptable,
	# for backwards-compatibility
	return 1;
}

=head2 data() - get or set the signature data (b=) field

  my $base64 = $signature->data;
  $signature->data($base64);

The signature data. Whitespace is automatically stripped from the
returned value. The data is Base64-encoded.

=cut

sub data
{
	my $self = shift;

	if (@_)
	{
		$self->set_tag("b", shift);
	}

	my $b = $self->get_tag("b");
	$b =~ tr/\015\012 \t//d  if defined $b;
	return $b;
}	

*signature = \*data;

#undocumented, private function
#derived from MIME::Base64::Perl (allowed, thanks to the Perl license)
#
sub decode_qp
{
	my $res = shift;

	#TODO- should I worry about non-ASCII systems here?
	$res =~ s/=([\da-fA-F]{2})/pack("C", hex($1))/ge
		if defined $res;
	return $res;
}

#undocumented, private function
#derived from MIME::Base64::Perl (allowed, thanks to the Perl license)
#
sub encode_qp
{
	my $res = shift;

	# note- unlike MIME quoted-printable, we don't allow whitespace chars
	my $DISALLOWED = qr/[^!"#\$%&'()*+,\-.\/0-9:;<>?\@A-Z[\\\]^_`a-z{|}~]/;

	#TODO- should I worry about non-ASCII systems here?
	$res =~ s/($DISALLOWED)/sprintf('=%02X', ord($1))/eg
		if defined $res;
	return $res;
}

sub DEFAULT_PREFIX
{
	return "DKIM-Signature:";
}

=head2 domain() - get or set the domain (d=) field

  my $d = $signature->domain;          # gets the domain value
  $signature->domain("example.org");   # sets the domain value

The domain of the signing entity, as specified in the signature.
This is the domain that will be queried for the public key.

If using an "internationalized domain name", the domain name must be
converted to ASCII (following section 4.1 of RFC 3490) before passing
it to this method.

=cut

sub domain
{
	my $self = shift;

	if (@_)
	{
		$self->set_tag("d", shift);
	}

	my $d = $self->get_tag("d");
	return defined $d ? lc $d : undef;
}	

=head2 expiration() - get or set the signature expiration (x=) field

Signature expiration (default is undef, meaning no expiration).
The signature expiration, if defined, is an unsigned integer identifying
the standard Unix seconds-since-1970 time when the signature will
expire.

=cut

sub expiration
{
	my $self = shift;

	(@_) and
		$self->set_tag("x", shift);
	
	return $self->get_tag("x");
}

# allows the type of signature to determine what "algorithm" gets used
sub get_algorithm_class
{
	my $self = shift;
	croak "wrong number of arguments" unless (@_ == 1);
	my ($algorithm) = @_;

	my $class =
		$algorithm eq "rsa-sha1" ? "Mail::DKIM::Algorithm::rsa_sha1" :
		$algorithm eq "rsa-sha256" ? "Mail::DKIM::Algorithm::rsa_sha256" :
		undef;
	return $class;
}

# [private method]
# fetch_public_key() - initiate a DNS query for fetching the key
#
# This method does NOT return the public key.
# Use get_public_key() for that.
#
sub fetch_public_key
{
	my $self = shift;
	return if exists $self->{public_key_query};

	my $on_success = sub {
			if ($_[0]) {
				$self->{public} = $_[0];
			} else {
				$self->{public_error} = "not available\n";
			}
		};

	$self->{public_key_query} =
		Mail::DKIM::PublicKey->fetch_async(
			Protocol => $self->protocol,
			Selector => $self->selector,
			Domain => $self->domain,
			Callbacks => {
			Success => $on_success,
			Error => sub { $self->{public_error} = shift },
			},
			);
	return;
}

#EXPERIMENTAL
sub _refetch_public_key
{
	my $self = shift;
	if ($self->{public_key_query})
	{
		# clear the existing query by waiting for it to complete
		$self->{public_key_query}->();
	}
	delete $self->{public_key_query};
	delete $self->{public};
	delete $self->{public_error};
	$self->fetch_public_key;
}

=head2 get_public_key() - fetches the public key referenced by this signature

  my $pubkey = $signature->get_public_key;

Public key to fetch is determined by the protocol, selector, and domain
fields.

This method caches the result of the fetch, so subsequent calls will not
require additional DNS queries.

This method will C<die> if an error occurs.

=cut

sub get_public_key
{
	my $self = shift;

	# this ensures we only try fetching once, even if an error occurs
	if (not exists $self->{public_key_query})
	{
		$self->fetch_public_key;
	}

	if ($self->{public_key_query})
	{
		# wait for public key query to finish
		$self->{public_key_query}->();
		$self->{public_key_query} = 0;
	}

	if (exists $self->{public})
	{
		return $self->{public};
	}
	else
	{
		die $self->{public_error};
	}
}

=head2 get_tag() - access the raw value of a tag in this signature

  my $raw_identity = $signature->get_tag("i");

Use this method to access a tag not already supported by Mail::DKIM,
or if you want to bypass decoding of the value by Mail::DKIM.

For example, the raw i= (identity) tag is encoded in quoted-printable
form. If you use the identity() method, Mail::DKIM will decode from
quoted-printable before returning the value. But if you use
get_tag("i"), you can access the encoded quoted-printable form of
the value.

=head2 hash_algorithm() - access the hash algorithm specified in this signature

  my $hash = $signature->hash_algorithm;

Determines what hashing algorithm is used as part of the signature's
specified algorithm.

For algorithm "rsa-sha1", the hash algorithm is "sha1". Likewise, for
algorithm "rsa-sha256", the hash algorithm is "sha256". If the algorithm
is not recognized, undef is returned.

=cut

sub hash_algorithm
{
	my $self = shift;
	my $algorithm = $self->algorithm;

	return $algorithm eq "rsa-sha1" ? "sha1" :
		$algorithm eq "rsa-sha256" ? "sha256" : undef;
}

=head2 headerlist() - get or set the signed header fields (h=) field

  $signature->headerlist("a:b:c");

  my $headerlist = $signature->headerlist;

  my @headers = $signature->headerlist;

Signed header fields. A colon-separated list of header field names
that identify the header fields presented to the signing algorithm.

In scalar context, the list of header field names will be returned
as a single string, with the names joined together with colons.
In list context, the header field names will be returned as a list.

=cut

sub headerlist
{
	my $self = shift;

	(@_) and
		$self->set_tag("h", shift);

	my $h = $self->get_tag("h") || "";

	# remove whitespace next to colons
	$h =~ s/\s+:/:/g;
	$h =~ s/:\s+/:/g;
	$h = lc $h;

	if (wantarray and $h)
	{
		my @list = split /:/, $h;
		@list = map { s/^\s+|\s+$//g; $_ } @list;
		return @list;
	}
	elsif (wantarray)
	{
		return ();
	}

	return $h;
}	

=head2 identity() - get or set the signing identity (i=) field

  my $i = $signature->identity;

Identity of the user or agent on behalf of which this message is signed.
The identity has an optional local part, followed by "@", then a domain
name. The domain name should be the same as or a subdomain of the
domain returned by the C<domain> method.

Ideally, the identity should match the identity listed in the From:
header, or the Sender: header, but this is not required to have a
valid signature. Whether the identity used is "authorized" to sign
for the given message is not determined here.

If using an "internationalized domain name", the domain name must be
converted to ASCII (following section 4.1 of RFC 3490) before passing
it to this method.

Identity values are encoded in the signature in quoted-printable format.
Using this method will translate to/from quoted-printable as necessary.
If you want the raw quoted-printable version of the identity, use
$signature->get_tag("i").

=cut

sub identity
{
	my $self = shift;

	# set new identity if provided
	(@_) and
		$self->set_tag("i", encode_qp(shift));

	my $i = $self->get_tag("i");
	if (defined $i)
	{
		return decode_qp($i);
	}
	else
	{
		return '@' . $self->domain;
	}
}

sub identity_matches
{
	my $self = shift;
	my ($addr) = @_;

	my $id = $self->identity;
	if ($id =~ /^\@/)
	{
		# the identity is a domain-name only, so it only needs to match
		# the domain part of the sender address
		return (lc(substr($addr, -length($id))) eq lc($id));

		# TODO - compare the parent domains?
	}
	return lc($addr) eq lc($id);
}

=head2 key() - get or set the private key object

  my $key = $signature->key;

  $signature->key(Mail::DKIM::PrivateKey->load(File => "private.key"));

The private key is used for signing messages.
It is not used for verifying messages.

The key object can be any object that implements the
L<sign_digest()|Mail::DKIM::PrivateKey/"sign_digest()"> method.
(Providing your own object can be useful if your actual keys
are stored out-of-process.)

=cut

sub key
{
	my $self = shift;
	if (@_)
	{
		$self->{Key} = shift;
		$self->{KeyFile} = undef;
	}
	return $self->{Key};
}

=head2 method() - get or set the canonicalization (c=) field

Message canonicalization (default is "simple"). This informs the verifier
of the type of canonicalization used to prepare the message for signing.

=cut

sub method
{
	my $self = shift;

	if (@_)
	{
		$self->set_tag("c", shift);
	}

	return (lc $self->get_tag("c")) || "simple";
}	

=head2 protocol() - get or set the query methods (q=) field

A colon-separated list of query methods used to retrieve the public
key (default is "dns"). Each query method is of the form "type[/options]",
where the syntax and semantics of the options depends on the type.

=cut

sub protocol {
	my $self = shift;

	(@_) and
		$self->set_tag("q", shift);

	my $q = $self->get_tag("q");
	if (not defined $q)
	{
		return "dns/txt";
	}
	elsif ($q =~ m#/#)
	{
		return $q;
	}
	else
	{
		return "$q/";
	}
}	

=head2 result() - get or set the verification result

  my $result = $signature->result;

  $signature->result("pass");

  # to set the result with details
  $signature->result("invalid", "no public key");

=cut

sub result
{
	my $self = shift;
	@_ and $self->{verify_result} = shift;
	@_ and $self->{verify_details} = shift;
	return $self->{verify_result};
}

=head2 result_detail() - access the result, plus details if available

  my $detail = $signature->result_detail;

An explanation of possible detail messages can be found in the
documentation for L<Mail::DKIM::Verifier/result_detail()>.

=cut

sub result_detail
{
	my $self = shift;
	croak "wrong number of arguments" unless (@_ == 0);

	if ($self->{verify_result} && $self->{verify_details})
	{
		return $self->{verify_result} . " (" . $self->{verify_details} . ")";
	}
	return $self->{verify_result};
}

=head2 selector() - get or set the selector (s=) field

The selector subdivides the namespace for the "d=" (domain) tag.

=cut

sub selector {
	my $self = shift;

	(@_) and
		$self->set_tag("s", shift);

	return $self->get_tag("s");
}	

=head2 prettify() - alters the signature to look "nicer" as an email header

  $signature->prettify;

This method may alter the signature in a way that breaks signatures, so
it should be done ONLY when the signature is being generated, BEFORE being
fed to the canonicalization algorithm.

See also prettify_safe(), which will not break signatures.

=cut

sub prettify
{
	my $self = shift;
	$self->wrap(
		Start => length($self->{prefix} || $self->DEFAULT_PREFIX),
		Tags => {
			b => "b64",
			bh => "b64",
			h => "list",
			},
		);
}

=head2 prettify_safe() - same as prettify() but only touches the b= part

  $signature->prettify_safe;

This method will not break the signature, but it only affects the b= part
of the signature.

=cut

sub prettify_safe
{
	my $self = shift;
	$self->wrap(
		Start => length($self->{prefix} || $self->DEFAULT_PREFIX),
		Tags => {
			b => "b64",
			},
		PreserveNames => 1,
		Default => "preserve", #preserves unknown tags
		);
}

=head2 timestamp() - get or set the signature timestamp (t=) field

Signature timestamp (default is undef, meaning unknown creation time).
This is the time that the signature was created. The value is an unsigned
integer identifying the number of standard Unix seconds-since-1970.

=cut

sub timestamp
{
	my $self = shift;

	(@_) and
		$self->set_tag("t", shift);
	
	return $self->get_tag("t");
}

=head2 version() - get or set the DKIM specification version (v=) field

This is the version of the DKIM specification that applies to this
signature record.

=cut

sub version
{
	my $self = shift;

	(@_) and
		$self->set_tag("v", shift);

	return $self->get_tag("v");
}

=head1 SEE ALSO

L<Mail::DKIM::DkSignature> for DomainKey-Signature headers

=head1 AUTHOR

Jason Long, E<lt>jlong@messiah.eduE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2006-2007 by Messiah College

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.

=cut

1;