Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Main.java

00001 /*
00002  * Created on Oct 15, 2003
00003  *
00004  * To change the template for this generated file go to
00005  * Window>Preferences>Java>Code Generation>Code and Comments
00006  */
00007 package edu.virtualschool.jco.unfinished;
00008 import javax.crypto.spec.DHGenParameterSpec;
00015 public class Main
00016 {
00021   static int primeSize = 1024;
00022   static int exponentSize = 11;
00023   public static void main(String[] args)
00024   {
00025     try
00026     {
00027       DHGenParameterSpec spec = new DHGenParameterSpec(primeSize, exponentSize);
00028       System.out.println(spec);
00029     }
00030     catch (Throwable e)
00031     {
00032       e.printStackTrace();
00033     }
00034   }
00035 //  public AsymmetricCipherKeyPair foo()
00036 //  {
00037 //    SecureRandom r = new SecureRandom();
00038 //    DHParameters dhp = new DHParameters(p, g);
00039 //    DHKeyGenerationParameters param =  new DHKeyGenerationParameters(r, dhp);
00040 //
00041 //    int qLength = param.getStrength() - 1;
00042 //    DHParameters dhParams = param.getParameters();
00043 //    
00044 //    BigInteger p = dhParams.getP();
00045 //    BigInteger g = dhParams.getG();
00046 //
00047 //    BigInteger dhPrivateKey = new BigInteger(qLength, param.getRandom());
00048 //    BigInteger dhPublicKey = g.modPow(dhPrivateKey, p);
00049 //    
00050 //    return new AsymmetricCipherKeyPair(
00051 //      new DHPublicKeyParameters(dhPublicKey, dhParams),
00052 //      new DHPrivateKeyParameters(dhPrivateKey, dhParams));
00053 //  }
00054 }