line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::RSA::Template; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
48
|
use strict; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
138
|
|
4
|
6
|
|
|
6
|
|
24
|
use warnings; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
130
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
1940
|
use Crypt::Perl::PKCS8 (); |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
544
|
|
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
|
339
|
|
|
339
|
0
|
18880
|
my ($what_is_big_fat_int) = @_; |
49
|
|
|
|
|
|
|
|
50
|
339
|
|
|
|
|
973
|
my $template = $ASN1_TEMPLATE; |
51
|
339
|
|
|
|
|
2951
|
$template =~ s//$what_is_big_fat_int/; |
52
|
|
|
|
|
|
|
|
53
|
339
|
|
|
|
|
1670
|
return $template; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |