| line |
stmt |
bran |
path |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
# Revoker.pm |
|
2
|
|
|
|
|
|
|
|
# - providing an object-oriented approach to GnuPG key revokers |
|
3
|
|
|
|
|
|
|
|
# |
|
4
|
|
|
|
|
|
|
|
# Copyright (C) 2010 Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
|
5
|
|
|
|
|
|
|
|
# (derived from Signature.pm, Copyright (C) 2000 Frank J. Tobin <ftobin@cpan.org>) |
|
6
|
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
|
# This module is free software; you can redistribute it and/or modify it |
|
8
|
|
|
|
|
|
|
|
# under the same terms as Perl itself. |
|
9
|
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful, |
|
11
|
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
13
|
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
|
# $Id: Signature.pm,v 1.4 2001/08/21 13:31:50 ftobin Exp $ |
|
15
|
|
|
|
|
|
|
|
# |
|
16
|
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
package GnuPG::Revoker; |
|
18
|
5
|
|
|
|
5
|
|
41
|
use Moo; |
|
|
5
|
|
|
|
|
|
12
|
|
|
|
5
|
|
|
|
|
|
40
|
|
|
19
|
5
|
|
|
|
5
|
|
1772
|
use MooX::late; |
|
|
5
|
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
|
38
|
|
|
20
|
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
has [qw( |
|
22
|
|
|
|
|
|
|
|
algo_num |
|
23
|
|
|
|
|
|
|
|
class |
|
24
|
|
|
|
|
|
|
|
)] => ( |
|
25
|
|
|
|
|
|
|
|
isa => 'Int', |
|
26
|
|
|
|
|
|
|
|
is => 'rw', |
|
27
|
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
has fingerprint => ( |
|
30
|
|
|
|
|
|
|
|
isa => 'GnuPG::Fingerprint', |
|
31
|
|
|
|
|
|
|
|
is => 'rw', |
|
32
|
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
has signatures => ( |
|
35
|
|
|
|
|
|
|
|
isa => 'ArrayRef', |
|
36
|
|
|
|
|
|
|
|
is => 'rw', |
|
37
|
|
|
|
|
|
|
|
default => sub { [] }, |
|
38
|
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
sub push_signatures { |
|
41
|
2
|
|
|
|
2
|
0
|
34
|
my $self = shift; |
|
42
|
2
|
|
|
|
|
|
5
|
push @{ $self->signatures }, @_; |
|
|
2
|
|
|
|
|
|
47
|
|
|
43
|
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
sub is_sensitive { |
|
46
|
0
|
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
47
|
0
|
|
|
|
|
|
0
|
return $self->class & 0x40; |
|
48
|
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
sub compare { |
|
51
|
1
|
|
|
|
1
|
1
|
10
|
my ( $self, $other, $deep ) = @_; |
|
52
|
|
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
|
4
|
my @comparison_ints = qw( class algo_num ); |
|
54
|
|
|
|
|
|
|
|
|
|
55
|
1
|
|
|
|
|
|
2
|
foreach my $field ( @comparison_ints ) { |
|
56
|
2
|
50
|
|
|
|
|
53
|
return 0 unless $self->$field() == $other->$field(); |
|
57
|
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
|
59
|
1
|
50
|
|
|
|
|
34
|
return 0 unless $self->fingerprint->compare($other->fingerprint); |
|
60
|
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
# FIXME: is it actually wrong if the associated signatures come out |
|
62
|
|
|
|
|
|
|
|
# in a different order on the two compared designated revokers? |
|
63
|
1
|
50
|
|
33
|
|
|
28
|
if (defined $deep && $deep) { |
|
64
|
1
|
50
|
|
|
|
|
3
|
return 0 unless @{$self->signatures} == @{$other->signatures}; |
|
|
1
|
|
|
|
|
|
18
|
|
|
|
1
|
|
|
|
|
|
26
|
|
|
65
|
1
|
|
|
|
|
|
14
|
for ( my $i = 0; $i < scalar(@{$self->signatures}); $i++ ) { |
|
|
2
|
|
|
|
|
|
249
|
|
|
66
|
1
|
50
|
|
|
|
|
41
|
return 0 |
|
67
|
|
|
|
|
|
|
|
unless $self->signatures->[$i]->compare($other->signatures->[$i], 1); |
|
68
|
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
|
71
|
1
|
|
|
|
|
|
15
|
return 1; |
|
72
|
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
1; |
|
75
|
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
__END__ |
|
77
|
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
=head1 NAME |
|
79
|
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
GnuPG::Revoker - GnuPG Key Revoker Objects |
|
81
|
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
83
|
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
# assumes a GnuPG::PrimaryKey object in $key |
|
85
|
|
|
|
|
|
|
|
my $revokerfpr = $key->revokers->[0]->fingerprint(); |
|
86
|
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
88
|
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
GnuPG::Revoker objects are generally not instantiated on their own, |
|
90
|
|
|
|
|
|
|
|
but rather as part of GnuPG::Key objects. They represent a statement |
|
91
|
|
|
|
|
|
|
|
that another key is designated to revoke certifications made by the |
|
92
|
|
|
|
|
|
|
|
key in question. |
|
93
|
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
|
95
|
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
=over 4 |
|
97
|
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
=item new( I<%initialization_args> ) |
|
99
|
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
This methods creates a new object. The optional arguments are |
|
101
|
|
|
|
|
|
|
|
initialization of data members. |
|
102
|
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
=item is_sensitive() |
|
104
|
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
Returns 0 if the revoker information can be freely distributed. |
|
106
|
|
|
|
|
|
|
|
If this is non-zero, the information should be treated as "sensitive". |
|
107
|
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
Please see http://tools.ietf.org/html/rfc4880#section-5.2.3.15 for |
|
109
|
|
|
|
|
|
|
|
more explanation. |
|
110
|
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
=item compare( I<$other>, I<$deep> ) |
|
112
|
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
Returns non-zero only when this designated revoker is identical to the |
|
114
|
|
|
|
|
|
|
|
other GnuPG::Revoker. If $deep is present and non-zero, the revokers' |
|
115
|
|
|
|
|
|
|
|
signatures will also be compared. |
|
116
|
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
=back |
|
119
|
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
=head1 OBJECT DATA MEMBERS |
|
121
|
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
|
=over 4 |
|
123
|
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
=item fingerprint |
|
125
|
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
A GnuPG::Fingerprint object indicating the fingerprint of the |
|
127
|
|
|
|
|
|
|
|
specified revoking key. (Note that this is *not* the fingerprint of |
|
128
|
|
|
|
|
|
|
|
the key whose signatures can be revoked by this revoker). |
|
129
|
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
=item algo_num |
|
131
|
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
The numeric identifier of the algorithm of the revoker's key. |
|
133
|
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
=item signatures |
|
135
|
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
A list of GnuPG::Signature objects which cryptographically bind the |
|
137
|
|
|
|
|
|
|
|
designated revoker to the primary key. If the material was |
|
138
|
|
|
|
|
|
|
|
instantiated using the *_with_sigs() functions from GnuPG::Interface, |
|
139
|
|
|
|
|
|
|
|
then a valid revoker designation should have a valid signature |
|
140
|
|
|
|
|
|
|
|
associated with it from the relevant key doing the designation (not |
|
141
|
|
|
|
|
|
|
|
from the revoker's key). |
|
142
|
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
Note that designated revoker certifications are themselves |
|
144
|
|
|
|
|
|
|
|
irrevocable, so there is no analogous list of revocations in a |
|
145
|
|
|
|
|
|
|
|
GnuPG::Revoker object. |
|
146
|
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
|
=back |
|
148
|
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
150
|
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
L<GnuPG::Interface>, |
|
152
|
|
|
|
|
|
|
|
L<GnuPG::Fingerprint>, |
|
153
|
|
|
|
|
|
|
|
L<GnuPG::Key>, |
|
154
|
|
|
|
|
|
|
|
L<GnuPG::Signature>, |
|
155
|
|
|
|
|
|
|
|
L<http://tools.ietf.org/html/rfc4880#section-5.2.3.15> |
|
156
|
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
=cut |