"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "t/51-DS-SHA1.t" between
Net-DNS-1.23.tar.gz and Net-DNS-1.23_01.tar.gz

About: Net::DNS is a DNS resolver implemented in Perl. Development version.

51-DS-SHA1.t  (Net-DNS-1.23):51-DS-SHA1.t  (Net-DNS-1.23_01)
# $Id: 51-DS-SHA1.t 1352 2015-06-02 08:13:13Z willem $ -*-perl-*- # $Id: 51-DS-SHA1.t 1779 2020-05-11 09:11:17Z willem $ -*-perl-*-
# #
use strict; use strict;
use Test::More; use Test::More;
use Net::DNS; use Net::DNS;
my @prerequisite = qw( my @prerequisite = qw(
Digest::SHA Digest::SHA
MIME::Base64 MIME::Base64
Net::DNS::RR::KEY Net::DNS::RR::DNSKEY
Net::DNS::RR::DS Net::DNS::RR::DS
); );
foreach my $package (@prerequisite) { foreach my $package (@prerequisite) {
next if eval "require $package"; next if eval "require $package";
plan skip_all => "$package not installed"; plan skip_all => "$package not installed";
exit; exit;
} }
plan tests => 3; plan tests => 3;
# Simple known-answer tests based upon the examples given in RFC3658, section 2. 7 # Simple known-answer tests based upon the examples given in RFC4034, section 5. 4
my $key = new Net::DNS::RR <<'END'; my $dnskey = new Net::DNS::RR <<'END';
dskey.example. IN KEY 256 3 1 ( dskey.example.com. 86400 IN DNSKEY ( 256 3 5
AQPwHb4UL1U9RHaU8qP+Ts5bVOU1s7fYbj2b3CCbzNdj AQOeiiR0GOMYkDshWoSKz9XzfwJr1AYtsmx3TGkJaNXVbfi/2pHm822aJ5iI9BMzNXxeYCmZD
4+/ECd18yKiyUQqKqQFWW5T3iVc8SJOKnueJHt/Jb/wt RD9
) ; key id = 28668 9WYwYqUSdjMmmAphXdvxegXd/M5+X7OrzKBaMbCVdFLUUh6DhweJBjEVv5f2wwjM9XzcnOf+E
Pbt
G9DMBmADjFDc2w/rljwvFw== ) ; Key ID = 60485
END END
my $ds = new Net::DNS::RR <<'END'; my $ds = new Net::DNS::RR <<'END';
dskey.example. IN DS 28668 1 1 ( dskey.example.com. 86400 IN DS ( 60485 5 1
49fd46e6c4b45c55d4ac69cbd3cd34ac1afe51de 2BB183AF5F22588179A53B0A98631FAD1A292118 )
;xidez-ticuv-kicur-galah-hehyp-sopys-roges-titap-sakoz-vygat-vyxox ; xepor-cybyp-zulyd-dekom-civip-hovob-pikek-fylop-tekyd-namac-moxex
)
END END
my $test = create Net::DNS::RR::DS( $key, digtype => 'SHA1', ); my $test = create Net::DNS::RR::DS( $dnskey, digtype => 'SHA1', );
is( $test->string, $ds->string, 'created DS matches RFC3658 example DS' ); is( $test->string, $ds->string, 'created DS matches RFC4034 example DS' );
ok( $test->verify($key), 'created DS verifies RFC3658 example KEY' ); ok( $test->verify($dnskey), 'created DS verifies RFC4034 example DNSKEY' );
ok( $ds->verify($key), 'RFC3658 example DS verifies example KEY' ); ok( $ds->verify($dnskey), 'RFC4034 example DS verifies example DNSKEY' );
$test->print; $test->print;
__END__ __END__
 End of changes. 9 change blocks. 
16 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)