@Override
    public void initialize(int keysize, SecureRandom random) {
        final String name = SIZE_TO_CURVE_NAME.get(keysize);
        if (name == null) {
            throw new InvalidParameterException("unknown key size " + keysize);
        }

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

        group = possibleGroup;
    }
An implementation of {@link KeyPairGenerator} for EC keys which uses BoringSSL to perform all the
operations.
common/src/main/java/org/conscrypt/OpenSSLECKeyPairGenerator.java