/usr/share/perl5/GnuPG/PrimaryKey.pm is in libgnupg-interface-perl 0.52-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | # PrimaryKey.pm
# - objectified GnuPG primary keys (can have subkeys)
#
# Copyright (C) 2000 Frank J. Tobin <ftobin@cpan.org>
#
# This module is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# $Id: PrimaryKey.pm,v 1.4 2001/09/14 12:34:36 ftobin Exp $
#
package GnuPG::PrimaryKey;
use Moo;
use MooX::late;
use MooX::HandlesVia;
BEGIN { extends qw( GnuPG::Key ) }
for my $list (qw(user_ids subkeys user_attributes)) {
my $ref = $list . "_ref";
has $ref => (
handles_via => 'Array',
is => 'rw',
default => sub { [] },
handles => {
"push_$list" => 'push',
},
);
no strict 'refs';
*{$list} = sub {
my $self = shift;
return wantarray ? @{$self->$ref(@_)} : $self->$ref(@_);
};
}
has $_ => (
isa => 'Any',
is => 'rw',
clearer => 'clear_' . $_,
) for qw( local_id owner_trust );
sub compare {
my ($self, $other, $deep) = @_;
# not comparing local_id because it is meaningless in modern
# versions of GnuPG.
my @comparison_fields = qw (
owner_trust
);
foreach my $field (@comparison_fields) {
return 0 unless $self->$field eq $other->$field;
}
if (defined $deep && $deep) {
my @lists = qw(
user_ids
subkeys
user_attributes
);
foreach my $list (@lists) {
return 0 unless @{$self->$list} == @{$other->$list};
for ( my $i = 0; $i < scalar(@{$self->$list}); $i++ ) {
return 0
unless $self->$list->[$i]->compare($other->$list->[$i], 1);
}
}
}
return $self->SUPER::compare($other, $deep);
}
1;
__END__
=head1 NAME
GnuPG::PrimaryKey - GnuPG Primary Key Objects
=head1 SYNOPSIS
# assumes a GnuPG::Interface object in $gnupg
my @keys = $gnupg->get_public_keys( 'ftobin' );
# or
my @keys = $gnupg->get_secret_keys( 'ftobin' );
# now GnuPG::PrimaryKey objects are in @keys
=head1 DESCRIPTION
GnuPG::PrimaryKey objects are generally instantiated
as GnuPG::PublicKey or GnuPG::SecretKey objects
through various methods of GnuPG::Interface.
They embody various aspects of a GnuPG primary key.
This package inherits data members and object methods
from GnuPG::Key, which is not described here, but rather
in L<GnuPG::Key>.
=head1 OBJECT DATA MEMBERS
=over 4
=item user_ids
A list of GnuPG::UserId objects associated with this key.
=item user_attributes
A list of GnuPG::UserAttribute objects associated with this key.
=item subkeys
A list of GnuPG::SubKey objects associated with this key.
=item local_id
WARNING: DO NOT USE. This used to mean GnuPG's local id for the key,
but modern versions of GnuPG do not produce it. Expect this to be the
empty string or undef.
=item owner_trust
The scalar value GnuPG reports as the ownertrust for this key.
See GnuPG's DETAILS file for details.
=back
=head1 SEE ALSO
L<GnuPG::Key>,
L<GnuPG::UserId>,
L<GnuPG::SubKey>,
=cut
|