part2
Class SimpleRSAPublicKey

java.lang.Object
  extended bypart2.SimpleRSAPublicKey
All Implemented Interfaces:
RSAPublicKey
Direct Known Subclasses:
RSAPublicKeyWithAppendix, RSAPublicKeyWithRecovery

public class SimpleRSAPublicKey
extends java.lang.Object
implements RSAPublicKey

A class that implements an RSA public key.


Constructor Summary
SimpleRSAPublicKey(java.math.BigInteger n, java.math.BigInteger e)
          A constructor for an RSA public key with modulus n and public exponent e.
SimpleRSAPublicKey(SimpleRSAPublicKey key)
          A copy constructor for an RSA public key.
 
Method Summary
 java.math.BigInteger encrypt(java.math.BigInteger m)
          A method to encrypt the big integer m using this public key.
 java.util.AbstractList encrypt(java.lang.String s)
          A method to encrypt the string s using this public key.
 java.math.BigInteger modulus()
          A method to return the modulus of this public RSA key.
 java.math.BigInteger publicExponent()
          A method to return the public exponent of this public RSA key.
 java.lang.String toString()
          A method to produce a string representation of this public RSA key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleRSAPublicKey

public SimpleRSAPublicKey(java.math.BigInteger n,
                          java.math.BigInteger e)
                   throws java.lang.Exception
A constructor for an RSA public key with modulus n and public exponent e.

Throws:
Exception.
java.lang.Exception

SimpleRSAPublicKey

public SimpleRSAPublicKey(SimpleRSAPublicKey key)
                   throws java.lang.Exception
A copy constructor for an RSA public key.

Throws:
Exception.
java.lang.Exception
Method Detail

modulus

public java.math.BigInteger modulus()
                             throws java.lang.Exception
A method to return the modulus of this public RSA key.

Throws:
Exception.
java.lang.Exception

publicExponent

public java.math.BigInteger publicExponent()
                                    throws java.lang.Exception
A method to return the public exponent of this public RSA key.

Throws:
Exception.
java.lang.Exception

toString

public java.lang.String toString()
A method to produce a string representation of this public RSA key.

Throws:
Exception.

encrypt

public java.math.BigInteger encrypt(java.math.BigInteger m)
                             throws java.lang.Exception
A method to encrypt the big integer m using this public key.

Specified by:
encrypt in interface RSAPublicKey
Throws:
Exception.
java.lang.Exception

encrypt

public java.util.AbstractList encrypt(java.lang.String s)
                               throws java.lang.Exception
A method to encrypt the string s using this public key.

Specified by:
encrypt in interface RSAPublicKey
Returns:
A list of BigInteger objects.
Throws:
Exception.
java.lang.Exception