本文整理汇总了Java中org.bouncycastle.asn1.sec.SECNamedCurves.getNames方法的典型用法代码示例。如果您正苦于以下问题:Java SECNamedCurves.getNames方法的具体用法?Java SECNamedCurves.getNames怎么用?Java SECNamedCurves.getNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.asn1.sec.SECNamedCurves
的用法示例。
在下文中一共展示了SECNamedCurves.getNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAddSubtractMultiplyTwiceEncoding
import org.bouncycastle.asn1.sec.SECNamedCurves; //导入方法依赖的package包/类
/**
* Calls <code>implTestAddSubtract()</code>,
* <code>implTestMultiply</code> and <code>implTestEncoding</code> for
* the standard elliptic curves as given in <code>SECNamedCurves</code>.
*/
public void testAddSubtractMultiplyTwiceEncoding()
{
Enumeration curveEnum = SECNamedCurves.getNames();
while (curveEnum.hasMoreElements())
{
String name = (String) curveEnum.nextElement();
X9ECParameters x9ECParameters = SECNamedCurves.getByName(name);
BigInteger n = x9ECParameters.getN();
// The generator is multiplied by random b to get random q
BigInteger b = new BigInteger(n.bitLength(), secRand);
ECPoint g = x9ECParameters.getG();
ECPoint q = g.multiply(b);
// Get point at infinity on the curve
ECPoint infinity = x9ECParameters.getCurve().getInfinity();
implTestAddSubtract(q, infinity);
implTestMultiply(q, n.bitLength());
implTestMultiply(infinity, n.bitLength());
implTestEncoding(q);
}
}
示例2: performTest
import org.bouncycastle.asn1.sec.SECNamedCurves; //导入方法依赖的package包/类
public void performTest()
throws Exception
{
testCurve("prime192v1"); // X9.62
testCurve("sect571r1"); // sec
testCurve("secp224r1");
testCurve("B-409"); // nist
testCurve("P-521");
testCurve("brainpoolp160r1"); // TeleTrusT
for (Enumeration en = X962NamedCurves.getNames(); en.hasMoreElements();)
{
testECDSA((String)en.nextElement());
}
// these curves can't be used under JDK 1.5
Set problemCurves = new HashSet();
problemCurves.add("secp256k1");
problemCurves.add("secp160k1");
problemCurves.add("secp224k1");
problemCurves.add("secp192k1");
for (Enumeration en = SECNamedCurves.getNames(); en.hasMoreElements();)
{
String curveName = (String)en.nextElement();
if (!problemCurves.contains(curveName))
{
testECDSA(curveName);
}
}
for (Enumeration en = TeleTrusTNamedCurves.getNames(); en.hasMoreElements();)
{
testECDSA((String)en.nextElement());
}
for (Enumeration en = ECGOST3410NamedCurves.getNames(); en.hasMoreElements();)
{
testECGOST((String)en.nextElement());
}
}