List of usage examples for javax.crypto.spec DHParameterSpec getL
public int getL()
l
, of the random exponent (private value). From source file:Main.java
public static void main(String[] argv) throws Exception { AlgorithmParameterGenerator paramGen = AlgorithmParameterGenerator.getInstance("DH"); paramGen.init(1024);/*from ww w . j ava 2 s .c o m*/ AlgorithmParameters params = paramGen.generateParameters(); DHParameterSpec dhSpec = (DHParameterSpec) params.getParameterSpec(DHParameterSpec.class); System.out.println("" + dhSpec.getP() + "," + dhSpec.getG() + "," + dhSpec.getL()); }
From source file:org.apache.abdera2.common.security.DHBase.java
private void init() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidParameterSpecException, InvalidKeySpecException { AlgorithmParameterGenerator pgen = AlgorithmParameterGenerator.getInstance("DH"); pgen.init(512);/* w w w .ja v a 2 s . c o m*/ AlgorithmParameters params = pgen.generateParameters(); DHParameterSpec dhspec = (DHParameterSpec) params.getParameterSpec(DHParameterSpec.class); KeyPairGenerator keypairgen = KeyPairGenerator.getInstance("DH"); keypairgen.initialize(dhspec); keyPair = keypairgen.generateKeyPair(); p = dhspec.getP(); g = dhspec.getG(); l = dhspec.getL(); }