UI_STRING(3ossl)
π¦ UI_STRING(3ossl) β OpenSSL's lil' user-interface string object β¨
okay so this is the UI_STRING(3ossl) page from the OpenSSL manual, and bestie, it's literally all about the string objects that carry prompts, info and errors back and forth between OpenSSL and a human π
no cap, it's more fun than it sounds.
πΈ 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 β user interface string parsing π
β¨ 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 π
so a UI_STRING gets created internally and added to a UI whenever one of these girlies 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() or UI_dup_error_string(). that's the whole origin story, slay π
if you're a UI_METHOD user, honestly? you don't need to know anything more, you're done here, go touch grass π«Ά
but if you're a UI_METHOD creator, then it's absolutely your moment to shine, because you're gonna want to fetch text from these UI_STRING objects and add results back into some of them. main character energy fr fr π
π the getters, one by one π
UI_get_string_type()β gets you the type of the givenUI_STRING. iconic little vibe check πUI_get_input_flags()β gets you the flags associated with the givenUI_STRINGπ©UI_get0_output_string()β gets you the actual string to output (prompt, info, error, ...). the real one, the one you show the human β¨UI_get0_action_string()β gets you the action description associated with aUIT_BOOLEANtypeUI_STRING. for all otherUI_STRINGtypes,NULLis returned. seeUI_add_input_boolean(3)π¦UI_get0_result_string()andUI_get_result_string_length()β get you the result of a prompt and its length. this is only useful forUIT_PROMPTandUIT_VERIFYtype strings. for all otherUI_STRINGtypes,UI_get0_result_string()returnsNULLandUI_get_result_string_length()returns-1πUI_get0_test_string()β gets you the string to compare the prompt result with. this is only useful forUIT_VERIFYtype strings. for all otherUI_STRINGtypes,NULLis returned πUI_get_result_minsize()andUI_get_result_maxsize()β get you the minimum and maximum required size of the result. this is only useful forUIT_PROMPTandUIT_VERIFYtype strings. for all otherUI_STRINGtypes,-1is returned π
π the setters π
UI_set_result_ex() sets the result value of a prompt and its length. here's the tea per type:
- for
UIT_PROMPTandUIT_VERIFYtype UI strings, it sets the result retrievable withUI_get0_result_string()by copying the contents ofresultif its length fits the minimum and maximum size requirements β - for
UIT_BOOLEANtype UI strings, it 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 the first of thecancel_charsif the result matched any of them, otherwise it's set to the NUL char"\0". seeUI_add_input_boolean(3)for more info onok_charsandcancel_charsπ§
UI_set_result() does the same thing as UI_set_result_ex(), but it calculates its length internally. it expects the string to be terminated with a NUL byte, and is therefore only useful with normal C strings. classic π
π₯ 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,NULLfor any other type πUI_get0_result_string()returns the UI string result buffer forUIT_PROMPTandUIT_VERIFYtype UI strings,NULLfor any other type π¦UI_get_result_string_length()returns the UI string result buffer's content length forUIT_PROMPTandUIT_VERIFYtype UI strings,-1for any other type πUI_get0_test_string()returns the UI string action description string forUIT_VERIFYtype UI strings,NULLfor any other type π§ͺUI_get_result_minsize()returns the minimum allowed result size for the UI string forUIT_PROMPTandUIT_VERIFYtype strings,-1for any other type π½UI_get_result_maxsize()returns the minimum allowed result size for the UI string forUIT_PROMPTandUIT_VERIFYtype strings,-1for any other type πΌ
ngl the page literally says "minimum" for UI_get_result_maxsize() too β we're just reporting what it says, don't come for us π
UI_set_result()returns0on success or when the UI string is of any type other thanUIT_PROMPT,UIT_VERIFYorUIT_BOOLEAN,-1on error π
π SEE ALSO π
UI(3) β go read that one next bestie, it's giving prequel π«Ά
π 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>.
k that's the whole page, and yes you ate that π
mwah π β this was UI_STRING(3ossl) from OpenSSL 3.5.0, dated 2026-09-25, signing off β¨ππ¦
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms