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