Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 84468
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: Nobody in particular
Requestors: oneingray [...] gmail.com
Cc: CARNIL [...] cpan.org
AdminCc:

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



CC: Ivan Shmakov <oneingray [...] gmail.com>
Subject: Net::DNS::TSIG: please support hmac-sha1 .. hmac-sha512
Date: Sat, 06 Apr 2013 12:28:04 +0000
To: bug-Net-DNS [...] rt.cpan.org
From: Ivan Shmakov <oneingray [...] gmail.com>
[Forwarding Debian Bug#700618.] Please add support for the hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384, hmac-sha512 algorithms (as per RFC 4635.) An example algorithm switcher is MIME'd. Please note, however, that it relies on a patched version of Digest::HMAC, which allows passing an instantiated Digest object to the Digest::HMAC->new () constructor (as per CPAN RT#84467, Debian Bug#700617.) The code as given is untested, although I've used a similar hack in my (yet to be released) project, to successfully communicate with BIND9 using hmac-sha512. -- FSF associate member #7257 http://hfday.org/
require Digest; require Digest::HMAC; require MIME::Base64; ## based on Net::DNS::RR::TSIG::sign_hmac sub new_sign_hmac { my ($digest, $block_size) = @_; ## . sub { my ($key_s, $data) = @_; $key_s =~ s/\s//g; my $key = MIME::Base64::decode_base64 ($key_s); my $hmac = Digest::HMAC->new ($key, $digest, $block_size); $hmac->add ($data); ## . $hmac->digest (); } } ## NB: a value is either a CODE reference, or [ "digest", block_size ] our $rr_tsig_algo_info = { "HMAC-MD5.SIG-ALG.REG.INT" => [ "MD5", 64 ], "hmac-sha1" => [ "SHA-1", 64 ], "hmac-sha224" => [ "SHA-224", 64 ], "hmac-sha256" => [ "SHA-256", 64 ], "hmac-sha384" => [ "SHA-384", 128 ], "hmac-sha512" => [ "SHA-512", 128 ] }; sub rr_tsig_algo { my ($tsig, $algo) = @_; my $hmac = $rr_tsig_algo_info->{$algo}; ## . return undef unless (defined ($hmac)); $tsig->{"sign_func"} = (ref ($hmac) eq "CODE" ? $hmac : new_sign_hmac (Digest->new ($hmac->[0]), $hmac->[1])); $tsig->{"algorithm"} = $algo; ## . $tsig; } # my $tsig # = Net::DNS::TSIG->new (...) # or die (); # rr_tsig_algo ($tsig, "hmac-sha512") # or die ();
From: rwfranks [...] acm.org
TSIG with HMAC-SHA1 .. SHA512 implementation on trunk and will appear in 0.73. No hacking of Digest::HMAC required. On Sat Apr 06 08:28:41 2013, oneingray@gmail.com wrote: Show quoted text
> [Forwarding Debian Bug#700618.] > > Please add support for the hmac-sha1, hmac-sha224, hmac-sha256, > hmac-sha384, hmac-sha512 algorithms (as per RFC 4635.)
Subject: Re: [rt.cpan.org #84468] Net::DNS::TSIG: please support hmac-sha1 .. hmac-sha512
Date: Thu, 24 Oct 2013 19:34:45 +0000
To: bug-Net-DNS [...] rt.cpan.org
From: Ivan Shmakov <ivan [...] siamics.net>
Show quoted text
>>>>> Dick Franks via RT <bug-Net-DNS@rt.cpan.org> writes: >>>>> On Sat Apr 06 08:28:41 2013, oneingray@gmail.com wrote:
Show quoted text
>> [Forwarding Debian Bug#700618.]
Show quoted text
>> Please add support for the hmac-sha1, hmac-sha224, hmac-sha256, >> hmac-sha384, hmac-sha512 algorithms (as per RFC 4635.)
Show quoted text
> TSIG with HMAC-SHA1 .. SHA512 implementation on trunk and will appear > in 0.73.
Show quoted text
> No hacking of Digest::HMAC required.
Indeed, I stand corrected. Still, using a Digest instance instead of a digest algorithm’s name doesn’t seem to be quite in line with the documentation. Consider, e. g.: ⋯✂⋯ Digest::HMAC(3pm) ⋯✂⋯ HMAC follow the common “Digest::” interface, but the constructor takes the secret key and the name of some other simple “Digest::” as argument. ⋯✂⋯ Digest::HMAC(3pm) ⋯✂⋯ Cf.: ⋯✂⋯ http://www.net-dns.org/svn/net-dns/trunk/lib/Net/DNS/RR/TSIG.pm ⋯✂⋯ my $digest = new $hash(@param); my $hmac = new Digest::HMAC( shift, $digest, @block ); ⋯✂⋯ http://www.net-dns.org/svn/net-dns/trunk/lib/Net/DNS/RR/TSIG.pm ⋯✂⋯ Thus, my guess is that RT#84467 should probably be re-classified as a documentation bug. -- FSF associate member #7257
This is fixed in the upcoming 0.73 release