Skip Menu |

This queue is for tickets about the Mail-DKIM CPAN distribution.

Report information
The Basics
Id: 47925
Status: resolved
Priority: 0/
Queue: Mail-DKIM

People
Owner: jason [...] long.name
Requestors: yyang [...] proofpoint.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.36
Fixed in: (no value)



Use case: If we want to use the same signer (meaning the same key, the same domain/selector, the same algrithm/method) to sign different message, we would have to have a reset() function in Mail::DKIM::Signer. --- lib/Mail/DKIM/Signer.pm 2009-06-02 10:24:55.000000000 -0700 +++ /usr/lib/perl5/site_perl/5.8.0/Mail/DKIM/Signer.pm 2009-07-15 09:59:05.0000 @@ -174,6 +174,13 @@ } } +sub reset +{ + my $self = shift; + + $self->SUPER::init; +} + sub finish_header { my $self = shift; The test case is attached.
#!/usr/bin/perl -I../lib use strict; use warnings; use Test::Simple tests => 4; use Mail::DKIM::Signer; my $EXPECTED_RE = qr/CIDMVc94VWhLZ4Ktq2Q05011qBXSO/; my $tdir = -f "t/test.key" ? "t" : "."; my $keyfile = "$tdir/test.key"; my $dkim = Mail::DKIM::Signer->new( Algorithm => "rsa-sha1", Method => "relaxed", Domain => "example.org", Selector => "test", KeyFile => $keyfile); ok($dkim, "new() works"); my $sample_email = <<END_OF_SAMPLE; From: jason <jason\@example.org> Subject: hi there Comment: what is a comment this is a sample message END_OF_SAMPLE $sample_email =~ s/\n/\015\012/gs; $dkim->PRINT($sample_email); $dkim->CLOSE; my $signature = $dkim->signature; ok($signature, "signature() works"); print "# signature=" . $signature->as_string . "\n"; ok($signature->as_string =~ /$EXPECTED_RE/, "got expected signature value"); my $sig_str = $signature->as_string; $dkim->reset; $dkim->PRINT($sample_email); $dkim->CLOSE; my $signature2 = $dkim->signature; print "# signature=" . $signature2->as_string . "\n"; ok($signature2->as_string eq $sig_str, "the signature is the same using one signer");
On Wed Jul 15 18:02:34 2009, yyang wrote: Show quoted text
> If we want to use the same signer (meaning the same key, the same > domain/selector, the same algrithm/method) to sign different message, we > would have to have a reset() function in Mail::DKIM::Signer.
It's a good idea. I'm going to put it on my TODO list. In the meantime, the "official" way of signing more than one message is to create a new Mail::DKIM::Signer object for each message. Jason