blib/lib/Net/DNS/SEC.pm

filter: Statementstmt 100% 38 / 38 Branchbran 75.0% 3 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 8 / 8 Podpod 100% 3 / 3 totaltotal 98.2% 55 / 56 CC 3 SCAR 4.7
CC
3
Cov
98%
key_difference
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« blib/lib/Net/DNS/SEC/RSA.pm ↑ Summary blib/lib/Net/DNS/SEC/Digest.pm »
1 package Net::DNS::SEC;
2  
3 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 10 our $SVNVERSION = (qw$Id: SEC.pm 2064 2026-10-05 12:25:28Z willem $)[2];
8 10 our $VERSION;
9 10 $VERSION = '1.28';
10  
11 10 ▶use base qw(Exporter DynaLoader);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 10 eval { __PACKAGE__->bootstrap($VERSION) };
14 10 ▶warn "\n\n$@\n" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 10 10
15  
16 10 ▶use Net::DNS 1.08 qw(:DEFAULT);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 10 our @EXPORT = ( @Net::DNS::EXPORT, qw(algorithm digtype key_difference) );
19  
20  
21 =head1 NAME
22  
23 Net::DNS::SEC - DNSSEC extensions to Net::DNS
24  
25 =head1 SYNOPSIS
26  
27 use Net::DNS::SEC;
28  
29 =head1 DESCRIPTION
30  
31 Net::DNS::SEC is installed as an extension to an existing Net::DNS
32 installation providing packages to support DNSSEC as specified in
33 RFC4033, RFC4034, RFC4035 and related documents.
34  
35 It also provides support for SIG0 which is useful for dynamic updates.
36  
37 Implements cryptographic signature generation and verification functions
38 using RSA, DSA, ECDSA, and Edwards curve algorithms.
39  
40 The extended features are made available by replacing Net::DNS by
41 Net::DNS::SEC in the use declaration.
42  
43 =cut
44  
45  
46 =head1 UTILITY FUNCTIONS
47  
48 =head2 algorithm
49  
50 $mnemonic = algorithm( 5 );
51 $numeric = algorithm( 'RSA-SHA1' );
52 print "algorithm mnemonic\t", $mnemonic, "\n";
53 print "algorithm number:\t", $numeric, "\n";
54  
55 algorithm() provides conversions between an algorithm code number and
56 the corresponding mnemonic.
57  
58 =cut
59  
60 6 ▶sub algorithm { return &Net::DNS::RR::DS::algorithm; }
Subroutine algorithm: called CC=1 SCAR=0.0
Pod documented
61  
62  
63 =head2 digtype
64  
65 $mnemonic = digtype( 2 );
66 $numeric = digtype( 'SHA-256' );
67 print "digest type mnemonic\t", $mnemonic, "\n";
68 print "digest type number:\t", $numeric, "\n";
69  
70 digtype() provides conversions between a digest type number and the
71 corresponding mnemonic.
72  
73 =cut
74  
75 2 ▶sub digtype { return &Net::DNS::RR::DS::digtype; }
Subroutine digtype: called CC=1 SCAR=0.0
Pod documented
76  
77  
78 =head2 key_difference
79  
80 @result = key_difference( \@a, \@b );
81  
82 Fills @result with all keys in array @a that are not in array @b.
83  
84 =cut
85  
86 3 ▶sub key_difference {
Subroutine key_difference: called CC=3 SCAR=11.0
Pod documented
87 3 my $a = shift;
88 3 my $b = shift;
89 3 ▶ my $r = shift || []; ## 0.17 API
Condition100%2/2
shift() || []
l!l
12
MC/DC100%1/1
shift() || []
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
90  
91 3 local $SIG{__DIE__};
92 3 my ($x) = grep { !$_->isa('Net::DNS::RR::DNSKEY') } @$a, @$b;
93 3 ▶ croak sprintf( 'unexpected %s object in key list', ref $x ) if $x;
Branch: 1 branch
BranchTrueFalseTotal
if $x 2 1 3
94  
95 1 my %index = map { ( $_->privatekeyname => 1 ) } @$b;
96 1 return @$r = grep { !$index{$_->privatekeyname} } @$a;
97 }
98  
99  
100 ########################################
101  
102 10 foreach (qw(RRSIG DS CDS)) {
103 30 Net::DNS::RR->new( type => $_ ); # pre-load to access class methods
104 }
105  
106 10 1;
107 __END__
« blib/lib/Net/DNS/SEC/RSA.pm ↑ Summary blib/lib/Net/DNS/SEC/Digest.pm »