UI_UTIL_READ_PW(3ossl)
π UI_UTIL_READ_PW(3ossl) β the OpenSSL manpage, bestie edition
okay so you've stumbled into the OpenSSL manual, 3ossl section, and this particular page is all about the user interface utilities β the little crew of functions that go "hey π₯Ί type your passphrase please." Three of them: UI_UTIL_read_pw_string, UI_UTIL_read_pw, and UI_UTIL_wrap_read_pem_callback. Let's get into it π
β¨ SYNOPSIS β¨
first things first, you gotta invite them in:
#include <openssl/ui.h>
int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
int verify);
int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt,
int verify);
UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag);
like, copy these exactly, no cap π
πΈ DESCRIPTION πΈ
π UI_UTIL_read_pw_string()
this one asks for a passphrase, uses prompt as the prompt (yes, the prompt is literally called prompt, icon behaviour), and stashes the answer in buf. the max allowed size is given by length β and heads up, that count includes the terminating NUL byte, so don't be out here counting wrong π. if verify is nonzero, the password gets verified too. double-check energy β¨
π¦ UI_UTIL_read_pw()
does the exact same thing as UI_UTIL_read_pw_string() β same vibe, same behaviour β the only difference is that you can hand it an external buffer buff for the verification passphrase. that's it. that's the whole diff. slay π
π UI_UTIL_wrap_read_pem_callback()
this one's the main character: it creates a temporary UI_METHOD that wraps a given PEM password callback cb. rwflag tells it whether this method will be used for passphrase entry without verification (0) or with verification (1). and when you're done with it?
β οΈ the returned method should be freed with UI_destroy_method(). literally don't forget, it's not a decoration π«Ά
π NOTES π
so UI_UTIL_read_pw_string() and UI_UTIL_read_pw() use the default UI_METHOD. if you wanna know more about that, go peek at UI_get_default_method(3) and friends β they're all linked up, iykyk π
and here's a fun fact π: the result from the UI_METHOD created by UI_UTIL_wrap_read_pem_callback() will generate password strings in the encoding that the given password callback generates. cute, right?
also important β the default password prompting functions (and yeah, apart from UI_UTIL_read_pw_string() and UI_UTIL_read_pw(), that includes PEM_def_callback(), EVP_read_pw_string() and EVP_read_pw_string_min()) all use the default UI_METHOD. every single one. periodt π₯
β RETURN VALUES β
UI_UTIL_read_pw_string()andUI_UTIL_read_pw()return0on success, or a negative value on error. so like, zero is the good one here, don't panic πUI_UTIL_wrap_read_pem_callback()returns a validUI_METHODstructure, orNULLif an error occurred.NULL= nope, something went wrong π
π§ SEE ALSO π§
go read it, it's giving essential context π
π 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>.
okay that's the whole page bestie, you ate that π«Ά this was 3.5.6, dated 2026-04-07 β catch you on the next manpage, mwah πβ¨π·
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms