@Override
    public void initialize(AlgorithmParameterSpec param, SecureRandom random)
            throws InvalidAlgorithmParameterException {
        if (param instanceof ECParameterSpec) {
            ECParameterSpec ecParam = (ECParameterSpec) param;

            group = OpenSSLECGroupContext.getInstance(ecParam);
        } else if (param instanceof ECGenParameterSpec) {
            ECGenParameterSpec ecParam = (ECGenParameterSpec) param;

            final String curveName = ecParam.getName();

            /*
             * Store the group in a temporary variable until we know this is a
             * valid group.
             */
            final OpenSSLECGroupContext possibleGroup = OpenSSLECGroupContext
                    .getCurveByName(curveName);
            if (possibleGroup == null) {
                throw new InvalidAlgorithmParameterException("unknown curve name: " + curveName);
            }

            group = possibleGroup;
        } else {
            throw new InvalidAlgorithmParameterException(
                    "parameter must be ECParameterSpec or ECGenParameterSpec");
        }
    }
An implementation of {@link KeyPairGenerator} for EC keys which uses BoringSSL to perform all the
operations.
common/src/main/java/org/conscrypt/OpenSSLECKeyPairGenerator.java