DhParameters { public static DHParameterSpec getStaticDhParams() { return new DHParameterSpec(DhPvalue, DhGvalue); } private  DhParameters(); static DHParameterSpec getStaticDhParams();  }
@Test public void testGetStaticDhParams() throws InvalidParameterSpecException, NoSuchAlgorithmException { AlgorithmParameterGenerator paramGen = AlgorithmParameterGenerator.getInstance("DH"); SecureRandom commonRand = SecureRandom.getInstance("SHA1PRNG"); commonRand.setSeed(new byte[] { 0x42 }); paramGen.init(2048, commonRand); AlgorithmParameters params = paramGen.generateParameters(); assertEquals(params.getParameterSpec(DHParameterSpec.class).getG(), DhParameters.getStaticDhParams().getG()); assertEquals(params.getParameterSpec(DHParameterSpec.class).getP(), DhParameters.getStaticDhParams().getP()); }