private static void handleExistingFileIfAny(Path filePath, boolean allowOverwrite) throws IOException {
        if (Files.exists(filePath)) {
            if (!allowOverwrite) {
                throw new IllegalArgumentException(("Output file '%s' already exists. No keys written. " +
                                                    "If you want to overwrite existing files, specify --%s.")
                                                   .formatted(filePath.toAbsolutePath().toString(), OVERWRITE_EXISTING_OPTION));
            } else {
                // Explicitly delete the file since Files.createFile() will fail if it already exists.
                Files.delete(filePath);
            }
        }
    }
Tooling to generate random X25519 key pairs.

@author vekterli
vespaclient-java/src/main/java/com/yahoo/vespa/security/tool/crypto/KeygenTool.java