Package javax.crypto.spec

Examples of javax.crypto.spec.DHParameterSpec


        .getInstance(ALGORITHM);
    paramGen.init(1024);

    AlgorithmParameters params = paramGen.generateParameters();

    DHParameterSpec dhSpec = params.getParameterSpec(DHParameterSpec.class);
    System.out.println("l=" + dhSpec.getL());
    System.out.println("g=" + dhSpec.getG());
    System.out.println("p=" +dhSpec.getP());
  }
View Full Code Here


      }
     
      crypto_setup_done = true;
     
      try{
        DHParameterSpec dh_param_spec = new DHParameterSpec( DH_P_BI, DH_G_BI, DH_L );
       
        dh_key_generator = KeyPairGenerator.getInstance("DH");
           
        dh_key_generator.initialize(dh_param_spec);
           
View Full Code Here

            AlgorithmParameters params;

            try
            {
                params = AlgorithmParameters.getInstance("DH", "BC");
                params.init(new DHParameterSpec(p.getP(), p.getG(), l));
            }
            catch (Exception e)
            {
                throw new RuntimeException(e.getMessage());
            }
View Full Code Here

        super(name);
    }

    public void testGetDefaultParameterSha1() throws Exception
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.getDefaultParameter();

        assertNotNull(parameterSpec);

        assertEquals(2, parameterSpec.getG().intValue());
        assertEquals(DiffieHellmanSession.DEFAULT_MODULUS_HEX.length() * 4, parameterSpec.getP().bitLength());
    }
View Full Code Here

        assertEquals(DiffieHellmanSession.DEFAULT_MODULUS_HEX.length() * 4, parameterSpec.getP().bitLength());
    }

    public void testGetDefaultParameterSha256() throws Exception
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.getDefaultParameter();

        assertNotNull(parameterSpec);

        assertEquals(2, parameterSpec.getG().intValue());
        assertEquals(DiffieHellmanSession.DEFAULT_MODULUS_HEX.length() * 4, parameterSpec.getP().bitLength());
    }
View Full Code Here

        assertEquals(DiffieHellmanSession.DEFAULT_MODULUS_HEX.length() * 4, parameterSpec.getP().bitLength());
    }

    public void testGenerateRandomParameterSha1() throws Exception
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.generateRandomParameter(512, 256);

        assertNotNull(parameterSpec);

        assertEquals(512, parameterSpec.getP().bitLength());
    }
View Full Code Here

        assertEquals(512, parameterSpec.getP().bitLength());
    }

    public void testGenerateRandomParameterSha256() throws Exception
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.generateRandomParameter(512, 256);

        assertNotNull(parameterSpec);

        assertEquals(512, parameterSpec.getP().bitLength());
    }
View Full Code Here

        assertEquals(512, parameterSpec.getP().bitLength());
    }

    public void testGenerateKeyPairSha1Default()
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.getDefaultParameter();

        KeyPair keyPair = DiffieHellmanSession.generateKeyPair(parameterSpec);

        assertNotNull(keyPair);
    }
View Full Code Here

        assertNotNull(keyPair);
    }

    public void testGenerateKeyPairSha256Default()
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.getDefaultParameter();

        KeyPair keyPair = DiffieHellmanSession.generateKeyPair(parameterSpec);

        assertNotNull(keyPair);
    }
View Full Code Here

        assertNotNull(keyPair);
    }

    public void testGenerateKeyPairSha1Random()
    {
        DHParameterSpec parameterSpec = DiffieHellmanSession.generateRandomParameter(512, 256);

        KeyPair keyPair = DiffieHellmanSession.generateKeyPair(parameterSpec);

        assertNotNull(keyPair);
    }
View Full Code Here

TOP

Related Classes of javax.crypto.spec.DHParameterSpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.