1package Net::DNS::RR::OPENPGPKEY; 2 3use strict; 4use warnings; 5our $VERSION = (qw$Id: OPENPGPKEY.pm 1814 2020-10-14 21:49:16Z willem $)[2]; 6 7use base qw(Net::DNS::RR); 8 9 10=head1 NAME 11 12Net::DNS::RR::OPENPGPKEY - DNS OPENPGPKEY resource record 13 14=cut 15 16use integer; 17 18use MIME::Base64; 19 20 21sub _decode_rdata { ## decode rdata from wire-format octet string 22 my $self = shift; 23 my ( $data, $offset ) = @_; 24 25 my $length = $self->{rdlength}; 26 $self->keybin( substr $$data, $offset, $length ); 27 return; 28} 29 30 31sub _encode_rdata { ## encode rdata as wire-format octet string 32 my $self = shift; 33 34 return pack 'a*', $self->keybin; 35} 36 37 38sub _format_rdata { ## format rdata portion of RR string. 39 my $self = shift; 40 41 my @base64 = split /\s+/, encode_base64( $self->keybin ); 42 return @base64; 43} 44 45 46sub _parse_rdata { ## populate RR from rdata in argument list 47 my $self = shift; 48 49 $self->key(@_); 50 return; 51} 52 53 54sub key { 55 my $self = shift; 56 return MIME::Base64::encode( $self->keybin(), "" ) unless scalar @_; 57 return $self->keybin( MIME::Base64::decode( join "", @_ ) ); 58} 59 60 61sub keybin { 62 my $self = shift; 63 64 $self->{keybin} = shift if scalar @_; 65 return $self->{keybin} || ""; 66} 67 68 691; 70__END__ 71 72 73=head1 SYNOPSIS 74 75 use Net::DNS; 76 $rr = Net::DNS::RR->new('name OPENPGPKEY key'); 77 78=head1 DESCRIPTION 79 80Class for OpenPGP Key (OPENPGPKEY) resource records. 81 82=head1 METHODS 83 84The available methods are those inherited from the base class augmented 85by the type-specific methods defined in this package. 86 87Use of undocumented package features or direct access to internal data 88structures is discouraged and could result in program termination or 89other unpredictable behaviour. 90 91 92=head2 key 93 94 $key = $rr->key; 95 $rr->key( $key ); 96 97Base64 encoded representation of the OpenPGP public key material. 98 99=head2 keybin 100 101 $keybin = $rr->keybin; 102 $rr->keybin( $keybin ); 103 104OpenPGP public key material consisting of 105a single OpenPGP transferable public key in RFC4880 format. 106 107 108=head1 COPYRIGHT 109 110Copyright (c)2014 Dick Franks 111 112All rights reserved. 113 114Package template (c)2009,2012 O.M.Kolkman and R.W.Franks. 115 116 117=head1 LICENSE 118 119Permission to use, copy, modify, and distribute this software and its 120documentation for any purpose and without fee is hereby granted, provided 121that the above copyright notice appear in all copies and that both that 122copyright notice and this permission notice appear in supporting 123documentation, and that the name of the author not be used in advertising 124or publicity pertaining to distribution of the software without specific 125prior written permission. 126 127THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 128IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 129FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 130THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 131LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 132FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 133DEALINGS IN THE SOFTWARE. 134 135 136=head1 SEE ALSO 137 138L<perl>, L<Net::DNS>, L<Net::DNS::RR>, RFC7929 139 140=cut 141