1VOMS::Lite::RSAKey(3) User Contributed Perl DocumentationVOMS::Lite::RSAKey(3)
2
3
4
6 VOMS::Lite::RSAKey - Perl extension for RSA Key Generation
7
9 use VOMS::Lite::RSAKey;
10 %RSAKey = %{ VOMS::Lite::RSAKey::Create(%inputref) };
11
13 VOMS::Lite::RSAKey::Create
14 Generates an RSA key using the MillerRabin Prime search for probable primes.
15 %inputref may have the following set
16 Bits => bits e.g. 512
17 RandomFile /path/to/random e.g. /dev/random or /dev/urandom,
18 or a reference to a function where:
19 $_[0] contains the number of bytes of random
20 Returns a string of random bytes.
21 Verbose => 'y'
22
23 returns
24 A reference to a hash: either:
25 Errors ( a regernec to an array of errors )
26 - or -
27 Modulus, PublicExponent, PrivateExponent, Prime1, Prime2,
28 Exponent1, Exponent2, Phi
29 and
30 Bits = the number of bits for generated key
31
32 VOMS::Lite::RSAKey::Random
33 Math::BigInt Random ( \%inputref );
34 where %inputref consists of:
35 Bits => number of bits of random number to generate e.g. 256
36 - or -
37 Upper => upper limit of random number to generate (scalar or Math::BigInt)
38 Lower => lower limit (default = 0)
39
40 Parity => "Odd" | "Even"
41
42 returns Math::BigInt object;
43
44 VOMS::Lite::RSAKey::Finder
45 Finder( \%inputref ) finds the next 'probable' prime number after a given number.
46 where %inputref consists of:
47 Start => (number scalar or Math::BigInt to start searching at)
48 Tests => a string consisting of DFSM (tests are performed in the order specified)
49 D is VOMS::Lite::RSAKey::DivisionTest
50 F is VOMS::Lite::RSAKey::FermatTest
51 S is VOMS::Lite::RSAKey::SolovayStrassenTest
52 M is VOMS::Lite::RSAKey::MillerRabinTest
53 Default is 'M'.
54 %inputref is passed through as an input to the above tests.
55
56 Returns reference to hash which includes either
57 Errors a reference to an array of errors
58 - or -
59 Candidate => Math::BigInt prime candidate
60
61 VOMS::Lite::RSAKey::DivisionTest
62 DivisionTest( \%inputref ) tests the candidate for primality
63 by division by known small primes (upto the first 10000).
64 This is a slow implementation.
65 %inputref consist of
66 Candidate => scalar or Math::BigInt to test
67 D = the number of prime divisors to test; the default is the maximum 10000
68 returns 0 if Candidate has small prime divisor
69 otherwise returns 1
70
71 VOMS::Lite::RSAKey::FermatTest
72 FermatTest( \%inputref ) tests the candidate for probable primality
73 This is not a good test
74 %inputref consist of
75 Candidate => scalar or Math::BigInt to test
76 F = the number of random divisors to test; the default is 10
77 returns 0 if composite
78 returns 1 if probably prime
79
80 VOMS::Lite::RSAKey::SolovayStrassenTest
81 SolovayStrassenTest( \%inputref ) tests the candidate for probable primality
82 This is a slow test and not as good as the MillerRabinTest
83 %inputref consist of
84 Candidate => scalar or Math::BigInt to test
85 S = the number of random divisors to test; the default is 10
86 returns 0 if composite
87 returns 1 if probably prime
88
89 VOMS::Lite::RSAKey::JacobiSymbol
90 Used by SolovayStrassenTest
91
92 VOMS::Lite::RSAKey::MillerRabinTest
93 MillerRabinTest( \%inputref ) tests the candidate for probable primality
94 %inputref consist of
95 Candidate => scalar or Math::BigInt to test
96 M = the number of random divisors to test; the default is
97 calculated based upon table Handbook of Applied Cryptography table 4.4
98 returns 0 if composite
99 returns 1 if probably prime
100
101 EXPORT
102 None by default;
103
105 http://www.rcs.manchester.ac.uk/research/sarongs
106
107 This module was originally designed for the SARoNGS project at The
108 University of Manchester for the NGS.
109 http://www.rcs.manchester.ac.uk/research/sarongs http://www.ngs.ac.uk
110
111 Handbook of Applied Cryptography, CRC Press, ISBN: 0-8493-8523-7,
112 October 1996.
113
115 Mike Jones <mike.jones@manchester.ac.uk>
116
118 Copyright (C) 2006 2010 by Mike Jones
119
120 This library is free software; you can redistribute it and/or modify it
121 under the same terms as Perl itself, either Perl version 5.8.3 or, at
122 your option, any later version of Perl 5 you may have available.
123
124
125
126perl v5.12.3 2011-03-17 VOMS::Lite::RSAKey(3)