line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VOMS::Lite::KEY; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
25
|
use 5.004; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
45
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use VOMS::Lite::ASN1Helper qw(ASN1Index ASN1Unwrap); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
60
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
873
|
|
10
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VERSION = '0.20'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub Examine { |
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
4
|
0
|
14
|
my ($decoded,$dataref)=@_; |
17
|
4
|
|
|
|
|
19
|
my %Values=%$dataref; |
18
|
4
|
|
|
|
|
16
|
my @ASN1Index=ASN1Index($decoded); |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
|
|
8
|
my $index=0; |
21
|
4
|
|
|
|
|
7
|
my $ignoreuntil=0; |
22
|
4
|
|
|
|
|
7
|
my ($Keyversion,$Keymodulus,$KeypublicExponent,$KeyprivateExponent,$Keyprime1,$Keyprime2,$Keyexponent1,$Keyexponent2,$Keycoefficient); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Test for PKCS8 |
26
|
4
|
50
|
|
|
|
16
|
if ($ASN1Index[2]->[2] == 16) { # This is probably a PKCS8 key |
27
|
0
|
|
|
|
|
0
|
my ($CLASS,$CONSTRUCTED,$TAG,$HEADSTART,$HEADLEN,$CHUNKLEN) = @{$ASN1Index[5]}; |
|
0
|
|
|
|
|
0
|
|
28
|
0
|
|
|
|
|
0
|
my $newdecoded=substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN)); |
29
|
0
|
0
|
|
|
|
0
|
if ( $TAG == 4 ) { |
30
|
0
|
|
|
|
|
0
|
$decoded=ASN1Unwrap($newdecoded); |
31
|
0
|
|
|
|
|
0
|
@ASN1Index=ASN1Index($decoded); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
4
|
|
|
|
|
7
|
shift @ASN1Index; #Key Sequence |
36
|
4
|
|
|
|
|
13
|
foreach (@ASN1Index) { |
37
|
36
|
|
|
|
|
70
|
my ($CLASS,$CONSTRUCTED,$TAG,$HEADSTART,$HEADLEN,$CHUNKLEN) = @$_; |
38
|
36
|
50
|
|
|
|
52
|
if ( $HEADSTART < $ignoreuntil ) { next; } |
|
0
|
|
|
|
|
0
|
|
39
|
|
|
|
|
|
|
else { |
40
|
36
|
100
|
66
|
|
|
298
|
if ($index==0 && $TAG==2) {$Keyversion = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
|
4
|
100
|
66
|
|
|
8
|
|
|
4
|
100
|
66
|
|
|
8
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
41
|
4
|
|
|
|
|
7
|
elsif ($index==1 && $TAG==2) {$Keymodulus = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
42
|
4
|
|
|
|
|
6
|
elsif ($index==2 && $TAG==2) {$KeypublicExponent = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
43
|
4
|
|
|
|
|
8
|
elsif ($index==3 && $TAG==2) {$KeyprivateExponent = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
44
|
4
|
|
|
|
|
9
|
elsif ($index==4 && $TAG==2) {$Keyprime1 = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
45
|
4
|
|
|
|
|
9
|
elsif ($index==5 && $TAG==2) {$Keyprime2 = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
46
|
4
|
|
|
|
|
8
|
elsif ($index==6 && $TAG==2) {$Keyexponent1 = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
47
|
4
|
|
|
|
|
7
|
elsif ($index==7 && $TAG==2) {$Keyexponent2 = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
48
|
|
|
|
|
|
|
elsif ($index==8 && $TAG==2) {$Keycoefficient = substr($decoded,$HEADSTART,($HEADLEN+$CHUNKLEN));} |
49
|
36
|
|
|
|
|
31
|
$index++; |
50
|
36
|
|
|
|
|
57
|
$ignoreuntil=$HEADSTART+$HEADLEN+$CHUNKLEN; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
4
|
50
|
|
|
|
12
|
if (defined $Values{Keyversion}) {my @n=ASN1Unwrap($Keyversion); $Values{Keyversion} = $n[5];} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
55
|
4
|
50
|
|
|
|
12
|
if (defined $Values{Keymodulus}) {my @n=ASN1Unwrap($Keymodulus); $Values{Keymodulus} = $n[5];} |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
12
|
|
56
|
4
|
50
|
|
|
|
12
|
if (defined $Values{KeypublicExponent}) {my @n=ASN1Unwrap($KeypublicExponent); $Values{KeypublicExponent} = $n[5];} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
57
|
4
|
50
|
|
|
|
13
|
if (defined $Values{KeyprivateExponent}) {my @n=ASN1Unwrap($KeyprivateExponent); $Values{KeyprivateExponent} = $n[5];} |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
13
|
|
58
|
4
|
50
|
|
|
|
13
|
if (defined $Values{Keyprime1}) {my @n=ASN1Unwrap($Keyprime1); $Values{Keyprime1} = $n[5];} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
59
|
4
|
50
|
|
|
|
10
|
if (defined $Values{Keyprime2}) {my @n=ASN1Unwrap($Keyprime2); $Values{Keyprime2} = $n[5];} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
60
|
4
|
50
|
|
|
|
13
|
if (defined $Values{Keyexponent1}) {my @n=ASN1Unwrap($Keyexponent1); $Values{Keyexponent1} = $n[5];} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
61
|
4
|
50
|
|
|
|
9
|
if (defined $Values{Keyexponent2}) {my @n=ASN1Unwrap($Keyexponent2); $Values{Keyexponent2} = $n[5];} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
62
|
4
|
50
|
|
|
|
10
|
if (defined $Values{Keycoefficient}) {my @n=ASN1Unwrap($Keycoefficient); $Values{Keycoefficient} = $n[5];} |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
63
|
|
|
|
|
|
|
|
64
|
4
|
|
|
|
|
26
|
return (\%Values); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
################################################################ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
__END__ |