当前位置: 首页>>代码示例>>Java>>正文


Java SECNamedCurves.getNames方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:30,代码来源:ECPointTest.java

示例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());
    }
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:44,代码来源:NamedCurveTest.java


注:本文中的org.bouncycastle.asn1.sec.SECNamedCurves.getNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。