Java 类org.bouncycastle.crypto.agreement.DHStandardGroups 实例源码

项目:gwt-crypto    文件:CramerShoupTest.java   
public void performTest()
    throws Exception
{
    BigInteger pSubOne = DHStandardGroups.rfc3526_2048.getP().subtract(ONE);
    for (int i = 0; i < 10; ++i)
    {
        BigInteger message = BigIntegers.createRandomInRange(ONE, pSubOne, RND);

        BigInteger m1 = encDecTest(message);
        BigInteger m2 = labelledEncDecTest(message, "myRandomLabel");
        BigInteger m3 = encDecEncodingTest(message);
        BigInteger m4 = labelledEncDecEncodingTest(message, "myOtherCoolLabel");

        if (!message.equals(m1) || !message.equals(m2) || !message.equals(m3) || !message.equals(m4))
        {
            fail("decrypted message != original message");
        }
    }
}
项目:gwt-crypto    文件:CramerShoupTest.java   
private CramerShoupCiphertext encrypt(BigInteger message, String label)
{
    CramerShoupKeyPairGenerator kpGen = new CramerShoupKeyPairGenerator();
    CramerShoupParametersGenerator pGen = new CramerShoupParametersGenerator();

    pGen.init(2048, 1, RND);
    CramerShoupParameters params = pGen.generateParameters(DHStandardGroups.rfc3526_2048);
    CramerShoupKeyGenerationParameters param = new CramerShoupKeyGenerationParameters(RND, params);

    kpGen.init(param);
    keyPair = kpGen.generateKeyPair();

    CramerShoupCoreEngine engine = new CramerShoupCoreEngine();
    if (label != null)
    {
        engine.init(true, keyPair.getPublic(), label);
    }
    else
    {
        engine.init(true, keyPair.getPublic());
    }

    CramerShoupCiphertext ciphertext = engine.encryptBlock(message);

    return ciphertext;
}
项目:ipack    文件:DefaultTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_1024_160;
}
项目:gwt-crypto    文件:DefaultTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_2048_256;
}
项目:gwt-crypto    文件:PSKTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_2048_256;
}
项目:Aki-SSL    文件:DefaultTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_2048_256;
}
项目:Aki-SSL    文件:PSKTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_2048_256;
}
项目:TinyTravelTracker    文件:DefaultTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_1024_160;
}
项目:TinyTravelTracker    文件:PSKTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_1024_160;
}
项目:CryptMeme    文件:DefaultTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_1024_160;
}
项目:irma_future_id    文件:DefaultTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_1024_160;
}
项目:bc-java    文件:DefaultTlsServer.java   
protected DHParameters getDHParameters()
{
    return DHStandardGroups.rfc5114_1024_160;
}