xref: /freebsd-src/crypto/openssl/doc/man3/UI_UTIL_read_pw.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimUI_UTIL_read_pw_string, UI_UTIL_read_pw,
6e71b7053SJung-uk KimUI_UTIL_wrap_read_pem_callback - user interface utilities
7e71b7053SJung-uk Kim
8e71b7053SJung-uk Kim=head1 SYNOPSIS
9e71b7053SJung-uk Kim
10e71b7053SJung-uk Kim #include <openssl/ui.h>
11e71b7053SJung-uk Kim
12e71b7053SJung-uk Kim int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
13e71b7053SJung-uk Kim                            int verify);
14e71b7053SJung-uk Kim int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt,
15e71b7053SJung-uk Kim                     int verify);
16e71b7053SJung-uk Kim UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag);
17e71b7053SJung-uk Kim
18e71b7053SJung-uk Kim=head1 DESCRIPTION
19e71b7053SJung-uk Kim
20e71b7053SJung-uk KimUI_UTIL_read_pw_string() asks for a passphrase, using B<prompt> as a
21e71b7053SJung-uk Kimprompt, and stores it in B<buf>.
22e71b7053SJung-uk KimThe maximum allowed size is given with B<length>, including the
23e71b7053SJung-uk Kimterminating NUL byte.
2458f35182SJung-uk KimIf B<verify> is nonzero, the password will be verified as well.
25e71b7053SJung-uk Kim
26e71b7053SJung-uk KimUI_UTIL_read_pw() does the same as UI_UTIL_read_pw_string(), the
27e71b7053SJung-uk Kimdifference is that you can give it an external buffer B<buff> for the
28e71b7053SJung-uk Kimverification passphrase.
29e71b7053SJung-uk Kim
30e71b7053SJung-uk KimUI_UTIL_wrap_read_pem_callback() can be used to create a temporary
31e71b7053SJung-uk KimB<UI_METHOD> that wraps a given PEM password callback B<cb>.
32e71b7053SJung-uk KimB<rwflag> is used to specify if this method will be used for
33e71b7053SJung-uk Kimpassphrase entry without (0) or with (1) verification.
34e71b7053SJung-uk KimWhen not used any more, the returned method should be freed with
35e71b7053SJung-uk KimUI_destroy_method().
36e71b7053SJung-uk Kim
37e71b7053SJung-uk Kim=head1 NOTES
38e71b7053SJung-uk Kim
39e71b7053SJung-uk KimUI_UTIL_read_pw_string() and UI_UTIL_read_pw() use default
40e71b7053SJung-uk KimB<UI_METHOD>.
41e71b7053SJung-uk KimSee L<UI_get_default_method(3)> and friends for more information.
42e71b7053SJung-uk Kim
43e71b7053SJung-uk KimThe result from the B<UI_METHOD> created by
44e71b7053SJung-uk KimUI_UTIL_wrap_read_pem_callback() will generate password strings in the
45e71b7053SJung-uk Kimencoding that the given password callback generates.
46e71b7053SJung-uk KimThe default password prompting functions (apart from
47e71b7053SJung-uk KimUI_UTIL_read_pw_string() and UI_UTIL_read_pw(), there is
48e71b7053SJung-uk KimPEM_def_callback(), EVP_read_pw_string() and EVP_read_pw_string_min())
49e71b7053SJung-uk Kimall use the default B<UI_METHOD>.
50e71b7053SJung-uk Kim
51e71b7053SJung-uk Kim=head1 RETURN VALUES
52e71b7053SJung-uk Kim
53e71b7053SJung-uk KimUI_UTIL_read_pw_string() and UI_UTIL_read_pw() return 0 on success or a negative
54e71b7053SJung-uk Kimvalue on error.
55e71b7053SJung-uk Kim
56e71b7053SJung-uk KimUI_UTIL_wrap_read_pem_callback() returns a valid B<UI_METHOD> structure or NULL
57e71b7053SJung-uk Kimif an error occurred.
58e71b7053SJung-uk Kim
59e71b7053SJung-uk Kim=head1 SEE ALSO
60e71b7053SJung-uk Kim
61e71b7053SJung-uk KimL<UI_get_default_method(3)>
62e71b7053SJung-uk Kim
63e71b7053SJung-uk Kim=head1 COPYRIGHT
64e71b7053SJung-uk Kim
65*b077aed3SPierre ProncheryCopyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
66e71b7053SJung-uk Kim
67*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
68e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
69e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
70e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
71e71b7053SJung-uk Kim
72e71b7053SJung-uk Kim=cut
73