Files Classes Functions Hierarchy
#include <rsa.h>
Public Member Functions | |
| rsaGenKey (uintc _nbits) | |
| Randomly generate key. | |
| rsaGenKey (uintc _nbits, string const &_p, string const &_q) | |
| Sequentially generate key. | |
| void | print () const |
| Prints the state, for debug purposes. | |
Public Attributes | |
| uintc | nbits |
| The number of bits. | |
| uint | blocksize |
| The block size. | |
| ZZ | p |
| The secret factor p. | |
| ZZ | q |
| The secret factor q. | |
| ZZ | e |
| The public exponent e. | |
| ZZ | n |
| The public product p*q. | |
| ZZ | n2 |
| The secret (p-1)*(q-1). | |
There are two ways to generate keys, these are accessed by two different constructor calls.
The result is two files generated, encrypt.txt and decrypt.txt . The encrypt.txt sould be public, but the decrypt.txt must be private because it contains the key.
Definition at line 77 of file rsa.h.
| rsaGenKey::rsaGenKey | ( | uintc | _nbits | ) |
Randomly generate key.
Definition at line 112 of file rsa.cpp.
References largePrimeGenerator::findprime_randomly(), nbits, and p.
00113 : nbits(_nbits) 00114 { 00115 assert(nbits>10); // Really want large primes! 00116 00117 lpg.findprime_randomly(p,nbits); 00118 lpg.findprime_randomly(q,nbits); 00119 00120 genkey(); 00121 }
| rsaGenKey::rsaGenKey | ( | uintc | _nbits, | |
| string const & | _p, | |||
| string const & | _q | |||
| ) |
| void rsaGenKey::print | ( | ) | const |
Prints the state, for debug purposes.
Definition at line 123 of file rsa.cpp.
References blocksize, e, n, n2, nbits, p, and SHOW.
00124 { 00125 cout << SHOW(p) << endl; 00126 cout << SHOW(q) << endl; 00127 cout << SHOW(e) << endl; 00128 cout << SHOW(n) << endl; 00129 cout << SHOW(n2) << endl; 00130 cout << SHOW(nbits) << endl; 00131 cout << SHOW(blocksize) << endl; 00132 }
| ZZ rsaGenKey::e |
| ZZ rsaGenKey::n |
| ZZ rsaGenKey::p |
| ZZ rsaGenKey::q |
1.5.8