Java 类org.bouncycastle.crypto.generators.DHParametersGenerator 实例源码

项目:ipack    文件:AlgorithmParameterGeneratorSpi.java   
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;
}
项目:Direct-File-Downloader    文件:JDKAlgorithmParameterGenerator.java   
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;
     }
项目:gwt-crypto    文件:SRP6Test.java   
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()));
}
项目:Aki-SSL    文件:AlgorithmParameterGeneratorSpi.java   
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;
}
项目:AcademicTorrents-Downloader    文件:JDKAlgorithmParameterGenerator.java   
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;
     }
项目:CryptMeme    文件:AlgorithmParameterGeneratorSpi.java   
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;
}
项目:irma_future_id    文件:SRP6Test.java   
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);
}
项目:irma_future_id    文件:AlgorithmParameterGeneratorSpi.java   
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;
}
项目:bc-java    文件:SRP6Test.java   
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);
}
项目:bc-java    文件:AlgorithmParameterGeneratorSpi.java   
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;
}