line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::OpenPGP::Key::Public::DSA; |
2
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
142
|
|
3
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
1089
|
use Crypt::DSA::Key; |
|
4
|
|
|
|
|
11969
|
|
|
4
|
|
|
|
|
144
|
|
5
|
4
|
|
|
4
|
|
32
|
use Crypt::OpenPGP::Key::Public; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
161
|
|
6
|
4
|
|
|
4
|
|
25
|
use Crypt::OpenPGP::ErrorHandler; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
124
|
|
7
|
4
|
|
|
4
|
|
23
|
use base qw( Crypt::OpenPGP::Key::Public Crypt::OpenPGP::ErrorHandler ); |
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
2373
|
|
8
|
|
|
|
|
|
|
|
9
|
11
|
|
|
11
|
1
|
73
|
sub can_sign { 1 } |
10
|
0
|
|
|
0
|
0
|
0
|
sub abbrev { 'D' } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub init { |
13
|
60
|
|
|
60
|
0
|
124
|
my $key = shift; |
14
|
60
|
|
66
|
|
|
577
|
$key->{key_data} = shift || Crypt::DSA::Key->new; |
15
|
60
|
|
|
|
|
1061
|
$key; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub keygen { |
19
|
1
|
|
|
1
|
1
|
1
|
my $class = shift; |
20
|
1
|
|
|
|
|
4
|
my %param = @_; |
21
|
1
|
|
|
|
|
684
|
require Crypt::DSA; |
22
|
1
|
|
|
|
|
13100
|
my $dsa = Crypt::DSA->new; |
23
|
1
|
|
|
|
|
27
|
my $sec = $dsa->keygen( %param ); |
24
|
1
|
|
|
|
|
194896637
|
my $pub = bless { }, 'Crypt::DSA::Key'; |
25
|
1
|
|
|
|
|
7
|
for my $e (qw( p q g pub_key )) { |
26
|
4
|
|
|
|
|
315
|
$pub->$e( $sec->$e() ); |
27
|
|
|
|
|
|
|
} |
28
|
1
|
|
|
|
|
143
|
($pub, $sec); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
103
|
|
|
103
|
0
|
554
|
sub public_props { qw( p q g y ) } |
32
|
57
|
|
|
57
|
0
|
230
|
sub sig_props { qw( r s ) } |
33
|
|
|
|
|
|
|
|
34
|
14
|
|
|
14
|
0
|
801
|
sub y { $_[0]->{key_data}->pub_key(@_[1..$#_]) } |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
2
|
1
|
13
|
sub size { $_[0]->{key_data}->size } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub verify { |
39
|
7
|
|
|
7
|
0
|
18
|
my $key = shift; |
40
|
7
|
|
|
|
|
19
|
my($sig, $dgst) = @_; |
41
|
7
|
|
|
|
|
35
|
require Crypt::DSA; |
42
|
7
|
|
|
|
|
66
|
my $dsa = Crypt::DSA->new; |
43
|
7
|
|
|
|
|
173
|
my $dsa_sig = Crypt::DSA::Signature->new; |
44
|
7
|
|
|
|
|
92
|
$dsa_sig->r($sig->{r}); |
45
|
7
|
|
|
|
|
605
|
$dsa_sig->s($sig->{s}); |
46
|
|
|
|
|
|
|
$dsa->verify( |
47
|
|
|
|
|
|
|
Key => $key->{key_data}, |
48
|
7
|
|
|
|
|
407
|
Digest => $dgst, |
49
|
|
|
|
|
|
|
Signature => $dsa_sig |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |