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
|
#!/usr/bin/perl
#$Id: key2ds 1862 2021-12-24 10:09:08Z willem $
# A little util to convert DNSKEY records to DS records
# from stdin to stdout
#
# Author: Miek Gieben, NLnetLabs
use strict;
use warnings;
use Net::DNS::SEC;
use Net::DNS::ZoneFile;
my $source = Net::DNS::ZoneFile->new('-'); # STDIN
while ( my $keyrr = $source->read ) {
next unless $keyrr->isa('Net::DNS::RR::DNSKEY');
foreach my $digtype (qw(SHA256 SHA1)) {
my $ds = Net::DNS::RR::DS->create( $keyrr, digtype => $digtype );
$ds->print; # STDOUT
}
}
exit 0;
=head1 NAME
key2ds - Utility to create DS records from DNSKEY RRs read from stdin.
=head1 SYNOPSIS
key2ds <keys.txt >ds.txt
=head1 DESCRIPTION
C<key2ds> reads the key data from STDIN and prints the corresponding
DS record on STDOUT.
=head1 COPYRIGHT
Copyright (c)2002 Miek Gieben
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the original copyright notices appear in all copies and that both
copyright notice and this permission notice appear in supporting
documentation, and that the name of the author not be used in advertising
or publicity pertaining to distribution of the software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
=cut
|