/* * ***************************************************************************** * This stores the key numbers in a very insecure manner. Currently, only the * RSA class is using this, though if other schemes were implemented, the key(s) * for that could also reside here. * * ************************** * File: Key.java * This class: Key * Main class: Encryption * * $id * * ***************************************************************************** */ import java.io.*; import java.lang.*; import java.math.*; public class Key { /** * The semiprime must be above 256**3 = 16 777 216 for use with three ASCII * characters. This is not an industrial version, so we'll keep the * numbers quite small, and close to minimum requirements. As far as I * know, the size requirement applies only to the semiprime, not to either * of the original primes. * * Prime sources: * http://primes.utm.edu/mersenne/index.html#known * http://www.rsok.com/~jrm/printprimes.html * * According to * http://cs.marlboro.edu/term/fall04/web_perl/crypto/lecture.html , the * encryption exponent is usually 65537. * * To find the decryption exponent, enter ((prime1 - 1) * (prime2 - 1)) and * 65537 into * http://homepages.inf.ed.ac.uk/s0563270/maths/javascript/euclidean.php to * get 109017473. */ public static final BigInteger semiprime = new BigInteger("367129871"); public static final BigInteger prime1 = new BigInteger("2801"); // public static final BigInteger prime2 = new BigInteger("131071"); //2^17-1 public static final BigInteger exponent = new BigInteger("65537");//convent public static final BigInteger dexponent = new BigInteger("109017473"); public static final int semiprimeLength = 9; // hard-coding from semiprime }