public static void main(String[] args) { SortedSet names = new TreeSet(enumToList(ECNamedCurveTable.getNames())); names.addAll(enumToList(CustomNamedCurves.getNames())); Iterator it = names.iterator(); while (it.hasNext()) { String name = (String)it.next(); X9ECParameters x9 = CustomNamedCurves.getByName(name); if (x9 == null) { x9 = ECNamedCurveTable.getByName(name); } if (x9 != null && ECAlgorithms.isF2mCurve(x9.getCurve())) { System.out.print(name + ":"); implPrintRootZ(x9); } } }
static X9ECParameters getX9Parameters(ASN1ObjectIdentifier curveOID) { return ECNamedCurveTable.getByOID(curveOID); } }
/** * return an enumeration of the names of the available curves. * * @return an enumeration of the names of the available curves. */ public static Enumeration getNames() { Vector v = new Vector(); addEnumeration(v, X962NamedCurves.getNames()); addEnumeration(v, SECNamedCurves.getNames()); addEnumeration(v, NISTNamedCurves.getNames()); addEnumeration(v, TeleTrusTNamedCurves.getNames()); addEnumeration(v, ANSSINamedCurves.getNames()); addEnumeration(v, GMNamedCurves.getNames()); return v.elements(); }
public static ASN1ObjectIdentifier getNamedCurveOid( ECParameterSpec ecParameterSpec) { for (Enumeration names = ECNamedCurveTable.getNames(); names.hasMoreElements();) { String name = (String)names.nextElement(); X9ECParameters params = ECNamedCurveTable.getByName(name); if (params.getN().equals(ecParameterSpec.getN()) && params.getH().equals(ecParameterSpec.getH()) && params.getCurve().equals(ecParameterSpec.getCurve()) && params.getG().equals(ecParameterSpec.getG())) { return org.spongycastle.asn1.x9.ECNamedCurveTable.getOID(name); } } return null; }
private static void discoverEndomorphisms(String curveName) { X9ECParameters x9 = ECNamedCurveTable.getByName(curveName); if (x9 == null) { System.err.println("Unknown curve: " + curveName); return; } ECCurve c = x9.getCurve(); if (ECAlgorithms.isFpCurve(c)) { BigInteger characteristic = c.getField().getCharacteristic(); if (c.getA().isZero() && characteristic.mod(ECConstants.THREE).equals(ECConstants.ONE)) { System.out.println("Curve '" + curveName + "' has a 'GLV Type B' endomorphism with these parameters:"); printGLVTypeBParameters(x9); } } }
private ECParameterSpec getECParameterSpec(ASN1ObjectIdentifier curveOid, X9ECParameters x9Params) throws InvalidParameterSpecException, NoSuchProviderException, NoSuchAlgorithmException { AlgorithmParameters params = helper.createAlgorithmParameters("EC"); params.init(new ECGenParameterSpec(ECNamedCurveTable.getName(curveOid))); return params.getParameterSpec(ECParameterSpec.class); } }
/** * return an enumeration of the names of the available curves. * * @return an enumeration of the names of the available curves. */ public static Enumeration getNames() { return org.spongycastle.asn1.x9.ECNamedCurveTable.getNames(); } }
PublicKeyPacket pubPacket = new PublicKeyPacket(PublicKeyAlgorithmTags.ECDSA, new Date(), new ECDSAPublicBCPGKey(ECNamedCurveTable.getOID(curveName), new BigInteger(1, qVal)));
public static ECDomainParameters getParametersForNamedCurve(int namedCurve) { String curveName = getNameOfNamedCurve(namedCurve); if (curveName == null) { return null; } // Parameters are lazily created the first time a particular curve is accessed X9ECParameters ecP = CustomNamedCurves.getByName(curveName); if (ecP == null) { ecP = ECNamedCurveTable.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()); }
@Override protected void engineInit(byte[] bytes, String format) throws IOException { if (isASN1FormatString(format)) { X962Parameters params = X962Parameters.getInstance(bytes); ECCurve curve = EC5Util.getCurve(BouncyCastleProvider.CONFIGURATION, params); if (params.isNamedCurve()) { ASN1ObjectIdentifier curveId = ASN1ObjectIdentifier.getInstance(params.getParameters()); curveName = ECNamedCurveTable.getName(curveId); if (curveName == null) { curveName = curveId.getId(); } } ecParameterSpec = EC5Util.convertToSpec(params, curve); } else { throw new IOException("Unknown encoded parameters format in AlgorithmParameters object: " + format); } }
static X9ECParameters getX9Parameters(ASN1ObjectIdentifier curveOID) { X9ECParameters x9 = CustomNamedCurves.getByOID(curveOID); if (x9 == null) { x9 = ECNamedCurveTable.getByOID(curveOID); } return x9; }
public static void main(String[] args) { SortedSet names = new TreeSet(enumToList(ECNamedCurveTable.getNames())); names.addAll(enumToList(CustomNamedCurves.getNames())); Iterator it = names.iterator(); while (it.hasNext()) { String name = (String)it.next(); X9ECParameters x9 = CustomNamedCurves.getByName(name); if (x9 == null) { x9 = ECNamedCurveTable.getByName(name); } if (x9 != null && ECAlgorithms.isF2mCurve(x9.getCurve())) { System.out.print(name + ":"); implPrintNonZeroTraceBits(x9); } } }
public static ECDomainParameters getDomainParameters(int namedGroup) { if (!NamedGroup.refersToASpecificCurve(namedGroup)) { return null; } String curveName = NamedGroup.getName(namedGroup); if (curveName == null) { return null; } // Parameters are lazily created the first time a particular curve is accessed X9ECParameters ecP = CustomNamedCurves.getByName(curveName); if (ecP == null) { ecP = ECNamedCurveTable.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()); }
this.keyStrength = ECNamedCurveTable.getByOID(((ECPublicBCPGKey)key).getCurveOID()).getCurve().getFieldSize();
protected ECNamedCurveSpec createNamedCurveSpec(String curveName) throws InvalidAlgorithmParameterException { // NOTE: Don't bother with custom curves here as the curve will be converted to JCE type shortly X9ECParameters p = ECUtils.getDomainParametersFromName(curveName); if (p == null) { try { // Check whether it's actually an OID string (SunJSSE ServerHandshaker setupEphemeralECDHKeys bug) p = ECNamedCurveTable.getByOID(new ASN1ObjectIdentifier(curveName)); if (p == null) { Map extraCurves = configuration.getAdditionalECParameters(); p = (X9ECParameters)extraCurves.get(new ASN1ObjectIdentifier(curveName)); if (p == null) { throw new InvalidAlgorithmParameterException("unknown curve OID: " + curveName); } } } catch (IllegalArgumentException ex) { throw new InvalidAlgorithmParameterException("unknown curve name: " + curveName); } } // Work-around for JDK bug -- it won't look up named curves properly if seed is present byte[] seed = null; //p.getSeed(); return new ECNamedCurveSpec(curveName, p.getCurve(), p.getG(), p.getN(), p.getH(), seed); }
if (x9 == null) x9 = ECNamedCurveTable.getByOID(oid);
if (x9 == null) x9 = ECNamedCurveTable.getByOID(oid);