line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Keyczar::RsaPublicKey; |
2
|
5
|
|
|
5
|
|
28
|
use base 'Crypt::Keyczar::Key'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
377
|
|
3
|
5
|
|
|
5
|
|
213
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
141
|
|
4
|
5
|
|
|
5
|
|
22
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
130
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
1864
|
use Crypt::Keyczar qw(KEY_HASH_SIZE); |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
441
|
|
7
|
5
|
|
|
5
|
|
29
|
use Crypt::Keyczar::Util; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2862
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub expose { |
12
|
10
|
|
|
10
|
0
|
22
|
my $self = shift; |
13
|
10
|
|
|
|
|
23
|
my $expose = {}; |
14
|
10
|
|
|
|
|
34
|
$expose->{modulus} = $self->{modulus}; |
15
|
10
|
|
|
|
|
24
|
$expose->{publicExponent} = $self->{publicExponent}; |
16
|
10
|
|
|
|
|
23
|
$expose->{size} = $self->{size}; |
17
|
|
|
|
|
|
|
|
18
|
10
|
|
|
|
|
36
|
return $expose; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub read { |
23
|
3
|
|
|
3
|
0
|
20
|
my $class = shift; |
24
|
3
|
|
|
|
|
6
|
my $json_string = shift; |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
|
|
14
|
my $obj = Crypt::Keyczar::Util::decode_json($json_string); |
27
|
3
|
|
|
|
|
9
|
my $self = bless $obj, $class; |
28
|
3
|
|
|
|
|
11
|
$self->init(); |
29
|
3
|
|
|
|
|
10
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub init { |
34
|
67
|
|
|
67
|
0
|
99
|
my $self = shift; |
35
|
67
|
|
|
|
|
259
|
my $mod = Crypt::Keyczar::Util::decode($self->{modulus}); |
36
|
67
|
|
|
|
|
325
|
my $pub_exp = Crypt::Keyczar::Util::decode($self->{publicExponent}); |
37
|
67
|
|
|
|
|
275
|
$mod =~ s/^\x00+//; |
38
|
67
|
|
|
|
|
265
|
$pub_exp =~ s/^\x00+//; |
39
|
67
|
|
|
|
|
1184
|
my $hash = Crypt::Keyczar::Util::hash( |
40
|
|
|
|
|
|
|
pack('N1', length $mod), $mod, |
41
|
|
|
|
|
|
|
pack('N1', length $pub_exp), $pub_exp); |
42
|
67
|
|
|
|
|
695
|
$self->hash(substr $hash, 0, KEY_HASH_SIZE()); |
43
|
67
|
|
|
|
|
225
|
return $self; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub set { |
48
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
49
|
0
|
|
|
|
|
0
|
my ($mod, $pub_exp) = @_; |
50
|
0
|
|
|
|
|
0
|
$self->{modulus} = $mod; |
51
|
0
|
|
|
|
|
0
|
$self->{publicExponent} = $pub_exp; |
52
|
0
|
|
|
|
|
0
|
$self->init(); |
53
|
0
|
|
|
|
|
0
|
return $self; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
3
|
|
|
3
|
0
|
23
|
sub digest_size { return $_[0]->{_digest_size}; } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub get_engine { |
61
|
4
|
|
|
4
|
0
|
547
|
my $self = shift; |
62
|
4
|
|
|
|
|
18
|
my @args = map { Crypt::Keyczar::Util::decode($_) } ($self->{modulus}, $self->{publicExponent}); |
|
8
|
|
|
|
|
27
|
|
63
|
4
|
|
|
|
|
102
|
my $engine = Crypt::Keyczar::RsaPublicKeyEngine->new(@args); |
64
|
4
|
|
|
|
|
39
|
$self->{_digest_size} = $engine->digest_size; |
65
|
4
|
|
|
|
|
20
|
return $engine; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
package Crypt::Keyczar::RsaPublicKeyEngine; |
72
|
5
|
|
|
5
|
|
28
|
use base 'Exporter'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
634
|
|
73
|
5
|
|
|
5
|
|
24
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
172
|
|
74
|
5
|
|
|
5
|
|
32
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
133
|
|
75
|
5
|
|
|
5
|
|
28
|
use Crypt::Keyczar::Engine; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
146
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
__END__ |