本文整理汇总了Java中org.bouncycastle.crypto.agreement.DHStandardGroups类的典型用法代码示例。如果您正苦于以下问题:Java DHStandardGroups类的具体用法?Java DHStandardGroups怎么用?Java DHStandardGroups使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DHStandardGroups类属于org.bouncycastle.crypto.agreement包,在下文中一共展示了DHStandardGroups类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: performTest
import org.bouncycastle.crypto.agreement.DHStandardGroups; //导入依赖的package包/类
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");
}
}
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:20,代码来源:CramerShoupTest.java
示例2: encrypt
import org.bouncycastle.crypto.agreement.DHStandardGroups; //导入依赖的package包/类
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;
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:27,代码来源:CramerShoupTest.java
示例3: getDHParameters
import org.bouncycastle.crypto.agreement.DHStandardGroups; //导入依赖的package包/类
protected DHParameters getDHParameters()
{
return DHStandardGroups.rfc5114_1024_160;
}
开发者ID:Appdome,项目名称:ipack,代码行数:5,代码来源:DefaultTlsServer.java
示例4: getDHParameters
import org.bouncycastle.crypto.agreement.DHStandardGroups; //导入依赖的package包/类
protected DHParameters getDHParameters()
{
return DHStandardGroups.rfc5114_2048_256;
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:5,代码来源:DefaultTlsServer.java
注:本文中的org.bouncycastle.crypto.agreement.DHStandardGroups类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论