---
name: "UI_UTIL_read_pw"
section: "3ssl"
platform: "linux"
package: "openssl"
version: "3.6.5-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/UI_UTIL_read_pw"
---

# UI\_UTIL\_read\_pw(3ssl)

user interface utilities

## NAME

UI\_UTIL\_read\_pw\_string, UI\_UTIL\_read\_pw, UI\_UTIL\_wrap\_read\_pem\_callback - user interface utilities

## SYNOPSIS

```
 #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);
```

## DESCRIPTION

**UI\_UTIL\_read\_pw\_string()** asks for a passphrase, using **prompt** as a prompt, and stores it in **buf**. The maximum allowed size is given with **length**, including the terminating NUL byte. If **verify** is nonzero, the password will be verified as well.

**UI\_UTIL\_read\_pw()** does the same as **UI\_UTIL\_read\_pw\_string()**, the difference is that you can give it an external buffer **buff** for the verification passphrase.

**UI\_UTIL\_wrap\_read\_pem\_callback()** can be used to create a temporary **UI\_METHOD** that wraps a given PEM password callback **cb**. **rwflag** is used to specify if this method will be used for passphrase entry without (0) or with (1) verification. When not used any more, the returned method should be freed with **UI\_destroy\_method()**.

## NOTES

**UI\_UTIL\_read\_pw\_string()** and **UI\_UTIL\_read\_pw()** use default **UI\_METHOD**. See **UI\_get\_default\_method**(3) and friends for more information.

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. The default password prompting functions (apart from **UI\_UTIL\_read\_pw\_string()** and **UI\_UTIL\_read\_pw()**, there is **PEM\_def\_callback()**, **EVP\_read\_pw\_string()** and **EVP\_read\_pw\_string\_min()**) all use the default **UI\_METHOD**.

## RETURN VALUES

**UI\_UTIL\_read\_pw\_string()** and **UI\_UTIL\_read\_pw()** return 0 on success or a negative value on error.

**UI\_UTIL\_wrap\_read\_pem\_callback()** returns a valid **UI\_METHOD** structure or NULL if an error occurred.

## SEE ALSO

**UI\_get\_default\_method**(3)

## 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\>.
