j_waste.crypto
Class RSA

java.lang.Object
  extended byj_waste.crypto.RSA

public class RSA
extends java.lang.Object

This class handles the RSA encryption and decryption.

Version:
0.2
Author:
Fredrik Hultin (frehul@users.sourceforge.net)

Constructor Summary
RSA()
          Constructs a new RSA object and initializes the RSA encryption and decryption engines.
 
Method Summary
 byte[] decrypt(byte[] input)
          This method decrypts the specified array with the initialized private key.
 byte[] encrypt(byte[] input)
          This method encrypts the specified array with the initialized public key.
 void init(java.math.BigInteger pubMod, java.math.BigInteger pubExp, java.math.BigInteger privExp, java.math.BigInteger prime0, java.math.BigInteger prime1, java.math.BigInteger primeExp0, java.math.BigInteger primeExp1, java.math.BigInteger coefficient)
          This method initializes the RSA encryption and decryption with the specified parameters.
 void init(RSAKey rsaKey)
          This method initializes the RSA encryption and decryption with the specified key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSA

public RSA()
Constructs a new RSA object and initializes the RSA encryption and decryption engines.

Method Detail

init

public void init(java.math.BigInteger pubMod,
                 java.math.BigInteger pubExp,
                 java.math.BigInteger privExp,
                 java.math.BigInteger prime0,
                 java.math.BigInteger prime1,
                 java.math.BigInteger primeExp0,
                 java.math.BigInteger primeExp1,
                 java.math.BigInteger coefficient)
This method initializes the RSA encryption and decryption with the specified parameters.

Parameters:
pubMod - The modulo for the public key.
pubExp - The exponent for the public key.
privExp - The exponent for the private key.
prime0 - The first prime number.
prime1 - The second prime number.
primeExp0 - The exponent for the first prime.
primeExp1 - The exponent for the second prime.
coefficient - The coefficient.

init

public void init(RSAKey rsaKey)
This method initializes the RSA encryption and decryption with the specified key.

Parameters:
rsaKey - The key to initialize the RSA with.

encrypt

public byte[] encrypt(byte[] input)
This method encrypts the specified array with the initialized public key.

Parameters:
input - The input array that will be encrypted.
Returns:
Returns the encrypted array.

decrypt

public byte[] decrypt(byte[] input)
This method decrypts the specified array with the initialized private key.

Parameters:
input - The input array that will be decrypted.
Returns:
Returns the decrypted array.