Java 类org.bouncycastle.asn1.sec.SECNamedCurves 实例源码

项目:ipack    文件:TlsECCUtils.java   
public static ECDomainParameters getParametersForNamedCurve(int namedCurve)
{
    String curveName = getNameOfNamedCurve(namedCurve);
    if (curveName == null)
    {
        return null;
    }

    // Lazily created the first time a particular curve is accessed
    X9ECParameters ecP = SECNamedCurves.getByName(curveName);

    if (ecP == null)
    {
        return null;
    }

    // It's a bit inefficient to do this conversion every time
    return new ECDomainParameters(ecP.getCurve(), ecP.getG(), ecP.getN(), ecP.getH(), ecP.getSeed());
}
项目:ipack    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve. The routine returns null if the curve is not present.
 *
 * @param name the name of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByName(
    String name)
{
    X9ECParameters ecP = X962NamedCurves.getByName(name);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = NISTNamedCurves.getByName(name);
    }

    return ecP;
}
项目:ipack    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve.
 *
 * @param oid the object id of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByOID(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters ecP = X962NamedCurves.getByOID(oid);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByOID(oid);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByOID(oid);
    }

    return ecP;
}
项目:ipack    文件:ECUtil.java   
public static ASN1ObjectIdentifier getNamedCurveOid(
    String name)
{
    ASN1ObjectIdentifier oid = X962NamedCurves.getOID(name);

    if (oid == null)
    {
        oid = SECNamedCurves.getOID(name);
        if (oid == null)
        {
            oid = NISTNamedCurves.getOID(name);
        }
        if (oid == null)
        {
            oid = TeleTrusTNamedCurves.getOID(name);
        }
        if (oid == null)
        {
            oid = ECGOST3410NamedCurves.getOID(name);
        }
    }

    return oid;
}
项目:ipack    文件:ECUtil.java   
public static X9ECParameters getNamedCurveByOid(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters params = X962NamedCurves.getByOID(oid);

    if (params == null)
    {
        params = SECNamedCurves.getByOID(oid);
        if (params == null)
        {
            params = NISTNamedCurves.getByOID(oid);
        }
        if (params == null)
        {
            params = TeleTrusTNamedCurves.getByOID(oid);
        }
    }

    return params;
}
项目:ipack    文件:ECUtil.java   
public static String getCurveName(
    ASN1ObjectIdentifier oid)
{
    String name = X962NamedCurves.getName(oid);

    if (name == null)
    {
        name = SECNamedCurves.getName(oid);
        if (name == null)
        {
            name = NISTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = TeleTrusTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = ECGOST3410NamedCurves.getName(oid);
        }
    }

    return name;
}
项目:gwt-crypto    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve.
 *
 * @param oid the object id of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByOID(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters ecP = X962NamedCurves.getByOID(oid);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByOID(oid);
    }

    // NOTE: All the NIST curves are currently from SEC, so no point in redundant OID lookup

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByOID(oid);
    }

    if (ecP == null)
    {
        ecP = ANSSINamedCurves.getByOID(oid);
    }

    return ecP;
}
项目:SSI_Bitcoin-Storage    文件:Address.java   
/*************
 * This method will create the ECDSA public and private key which is returned in a Byte array of Byte arrays, index 0 is the private key and
 * index 1 of the array will return the ECDSA public key
 * 
 * -Wisdom: This guy didn't check whether the returned Private Key would be more than 32.
 * @return

 */
private byte[][] ECDSAgeneratePublicAndPrivateKey(){
       int length = 0;
       byte[][] keys;

    do{

    ECKeyPairGenerator gen = new ECKeyPairGenerator();
    SecureRandom secureRandom = new SecureRandom();
        X9ECParameters secnamecurves = SECNamedCurves.getByName("secp256k1");
    ECDomainParameters ecParams = new ECDomainParameters(secnamecurves.getCurve(), secnamecurves.getG(), secnamecurves.getN(), secnamecurves.getH());
    ECKeyGenerationParameters keyGenParam = new ECKeyGenerationParameters(ecParams, secureRandom);
    gen.init(keyGenParam);
    AsymmetricCipherKeyPair kp = gen.generateKeyPair();
    ECPrivateKeyParameters privatekey = (ECPrivateKeyParameters)kp.getPrivate();
    ECPoint dd = secnamecurves.getG().multiply(privatekey.getD());
    byte[] publickey=new byte[65];
    System.arraycopy(dd.getY().toBigInteger().toByteArray(), 0, publickey, 64-dd.getY().toBigInteger().toByteArray().length+1, dd.getY().toBigInteger().toByteArray().length);
    System.arraycopy(dd.getX().toBigInteger().toByteArray(), 0, publickey, 32-dd.getX().toBigInteger().toByteArray().length+1, dd.getX().toBigInteger().toByteArray().length);
    publickey[0]=4;
        length = privatekey.getD().toByteArray().length;
        keys = new byte[][]{privatekey.getD().toByteArray(),publickey};

    }while(length != 32);
    return keys;
}
项目:Aki-SSL    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve.
 *
 * @param oid the object id of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByOID(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters ecP = X962NamedCurves.getByOID(oid);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByOID(oid);
    }

    // NOTE: All the NIST curves are currently from SEC, so no point in redundant OID lookup

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByOID(oid);
    }

    if (ecP == null)
    {
        ecP = ANSSINamedCurves.getByOID(oid);
    }

    return ecP;
}
项目:Aki-SSL    文件:ECUtil.java   
public static X9ECParameters getNamedCurveByOid(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters params = CustomNamedCurves.getByOID(oid);

    if (params == null)
    {
        params = X962NamedCurves.getByOID(oid);
        if (params == null)
        {
            params = SECNamedCurves.getByOID(oid);
        }
        if (params == null)
        {
            params = NISTNamedCurves.getByOID(oid);
        }
        if (params == null)
        {
            params = TeleTrusTNamedCurves.getByOID(oid);
        }
    }

    return params;
}
项目:Aki-SSL    文件:ECUtil.java   
public static X9ECParameters getNamedCurveByName(
    String curveName)
{
    X9ECParameters params = CustomNamedCurves.getByName(curveName);

    if (params == null)
    {
        params = X962NamedCurves.getByName(curveName);
        if (params == null)
        {
            params = SECNamedCurves.getByName(curveName);
        }
        if (params == null)
        {
            params = NISTNamedCurves.getByName(curveName);
        }
        if (params == null)
        {
            params = TeleTrusTNamedCurves.getByName(curveName);
        }
    }

    return params;
}
项目:Aki-SSL    文件:ECUtil.java   
public static String getCurveName(
    ASN1ObjectIdentifier oid)
{
    String name = X962NamedCurves.getName(oid);

    if (name == null)
    {
        name = SECNamedCurves.getName(oid);
        if (name == null)
        {
            name = NISTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = TeleTrusTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = ECGOST3410NamedCurves.getName(oid);
        }
    }

    return name;
}
项目:UAF    文件:NamedCurve.java   
public static boolean verifyUsingSecp256k1(byte[] pub, byte[] dataForSigning,
        BigInteger[] rs) throws Exception {
    ECDSASigner signer = new ECDSASigner();
    X9ECParameters params = SECNamedCurves.getByName("secp256k1");
    ECDomainParameters ecParams = new ECDomainParameters(params.getCurve(),
            params.getG(), params.getN(), params.getH());
    ECPublicKeyParameters pubKeyParams = new ECPublicKeyParameters(ecParams
            .getCurve().decodePoint(pub), ecParams);
    signer.init(false, pubKeyParams);

    return signer.verifySignature(dataForSigning, rs[0].abs(), rs[1].abs());
}
项目:TinyTravelTracker    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve. The routine returns null if the curve is not present.
 *
 * @param name the name of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByName(
    String name)
{
    X9ECParameters ecP = X962NamedCurves.getByName(name);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = NISTNamedCurves.getByName(name);
    }

    return ecP;
}
项目:TinyTravelTracker    文件:ECNamedCurveTable.java   
/**
 * return the object identifier signified by the passed in name. Null
 * if there is no object identifier associated with name.
 *
 * @return the object identifier associated with name, if present.
 */
public static ASN1ObjectIdentifier getOID(
    String name)
{
    ASN1ObjectIdentifier oid = X962NamedCurves.getOID(name);

    if (oid == null)
    {
        oid = SECNamedCurves.getOID(name);
    }

    if (oid == null)
    {
        oid = TeleTrusTNamedCurves.getOID(name);
    }

    if (oid == null)
    {
        oid = NISTNamedCurves.getOID(name);
    }

    return oid;
}
项目:TinyTravelTracker    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve.
 *
 * @param oid the object id of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByOID(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters ecP = X962NamedCurves.getByOID(oid);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByOID(oid);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByOID(oid);
    }

    // NOTE: All the NIST curves are currently from SEC, so no point in redundant OID lookup

    return ecP;
}
项目:OpenAM-U2F    文件:CryptoHelper.java   
/**
 * 
 * @param encodedPublicKey This is the (uncompressed) x,y-representation of a curve point on the P-256 NIST elliptic curve.
 * @return
 */
public static PublicKey decodePublicKey(byte[] encodedPublicKey) {
    PublicKey result = null;

    try {

        X9ECParameters curve = SECNamedCurves.getByName("secp256r1");
        ECPoint point = curve.getCurve().decodePoint(encodedPublicKey);

        result = KeyFactory.getInstance("ECDSA",new BouncyCastleProvider()).generatePublic(new ECPublicKeySpec(point, new ECParameterSpec(curve.getCurve(), curve.getG(), curve.getN(), curve.getH())));

    } catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
            e.printStackTrace();
    }

    return result;
}
项目:CryptMeme    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve. The routine returns null if the curve is not present.
 *
 * @param name the name of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByName(
    String name)
{
    X9ECParameters ecP = X962NamedCurves.getByName(name);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = NISTNamedCurves.getByName(name);
    }

    return ecP;
}
项目:CryptMeme    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve.
 *
 * @param oid the object id of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByOID(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters ecP = X962NamedCurves.getByOID(oid);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByOID(oid);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByOID(oid);
    }

    // NOTE: All the NIST curves are currently from SEC, so no point in redundant OID lookup

    return ecP;
}
项目:CryptMeme    文件:ECUtil.java   
public static ASN1ObjectIdentifier getNamedCurveOid(
    String name)
{
    ASN1ObjectIdentifier oid = X962NamedCurves.getOID(name);

    if (oid == null)
    {
        oid = SECNamedCurves.getOID(name);
        if (oid == null)
        {
            oid = NISTNamedCurves.getOID(name);
        }
        if (oid == null)
        {
            oid = TeleTrusTNamedCurves.getOID(name);
        }
        if (oid == null)
        {
            oid = ECGOST3410NamedCurves.getOID(name);
        }
    }

    return oid;
}
项目:CryptMeme    文件:ECUtil.java   
public static X9ECParameters getNamedCurveByOid(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters params = X962NamedCurves.getByOID(oid);

    if (params == null)
    {
        params = SECNamedCurves.getByOID(oid);
        if (params == null)
        {
            params = NISTNamedCurves.getByOID(oid);
        }
        if (params == null)
        {
            params = TeleTrusTNamedCurves.getByOID(oid);
        }
    }

    return params;
}
项目:CryptMeme    文件:ECUtil.java   
public static String getCurveName(
    ASN1ObjectIdentifier oid)
{
    String name = X962NamedCurves.getName(oid);

    if (name == null)
    {
        name = SECNamedCurves.getName(oid);
        if (name == null)
        {
            name = NISTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = TeleTrusTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = ECGOST3410NamedCurves.getName(oid);
        }
    }

    return name;
}
项目:ximix    文件:ECCommittedSecretShareMessageTest.java   
@Test
public void testEncoding()
    throws IOException
{
    X9ECParameters params = SECNamedCurves.getByName("secp256r1");
    ECDomainParameters domainParams = new ECDomainParameters(params.getCurve(), params.getG(), params.getN(), params.getH(), params.getSeed());

    ECPoint[]   factors = new ECPoint[] { domainParams.getCurve().decodePoint(cf1_1), domainParams.getCurve().decodePoint(cf1_2) };
    ECPoint[]   qFactors = new ECPoint[] { domainParams.getCurve().decodePoint(cf2_2), domainParams.getCurve().decodePoint(cf2_1) };

    ECCommittedSecretShareMessage msg1 = new ECCommittedSecretShareMessage(0, v1, w1, factors, domainParams.getCurve().decodePoint(cf1_1), qFactors);

    ECCommittedSecretShareMessage msg2 = ECCommittedSecretShareMessage.getInstance(domainParams.getCurve(), msg1.getEncoded());

    Assert.assertEquals(v1, msg2.getValue());
    Assert.assertEquals(w1, msg2.getWitness());
    Assert.assertEquals(factors[0], msg2.getCommitmentFactors()[0]);
    Assert.assertEquals(factors[1], msg2.getCommitmentFactors()[1]);
    Assert.assertEquals(factors[0], msg2.getQ());
    Assert.assertEquals(qFactors[0], msg2.getQCommitmentFactors()[0]);
    Assert.assertEquals(qFactors[1], msg2.getQCommitmentFactors()[1]);
}
项目:ximix    文件:NewDKGTest.java   
private void doTestOnPeers(int numberOfPeers)
{
    X9ECParameters params = SECNamedCurves.getByName("secp256r1");

    ECKeyPairGenerator kpGen = new ECKeyPairGenerator();

    ECDomainParameters domainParams = new ECDomainParameters(params.getCurve(), params.getG(), params.getN(), params.getH(), params.getSeed());

    kpGen.init(new ECKeyGenerationParameters(domainParams, new SecureRandom()));

    AsymmetricCipherKeyPair[] kps = new AsymmetricCipherKeyPair[numberOfPeers];

    // Generate Private Keys - normally this would be done by each
    // individual server. For this example we will just create them in an
    // array.
    for (int i = 0; i < kps.length; i++)
    {
        kps[i] = kpGen.generateKeyPair();
    }

    doTest(domainParams, kps, numberOfPeers - 1, true, 1);
    doTest(domainParams, kps, numberOfPeers - 2, true, 1);
    doTest(domainParams, kps, numberOfPeers - 2, true, 1, 3);
    doTest(domainParams, kps, numberOfPeers - 1, false, 1, 3);
}
项目:ximix    文件:BasicShamirSharingTest.java   
private void doTestOnPeers(int numberOfPeers)
{
    X9ECParameters params = SECNamedCurves.getByName("secp256r1");

    ECKeyPairGenerator kpGen = new ECKeyPairGenerator();

    ECDomainParameters domainParams = new ECDomainParameters(params.getCurve(), params.getG(), params.getN(), params.getH(), params.getSeed());

    kpGen.init(new ECKeyGenerationParameters(domainParams, new SecureRandom()));

    AsymmetricCipherKeyPair[] kps = new AsymmetricCipherKeyPair[numberOfPeers];

    // Generate Private Keys - normally this would be done by each
    // individual server. For this example we will just create them in an
    // array.
    for (int i = 0; i < kps.length; i++)
    {
        kps[i] = kpGen.generateKeyPair();
    }

    doTest(domainParams, kps, numberOfPeers - 1, true, 1);
    doTest(domainParams, kps, numberOfPeers - 2, true, 1);
    doTest(domainParams, kps, numberOfPeers - 2, true, 1, 3);
    doTest(domainParams, kps, numberOfPeers - 1, false, 1, 3);
}
项目:oxAuth    文件:SHA256withECDSASignatureVerification.java   
@Override
 public PublicKey decodePublicKey(byte[] encodedPublicKey) throws SignatureException {
         X9ECParameters curve = SECNamedCurves.getByName("secp256r1");
         ECPoint point = curve.getCurve().decodePoint(encodedPublicKey);

         try {
    return KeyFactory.getInstance("ECDSA").generatePublic(
            new ECPublicKeySpec(point,
                    new ECParameterSpec(
                            curve.getCurve(),
                            curve.getG(),
                            curve.getN(),
                            curve.getH()
                    )
            )
    );
} catch (GeneralSecurityException ex) {
    throw new SignatureException(ex);
}
 }
项目:irma_future_id    文件:TlsECCUtils.java   
public static ECDomainParameters getParametersForNamedCurve(int namedCurve)
{
    String curveName = getNameOfNamedCurve(namedCurve);
    if (curveName == null)
    {
        return null;
    }

    // Lazily created the first time a particular curve is accessed
    X9ECParameters ecP = SECNamedCurves.getByName(curveName);

    if (ecP == null)
    {
        return null;
    }

    // It's a bit inefficient to do this conversion every time
    return new ECDomainParameters(ecP.getCurve(), ecP.getG(), ecP.getN(), ecP.getH(), ecP.getSeed());
}
项目:irma_future_id    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve. The routine returns null if the curve is not present.
 *
 * @param name the name of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByName(
    String name)
{
    X9ECParameters ecP = X962NamedCurves.getByName(name);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = NISTNamedCurves.getByName(name);
    }

    return ecP;
}
项目:irma_future_id    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve.
 *
 * @param oid the object id of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByOID(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters ecP = X962NamedCurves.getByOID(oid);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByOID(oid);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByOID(oid);
    }

    // NOTE: All the NIST curves are currently from SEC, so no point in redundant OID lookup

    return ecP;
}
项目:irma_future_id    文件:ECPointPerformanceTest.java   
private void randMult(final String curveName) throws Exception
{
    final X9ECParameters spec = SECNamedCurves.getByName(curveName);

    final BigInteger n = spec.getN();
    final ECPoint g = (ECPoint) spec.getG();
    final SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
    final BigInteger k = new BigInteger(n.bitLength() - 1, random);

    ECPoint qMultiply = null;
    long startTime = System.currentTimeMillis();
    for (int i = 0; i < NUM_ROUNDS; i++)
    {
        qMultiply = g.multiply(k);
    }
    long endTime = System.currentTimeMillis();

    double avgDuration = (double) (endTime - startTime) / NUM_ROUNDS;
    System.out.println(curveName);
    System.out.print("Millis   : ");
    System.out.println(avgDuration);
    System.out.println();
}
项目:irma_future_id    文件:ECPointTest.java   
/**
 * 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);
    }
}
项目:irma_future_id    文件:ECUtil.java   
public static ASN1ObjectIdentifier getNamedCurveOid(
    String name)
{
    ASN1ObjectIdentifier oid = X962NamedCurves.getOID(name);

    if (oid == null)
    {
        oid = SECNamedCurves.getOID(name);
        if (oid == null)
        {
            oid = NISTNamedCurves.getOID(name);
        }
        if (oid == null)
        {
            oid = TeleTrusTNamedCurves.getOID(name);
        }
        if (oid == null)
        {
            oid = ECGOST3410NamedCurves.getOID(name);
        }
    }

    return oid;
}
项目:irma_future_id    文件:ECUtil.java   
public static X9ECParameters getNamedCurveByOid(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters params = X962NamedCurves.getByOID(oid);

    if (params == null)
    {
        params = SECNamedCurves.getByOID(oid);
        if (params == null)
        {
            params = NISTNamedCurves.getByOID(oid);
        }
        if (params == null)
        {
            params = TeleTrusTNamedCurves.getByOID(oid);
        }
    }

    return params;
}
项目:irma_future_id    文件:ECUtil.java   
public static String getCurveName(
    ASN1ObjectIdentifier oid)
{
    String name = X962NamedCurves.getName(oid);

    if (name == null)
    {
        name = SECNamedCurves.getName(oid);
        if (name == null)
        {
            name = NISTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = TeleTrusTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = ECGOST3410NamedCurves.getName(oid);
        }
    }

    return name;
}
项目:irma_future_id    文件:ECUtil.java   
public static ASN1ObjectIdentifier getNamedCurveOid(
    String name)
{
    ASN1ObjectIdentifier oid = X962NamedCurves.getOID(name);

    if (oid == null)
    {
        oid = SECNamedCurves.getOID(name);
        if (oid == null)
        {
            oid = NISTNamedCurves.getOID(name);
        }
        if (oid == null)
        {
            oid = TeleTrusTNamedCurves.getOID(name);
        }
        if (oid == null)
        {
            oid = ECGOST3410NamedCurves.getOID(name);
        }
    }

    return oid;
}
项目:irma_future_id    文件:ECUtil.java   
public static X9ECParameters getNamedCurveByOid(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters params = X962NamedCurves.getByOID(oid);

    if (params == null)
    {
        params = SECNamedCurves.getByOID(oid);
        if (params == null)
        {
            params = NISTNamedCurves.getByOID(oid);
        }
        if (params == null)
        {
            params = TeleTrusTNamedCurves.getByOID(oid);
        }
    }

    return params;
}
项目:irma_future_id    文件:ECUtil.java   
public static String getCurveName(
    ASN1ObjectIdentifier oid)
{
    String name = X962NamedCurves.getName(oid);

    if (name == null)
    {
        name = SECNamedCurves.getName(oid);
        if (name == null)
        {
            name = NISTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = TeleTrusTNamedCurves.getName(oid);
        }
        if (name == null)
        {
            name = ECGOST3410NamedCurves.getName(oid);
        }
    }

    return name;
}
项目:bc-java    文件:TlsECCUtils.java   
public static ECDomainParameters getParametersForNamedCurve(int namedCurve)
{
    String curveName = getNameOfNamedCurve(namedCurve);
    if (curveName == null)
    {
        return null;
    }

    // Lazily created the first time a particular curve is accessed
    X9ECParameters ecP = SECNamedCurves.getByName(curveName);

    if (ecP == null)
    {
        return null;
    }

    // It's a bit inefficient to do this conversion every time
    return new ECDomainParameters(ecP.getCurve(), ecP.getG(), ecP.getN(), ecP.getH(), ecP.getSeed());
}
项目:bc-java    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve. The routine returns null if the curve is not present.
 *
 * @param name the name of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByName(
    String name)
{
    X9ECParameters ecP = X962NamedCurves.getByName(name);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByName(name);
    }

    if (ecP == null)
    {
        ecP = NISTNamedCurves.getByName(name);
    }

    return ecP;
}
项目:bc-java    文件:ECNamedCurveTable.java   
/**
 * return a X9ECParameters object representing the passed in named
 * curve.
 *
 * @param oid the object id of the curve requested
 * @return an X9ECParameters object or null if the curve is not available.
 */
public static X9ECParameters getByOID(
    ASN1ObjectIdentifier oid)
{
    X9ECParameters ecP = X962NamedCurves.getByOID(oid);

    if (ecP == null)
    {
        ecP = SECNamedCurves.getByOID(oid);
    }

    if (ecP == null)
    {
        ecP = TeleTrusTNamedCurves.getByOID(oid);
    }

    // NOTE: All the NIST curves are currently from SEC, so no point in redundant OID lookup

    return ecP;
}