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