line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::RSA::Template; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
40
|
use strict; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
169
|
|
4
|
7
|
|
|
7
|
|
31
|
use warnings; |
|
7
|
|
|
|
|
12
|
|
|
7
|
|
|
|
|
160
|
|
5
|
|
|
|
|
|
|
|
6
|
7
|
|
|
7
|
|
1997
|
use Crypt::Perl::PKCS8 (); |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
639
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#cf. RFC 3447 appendix A.1.1 |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
#replacing INTEGER with FG_FAUX_INTEGER to facilitate “lite” mode |
11
|
|
|
|
|
|
|
#which doesn’t bring in Math::BigInt. |
12
|
|
|
|
|
|
|
my $ASN1_TEMPLATE = q< |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
FG_FAUX_INTEGER ::= |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
RSAPublicKey ::= SEQUENCE { |
17
|
|
|
|
|
|
|
modulus FG_FAUX_INTEGER, -- n |
18
|
|
|
|
|
|
|
publicExponent FG_FAUX_INTEGER -- e |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
-- FG: simplified from RFC for Convert::ASN1 |
22
|
|
|
|
|
|
|
Version ::= INTEGER |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
OtherPrimeInfo ::= SEQUENCE { |
25
|
|
|
|
|
|
|
prime FG_FAUX_INTEGER, -- ri |
26
|
|
|
|
|
|
|
exponent FG_FAUX_INTEGER, -- di |
27
|
|
|
|
|
|
|
coefficient FG_FAUX_INTEGER -- ti |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
-- FG: simplified from RFC for Convert::ASN1 |
31
|
|
|
|
|
|
|
OtherPrimeInfos ::= SEQUENCE OF OtherPrimeInfo |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
RSAPrivateKey ::= SEQUENCE { |
34
|
|
|
|
|
|
|
version Version, |
35
|
|
|
|
|
|
|
modulus FG_FAUX_INTEGER, -- n |
36
|
|
|
|
|
|
|
publicExponent INTEGER, -- e |
37
|
|
|
|
|
|
|
privateExponent FG_FAUX_INTEGER, -- d |
38
|
|
|
|
|
|
|
prime1 FG_FAUX_INTEGER, -- p |
39
|
|
|
|
|
|
|
prime2 FG_FAUX_INTEGER, -- q |
40
|
|
|
|
|
|
|
exponent1 FG_FAUX_INTEGER, -- d mod (p-1) |
41
|
|
|
|
|
|
|
exponent2 FG_FAUX_INTEGER, -- d mod (q-1) |
42
|
|
|
|
|
|
|
coefficient FG_FAUX_INTEGER, -- (inverse of q) mod p |
43
|
|
|
|
|
|
|
otherPrimeInfos OtherPrimeInfos OPTIONAL |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
> . Crypt::Perl::PKCS8::ASN1(); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub get_template { |
48
|
344
|
|
|
344
|
0
|
19206
|
my ($what_is_big_fat_int) = @_; |
49
|
|
|
|
|
|
|
|
50
|
344
|
|
|
|
|
826
|
my $template = $ASN1_TEMPLATE; |
51
|
344
|
|
|
|
|
3106
|
$template =~ s//$what_is_big_fat_int/; |
52
|
|
|
|
|
|
|
|
53
|
344
|
|
|
|
|
1706
|
return $template; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |