part2
Class Utilities

java.lang.Object
  extended bypart2.Utilities

public class Utilities
extends java.lang.Object


Method Summary
static java.lang.String crack(SimpleRSAPublicKey key, java.util.AbstractList text)
          A method to crack RSA given a public key key and ciphertext text.
static java.math.BigInteger divm(java.math.BigInteger m, java.math.BigInteger a, java.math.BigInteger b)
          A method to compute the a divided by b modulo m.
static java.lang.String ecrack(SimpleRSAPublicKey key, java.util.AbstractList text)
          A method to crack RSA given a public key key and ciphertext text.
static java.util.AbstractList efactors(java.math.BigInteger n)
          A method to factorize a big integer n that is the product of two primes.
static java.math.BigInteger expm(java.math.BigInteger m, java.math.BigInteger a, java.math.BigInteger b)
          A method to compute the a to the power b modulo m.
static java.util.AbstractList factors(java.math.BigInteger n)
          A method to factorize n.
static java.math.BigInteger gcd(java.math.BigInteger a, java.math.BigInteger b)
          A method to determine the GCD of two positive big integers.
static java.util.AbstractList gcde(java.math.BigInteger a, java.math.BigInteger b)
          A method that implements the Extended Euclidean Algorithm.
static java.math.BigInteger generate(int d, java.security.SecureRandom rnd, PrimeTester tester)
          A method to generate a probable prime of length d bits where rnd is a source of randomness and tester is a primality tester.
static java.math.BigInteger invm(java.math.BigInteger m, java.math.BigInteger a)
          A method to compute the inverse of a modulo m.
static java.math.BigInteger phi(java.math.BigInteger n)
          A method to compute the Euler phi Function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

gcd

public static java.math.BigInteger gcd(java.math.BigInteger a,
                                       java.math.BigInteger b)
                                throws java.lang.Exception
A method to determine the GCD of two positive big integers.

Throws:
java.lang.Exception

gcde

public static java.util.AbstractList gcde(java.math.BigInteger a,
                                          java.math.BigInteger b)
                                   throws java.lang.Exception
A method that implements the Extended Euclidean Algorithm.

Returns:
A list of 3 big integer values (see the notes for the meanings of these values).
Throws:
java.lang.Exception

invm

public static java.math.BigInteger invm(java.math.BigInteger m,
                                        java.math.BigInteger a)
                                 throws java.lang.Exception
A method to compute the inverse of a modulo m.

Throws:
java.lang.Exception - if the inverse does not exist.

divm

public static java.math.BigInteger divm(java.math.BigInteger m,
                                        java.math.BigInteger a,
                                        java.math.BigInteger b)
                                 throws java.lang.Exception
A method to compute the a divided by b modulo m.

Throws:
java.lang.Exception - if division not possible.

expm

public static java.math.BigInteger expm(java.math.BigInteger m,
                                        java.math.BigInteger a,
                                        java.math.BigInteger b)
                                 throws java.lang.Exception
A method to compute the a to the power b modulo m.

Throws:
java.lang.Exception

factors

public static java.util.AbstractList factors(java.math.BigInteger n)
                                      throws java.lang.Exception
A method to factorize n.

Throws:
java.lang.Exception

efactors

public static java.util.AbstractList efactors(java.math.BigInteger n)
                                       throws java.lang.Exception
A method to factorize a big integer n that is the product of two primes. The result of this method is a list containing two big integer values.

Throws:
java.lang.Exception

phi

public static java.math.BigInteger phi(java.math.BigInteger n)
                                throws java.lang.Exception
A method to compute the Euler phi Function.

Throws:
java.lang.Exception

crack

public static java.lang.String crack(SimpleRSAPublicKey key,
                                     java.util.AbstractList text)
                              throws java.lang.Exception
A method to crack RSA given a public key key and ciphertext text.

Throws:
java.lang.Exception

ecrack

public static java.lang.String ecrack(SimpleRSAPublicKey key,
                                      java.util.AbstractList text)
                               throws java.lang.Exception
A method to crack RSA given a public key key and ciphertext text.

Throws:
java.lang.Exception

generate

public static java.math.BigInteger generate(int d,
                                            java.security.SecureRandom rnd,
                                            PrimeTester tester)
                                     throws java.lang.Exception
A method to generate a probable prime of length d bits where rnd is a source of randomness and tester is a primality tester.

Throws:
java.lang.Exception