UI_STRING(3SSL)
π NAME π
UI_STRING, UI_string_types, UI_get_string_type, UI_get_input_flags, UI_get0_output_string, UI_get0_action_string, UI_get0_result_string, UI_get_result_string_length, UI_get0_test_string, UI_get_result_minsize, UI_get_result_maxsize, UI_set_result, UI_set_result_ex β it's giving user interface string parsing, bestie π
(also it lives in the OpenSSL manuals, which is like... the whole vibe of this page, iykyk π)
πΈ SYNOPSIS πΈ
#include <openssl/ui.h>
typedef struct ui_string_st UI_STRING;
enum UI_string_types {
UIT_NONE = 0,
UIT_PROMPT, /* Prompt for a string */
UIT_VERIFY, /* Prompt for a string and verify */
UIT_BOOLEAN, /* Prompt for a yes/no response */
UIT_INFO, /* Send info to the user */
UIT_ERROR /* Send an error message to the user */
};
enum UI_string_types UI_get_string_type(UI_STRING *uis);
int UI_get_input_flags(UI_STRING *uis);
const char *UI_get0_output_string(UI_STRING *uis);
const char *UI_get0_action_string(UI_STRING *uis);
const char *UI_get0_result_string(UI_STRING *uis);
int UI_get_result_string_length(UI_STRING *uis);
const char *UI_get0_test_string(UI_STRING *uis);
int UI_get_result_minsize(UI_STRING *uis);
int UI_get_result_maxsize(UI_STRING *uis);
int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len);
π¦ DESCRIPTION π¦
okay so first thing, bestie β the UI_STRING is not something you build by hand. It gets created internally and added to a UI whenever one of these functions gets called:
UI_add_input_string()UI_dup_input_string()UI_add_verify_string()UI_dup_verify_string()UI_add_input_boolean()UI_dup_input_boolean()UI_add_info_string()UI_dup_info_string()UI_add_error_string()UI_dup_error_string()
If you're a UI_METHOD user, that's literally it, you're done, no need to know more, go live your life π
If you're a UI_METHOD creator though? Now it's interesting π₯ The whole point is fetching text from these UI_STRING objects, plus adding results back into some of them.
UI_get_string_type() β grabs the type of the UI_STRING you hand it. Type check, but make it cute β¨
UI_get_input_flags() β grabs the flags</> that are chillin' with that given UI_STRING.
UI_get0_output_string() β grabs the actual string you're supposed to output (prompt, info, error, β¦ whatever the vibe is).
UI_get0_action_string() β grabs the action description that's attached to a UIT_BOOLEAN type UI_STRING. For every single other UI_STRING type? You get NULL. Sorry babe π«Ά Go peek at UI_add_input_boolean(3).
UI_get0_result_string() and UI_get_result_string_length() β these two grab the result of a prompt and its length. This is only useful for UIT_PROMPT and UIT_VERIFY type strings, lowkey. For every other UI_STRING type, UI_get0_result_string() returns NULL and UI_get_result_string_length() returns -1. π
UI_get0_test_string() β grabs the string you compare the prompt result against. Only useful for UIT_VERIFY type strings. Every other UI_STRING type gets NULL back. Periodt.
UI_get_result_minsize() and UI_get_result_maxsize() β grab the minimum and maximum required size of the result. Only useful for UIT_PROMPT and UIT_VERIFY type strings. For all other UI_STRING types you're getting -1, no notes.
UI_set_result_ex() β sets the result value of a prompt and its length. Here's the tea:
- For
UIT_PROMPTandUIT_VERIFYtype UI strings, this sets the result retrievable withUI_get0_result_string()by copying the contents ofresultβ but only if its length fits the minimum and maximum size requirements. - For
UIT_BOOLEANtype UI strings, this sets the first character of the result retrievable withUI_get0_result_string()to the firstok_chargiven withUI_add_input_boolean()orUI_dup_input_boolean()if the result matched any of them, or to the first of thecancel_charsif the result matched any of them. Otherwise? It's set to the NUL char"\0"and we move on π - Wanna know more about
ok_charsandcancel_chars? Go readUI_add_input_boolean(3), fr fr.
UI_set_result() does the exact same thing as UI_set_result_ex(), except it calculates the length internally. It expects the string to be terminated with a NUL byte, which is why it's only useful with normal C strings. C strings stay winning β¨
π RETURN VALUES π
UI_get_string_type()β returns the UI string type.UI_get_input_flags()β returns the UI string flags.UI_get0_output_string()β returns the UI string output string.UI_get0_action_string()β returns the UI string action description string forUIT_BOOLEANtype UI strings, andNULLfor any other type.UI_get0_result_string()β returns the UI string result buffer forUIT_PROMPTandUIT_VERIFYtype UI strings, andNULLfor any other type.UI_get_result_string_length()β returns the UI string result buffer's content length forUIT_PROMPTandUIT_VERIFYtype UI strings, and-1for any other type.UI_get0_test_string()β returns the UI string action description string forUIT_VERIFYtype UI strings, andNULLfor any other type.UI_get_result_minsize()β returns the minimum allowed result size for the UI string forUIT_PROMPTandUIT_VERIFYtype strings, and-1for any other type.UI_get_result_maxsize()β returns the minimum allowed result size for the UI string forUIT_PROMPTandUIT_VERIFYtype strings, and-1for any other type. (yes, it says minimum, that's literally what the page says, no cap π)UI_set_result()β returns0on success, or also0when the UI string is of any type other thanUIT_PROMPT,UIT_VERIFYorUIT_BOOLEAN. Returns-1on error.
π SEE ALSO π
UI(3) β go read it, bestie, it's the main character π«Ά
π COPYRIGHT π
Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html.
and that's a wrap on this page, OpenSSL 4.0.3, dated 2026-09-29 π thanks for coming to my ted talk, go write a UI_METHOD and slay π§β¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms