DOCS: Add documentation for EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name()
[oweals/openssl.git] / doc / man3 / EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod
1 =pod
2
3 =head1 NAME
4
5 EVP_PKEY_CTX_set_rsa_pss_keygen_md,
6 EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md,
7 EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name,
8 EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen
9 - EVP_PKEY RSA-PSS algorithm support functions
10
11 =head1 SYNOPSIS
12
13  #include <openssl/rsa.h>
14
15  int EVP_PKEY_CTX_set_rsa_pss_keygen_md(EVP_PKEY_CTX *pctx,
16                                         const EVP_MD *md);
17  int EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md(EVP_PKEY_CTX *pctx,
18                                              const EVP_MD *md);
19  int EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name(EVP_PKEY_CTX *pctx,
20                                                   const char *mdname);
21  int EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen(EVP_PKEY_CTX *pctx,
22                                              int saltlen);
23
24 =head1 DESCRIPTION
25
26 These are the functions that implement L<RSA-PSS(7)>.
27
28 =head2 Signing and Verification
29
30 The macro EVP_PKEY_CTX_set_rsa_padding() is supported but an error is
31 returned if an attempt is made to set the padding mode to anything other
32 than B<PSS>. It is otherwise similar to the B<RSA> version.
33
34 The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro is used to set the salt length.
35 If the key has usage restrictions then an error is returned if an attempt is
36 made to set the salt length below the minimum value. It is otherwise similar
37 to the B<RSA> operation except detection of the salt length (using
38 RSA_PSS_SALTLEN_AUTO) is not supported for verification if the key has
39 usage restrictions.
40
41 The L<EVP_PKEY_CTX_set_signature_md(3)> and L<EVP_PKEY_CTX_set_rsa_mgf1_md(3)>
42 functions are used to set the digest and MGF1 algorithms respectively. If the
43 key has usage restrictions then an error is returned if an attempt is made to
44 set the digest to anything other than the restricted value. Otherwise these are
45 similar to the B<RSA> versions.
46
47 =head2 Key Generation
48
49 As with RSA key generation the EVP_PKEY_CTX_set_rsa_keygen_bits()
50 and EVP_PKEY_CTX_set_rsa_keygen_pubexp() macros are supported for RSA-PSS:
51 they have exactly the same meaning as for the RSA algorithm.
52
53 Optional parameter restrictions can be specified when generating a PSS key.
54 If any restrictions are set (using the macros described below) then B<all>
55 parameters are restricted. For example, setting a minimum salt length also
56 restricts the digest and MGF1 algorithms. If any restrictions are in place
57 then they are reflected in the corresponding parameters of the public key
58 when (for example) a certificate request is signed.
59
60 EVP_PKEY_CTX_set_rsa_pss_keygen_md() restricts the digest algorithm the
61 generated key can use to I<md>.
62
63 EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md() restricts the MGF1 algorithm the
64 generated key can use to I<md>.
65 EVP_PKEY_CTX_set_rsa_pss_keygen_mgf1_md_name() does the same thing, but
66 passes the algorithm by name rather than by B<EVP_MD>.
67
68 EVP_PKEY_CTX_set_rsa_pss_keygen_saltlen() restricts the minimum salt length
69 to I<saltlen>.
70
71 =head1 NOTES
72
73 A context for the B<RSA-PSS> algorithm can be obtained by calling:
74
75  EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA_PSS, NULL);
76
77 =head1 RETURN VALUES
78
79 All these functions return 1 for success and 0 or a negative value for failure.
80 In particular a return value of -2 indicates the operation is not supported by
81 the public key algorithm.
82
83 =head1 SEE ALSO
84
85 L<RSA-PSS(7)>,
86 L<EVP_PKEY_CTX_new(3)>,
87 L<EVP_PKEY_CTX_ctrl_str(3)>,
88 L<EVP_PKEY_derive(3)>
89
90 =head1 COPYRIGHT
91
92 Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
93
94 Licensed under the Apache License 2.0 (the "License").  You may not use
95 this file except in compliance with the License.  You can obtain a copy
96 in the file LICENSE in the source distribution or at
97 L<https://www.openssl.org/source/license.html>.
98
99 =cut