line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Perl::RSA::Template; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
77
|
use strict; |
|
8
|
|
|
|
|
19
|
|
|
8
|
|
|
|
|
300
|
|
4
|
8
|
|
|
8
|
|
66
|
use warnings; |
|
8
|
|
|
|
|
26
|
|
|
8
|
|
|
|
|
225
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
3549
|
use Crypt::Perl::PKCS8 (); |
|
8
|
|
|
|
|
33
|
|
|
8
|
|
|
|
|
1103
|
|
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
|
403
|
|
|
403
|
0
|
30947
|
my ($what_is_big_fat_int) = @_; |
49
|
|
|
|
|
|
|
|
50
|
403
|
|
|
|
|
1304
|
my $template = $ASN1_TEMPLATE; |
51
|
403
|
|
|
|
|
3997
|
$template =~ s//$what_is_big_fat_int/; |
52
|
|
|
|
|
|
|
|
53
|
403
|
|
|
|
|
2564
|
return $template; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |