protected AlgorithmParameters engineGenerateParameters() { DHParametersGenerator pGen = new DHParametersGenerator(); if (random != null) { pGen.init(strength, 20, random); } else { pGen.init(strength, 20, new SecureRandom()); } DHParameters p = pGen.generateParameters(); AlgorithmParameters params; try { params = AlgorithmParameters.getInstance("DH", BouncyCastleProvider.PROVIDER_NAME); params.init(new DHParameterSpec(p.getP(), p.getG(), l)); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } return params; }
protected AlgorithmParameters engineGenerateParameters() { DHParametersGenerator pGen = new DHParametersGenerator(); if ( random != null ) { pGen.init(strength, 20, random); } else { pGen.init(strength, 20, new SecureRandom()); } DHParameters p = pGen.generateParameters(); AlgorithmParameters params; try { params = AlgorithmParameters.getInstance("DH", BouncyCastleProvider.PROVIDER_NAME); params.init(new DHParameterSpec(p.getP(), p.getG(), l)); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } return params; }
private void testWithRandomParams(int bits) throws CryptoException { DHParametersGenerator paramGen = new DHParametersGenerator(); paramGen.init(bits, 25, random); DHParameters parameters = paramGen.generateParameters(); testMutualVerification(new SRP6GroupParameters(parameters.getP(), parameters.getG())); }
protected AlgorithmParameters engineGenerateParameters() { DHParametersGenerator pGen = new DHParametersGenerator(); if (random != null) { pGen.init(strength, 20, random); } else { pGen.init(strength, 20, new SecureRandom()); } DHParameters p = pGen.generateParameters(); AlgorithmParameters params; try { params = createParametersInstance("DH"); params.init(new DHParameterSpec(p.getP(), p.getG(), l)); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } return params; }
private void testWithRandomParams(int bits) throws CryptoException { DHParametersGenerator paramGen = new DHParametersGenerator(); paramGen.init(bits, 25, random); DHParameters parameters = paramGen.generateParameters(); BigInteger g = parameters.getG(); BigInteger p = parameters.getP(); testMutualVerification(p, g); }