@Override
    protected void engineInit(AlgorithmParameterSpec algorithmParameterSpec)
            throws InvalidParameterSpecException {
        if (algorithmParameterSpec instanceof ECGenParameterSpec) {
            String newCurveName = ((ECGenParameterSpec) algorithmParameterSpec).getName();
            OpenSSLECGroupContext newCurve = OpenSSLECGroupContext.getCurveByName(newCurveName);
            if (newCurve == null) {
                throw new InvalidParameterSpecException("Unknown EC curve name: " + newCurveName);
            }
            this.curve = newCurve;
        } else if (algorithmParameterSpec instanceof ECParameterSpec) {
            ECParameterSpec ecParamSpec = (ECParameterSpec) algorithmParameterSpec;
            try {
                OpenSSLECGroupContext newCurve = OpenSSLECGroupContext.getInstance(ecParamSpec);
                if (newCurve == null) {
                    throw new InvalidParameterSpecException("Unknown EC curve: " + ecParamSpec);
                }
                this.curve = newCurve;
            } catch (InvalidAlgorithmParameterException e) {
                throw new InvalidParameterSpecException(e.getMessage());
            }
        } else {
            throw new InvalidParameterSpecException(
                    "Only ECParameterSpec and ECGenParameterSpec are supported");
        }
    }
AlgorithmParameters implementation for elliptic curves.  The only supported encoding format is
ASN.1, as specified in RFC 3279, section 2.3.5.  However, only named curves are supported.
common/src/main/java/org/conscrypt/ECParameters.java