line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Keyczar::RsaPublicKey; |
2
|
5
|
|
|
5
|
|
29
|
use base 'Crypt::Keyczar::Key'; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
339
|
|
3
|
5
|
|
|
5
|
|
70
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
88
|
|
4
|
5
|
|
|
5
|
|
22
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
116
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
799
|
use Crypt::Keyczar qw(KEY_HASH_SIZE); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
194
|
|
7
|
5
|
|
|
5
|
|
25
|
use Crypt::Keyczar::Util; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
1673
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub expose { |
12
|
10
|
|
|
10
|
0
|
21
|
my $self = shift; |
13
|
10
|
|
|
|
|
22
|
my $expose = {}; |
14
|
10
|
|
|
|
|
25
|
$expose->{modulus} = $self->{modulus}; |
15
|
10
|
|
|
|
|
22
|
$expose->{publicExponent} = $self->{publicExponent}; |
16
|
10
|
|
|
|
|
25
|
$expose->{size} = $self->{size}; |
17
|
|
|
|
|
|
|
|
18
|
10
|
|
|
|
|
28
|
return $expose; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub read { |
23
|
3
|
|
|
3
|
0
|
17
|
my $class = shift; |
24
|
3
|
|
|
|
|
7
|
my $json_string = shift; |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
|
|
10
|
my $obj = Crypt::Keyczar::Util::decode_json($json_string); |
27
|
3
|
|
|
|
|
10
|
my $self = bless $obj, $class; |
28
|
3
|
|
|
|
|
10
|
$self->init(); |
29
|
3
|
|
|
|
|
11
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub init { |
34
|
67
|
|
|
67
|
0
|
112
|
my $self = shift; |
35
|
67
|
|
|
|
|
190
|
my $mod = Crypt::Keyczar::Util::decode($self->{modulus}); |
36
|
67
|
|
|
|
|
180
|
my $pub_exp = Crypt::Keyczar::Util::decode($self->{publicExponent}); |
37
|
67
|
|
|
|
|
182
|
$mod =~ s/^\x00+//; |
38
|
67
|
|
|
|
|
323
|
$pub_exp =~ s/^\x00+//; |
39
|
67
|
|
|
|
|
818
|
my $hash = Crypt::Keyczar::Util::hash( |
40
|
|
|
|
|
|
|
pack('N1', length $mod), $mod, |
41
|
|
|
|
|
|
|
pack('N1', length $pub_exp), $pub_exp); |
42
|
67
|
|
|
|
|
436
|
$self->hash(substr $hash, 0, KEY_HASH_SIZE()); |
43
|
67
|
|
|
|
|
161
|
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
|
14
|
sub digest_size { return $_[0]->{_digest_size}; } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub get_engine { |
61
|
4
|
|
|
4
|
0
|
658
|
my $self = shift; |
62
|
4
|
|
|
|
|
13
|
my @args = map { Crypt::Keyczar::Util::decode($_) } ($self->{modulus}, $self->{publicExponent}); |
|
8
|
|
|
|
|
21
|
|
63
|
4
|
|
|
|
|
66
|
my $engine = Crypt::Keyczar::RsaPublicKeyEngine->new(@args); |
64
|
4
|
|
|
|
|
25
|
$self->{_digest_size} = $engine->digest_size; |
65
|
4
|
|
|
|
|
13
|
return $engine; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
package Crypt::Keyczar::RsaPublicKeyEngine; |
72
|
5
|
|
|
5
|
|
28
|
use base 'Exporter'; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
257
|
|
73
|
5
|
|
|
5
|
|
28
|
use strict; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
87
|
|
74
|
5
|
|
|
5
|
|
20
|
use warnings; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
105
|
|
75
|
5
|
|
|
5
|
|
66
|
use Crypt::Keyczar::Engine; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
100
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
__END__ |