java.lang.ObjectRSA
public class RSA
| Constructor Summary | |
|---|---|
RSA(int numBits)
Constructs an RSA cryptosystem using a random modulus and exponents of specified bit length. |
|
RSA(String keyFile)
Constructs an RSA cryptosystem using a modulus and exponent read from a file. |
|
| Method Summary | |
|---|---|
void |
decrypt()
Decrypt the standard input stream using the modulus and exponent in this RSA cryptosystem. |
void |
encrypt()
Encrypt the standard input stream using the modulus and exponent in this RSA cryptosystem. |
static void |
main(String[] arguments)
Encrypts or decrypts by command-line arguments using an RSA cryptosystem. |
void |
printKeys()
Print the keys in this RSA cryptosystem to the standard output stream. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RSA(int numBits)
numBits - The number of bits in the modulus and exponents.
public RSA(String keyFile)
throws FileNotFoundException,
IOException
keyFile - The name of a file containing a modulus and exponent.
FileNotFoundException
IOException| Method Detail |
|---|
public void decrypt()
throws IOException
decrypt in interface AbstractRSAIOException
public void encrypt()
throws IOException
encrypt in interface AbstractRSAIOException
public static void main(String[] arguments)
throws IOException
Encrypts or decrypts by command-line arguments using an RSA cryptosystem.
arguments - Command-line arguments controlling the cryptosystem.
The following arguments are meaningful, and have the following effects:
-g numBits- Print random keys of bit length
numBitsto the standard output stream.-e keyFile- Encrypt the standard input stream using the modulus and exponent in the file named
keyFile.-d keyFile- Decrypt the standard input stream using the modulus and exponent in the file named
keyFile.
IOException - if an I/O error occurs.public void printKeys()
printKeys in interface AbstractRSA