1=pod
2
3=head1 NAME
4
5SSL_CTX_set1_sigalgs, SSL_set1_sigalgs, SSL_CTX_set1_sigalgs_list,
6SSL_set1_sigalgs_list, SSL_CTX_set1_client_sigalgs,
7SSL_set1_client_sigalgs, SSL_CTX_set1_client_sigalgs_list,
8SSL_set1_client_sigalgs_list - set supported signature algorithms
9
10=head1 SYNOPSIS
11
12 #include <openssl/ssl.h>
13
14 long SSL_CTX_set1_sigalgs(SSL_CTX *ctx, const int *slist, long slistlen);
15 long SSL_set1_sigalgs(SSL *ssl, const int *slist, long slistlen);
16 long SSL_CTX_set1_sigalgs_list(SSL_CTX *ctx, const char *str);
17 long SSL_set1_sigalgs_list(SSL *ssl, const char *str);
18
19 long SSL_CTX_set1_client_sigalgs(SSL_CTX *ctx, const int *slist, long slistlen);
20 long SSL_set1_client_sigalgs(SSL *ssl, const int *slist, long slistlen);
21 long SSL_CTX_set1_client_sigalgs_list(SSL_CTX *ctx, const char *str);
22 long SSL_set1_client_sigalgs_list(SSL *ssl, const char *str);
23
24=head1 DESCRIPTION
25
26SSL_CTX_set1_sigalgs() and SSL_set1_sigalgs() set the supported signature
27algorithms for B<ctx> or B<ssl>. The array B<slist> of length B<slistlen>
28must consist of pairs of NIDs corresponding to digest and public key
29algorithms.
30
31SSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list() set the supported
32signature algorithms for B<ctx> or B<ssl>. The B<str> parameter
33must be a null terminated string consisting of a colon separated list of
34elements, where each element is either a combination of a public key
35algorithm and a digest separated by B<+>, or a TLS 1.3-style named
36SignatureScheme such as rsa_pss_pss_sha256.
37
38SSL_CTX_set1_client_sigalgs(), SSL_set1_client_sigalgs(),
39SSL_CTX_set1_client_sigalgs_list() and SSL_set1_client_sigalgs_list() set
40signature algorithms related to client authentication, otherwise they are
41identical to SSL_CTX_set1_sigalgs(), SSL_set1_sigalgs(),
42SSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list().
43
44All these functions are implemented as macros. The signature algorithm
45parameter (integer array or string) is not freed: the application should
46free it, if necessary.
47
48=head1 NOTES
49
50If an application wishes to allow the setting of signature algorithms
51as one of many user configurable options it should consider using the more
52flexible SSL_CONF API instead.
53
54The signature algorithms set by a client are used directly in the supported
55signature algorithm in the client hello message.
56
57The supported signature algorithms set by a server are not sent to the
58client but are used to determine the set of shared signature algorithms
59and (if server preferences are set with SSL_OP_CIPHER_SERVER_PREFERENCE)
60their order.
61
62The client authentication signature algorithms set by a server are sent
63in a certificate request message if client authentication is enabled,
64otherwise they are unused.
65
66Similarly client authentication signature algorithms set by a client are
67used to determined the set of client authentication shared signature
68algorithms.
69
70Signature algorithms will neither be advertised nor used if the security level
71prohibits them (for example SHA1 if the security level is 4 or more).
72
73Currently the NID_md5, NID_sha1, NID_sha224, NID_sha256, NID_sha384 and
74NID_sha512 digest NIDs are supported and the public key algorithm NIDs
75EVP_PKEY_RSA, EVP_PKEY_RSA_PSS, EVP_PKEY_DSA and EVP_PKEY_EC.
76
77The short or long name values for digests can be used in a string (for
78example "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512") and
79the public key algorithm strings "RSA", "RSA-PSS", "DSA" or "ECDSA".
80
81The TLS 1.3 signature scheme names (such as "rsa_pss_pss_sha256") can also
82be used with the B<_list> forms of the API.
83
84The use of MD5 as a digest is strongly discouraged due to security weaknesses.
85
86=head1 RETURN VALUES
87
88All these functions return 1 for success and 0 for failure.
89
90=head1 EXAMPLES
91
92Set supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA
93using an array:
94
95 const int slist[] = {NID_sha256, EVP_PKEY_EC, NID_sha256, EVP_PKEY_RSA};
96
97 SSL_CTX_set1_sigalgs(ctx, slist, 4);
98
99Set supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA
100using a string:
101
102 SSL_CTX_set1_sigalgs_list(ctx, "ECDSA+SHA256:RSA+SHA256");
103
104=head1 SEE ALSO
105
106L<ssl(7)>, L<SSL_get_shared_sigalgs(3)>,
107L<SSL_CONF_CTX_new(3)>
108
109=head1 COPYRIGHT
110
111Copyright 2015-2019 The OpenSSL Project Authors. All Rights Reserved.
112
113Licensed under the OpenSSL license (the "License").  You may not use
114this file except in compliance with the License.  You can obtain a copy
115in the file LICENSE in the source distribution or at
116L<https://www.openssl.org/source/license.html>.
117
118=cut
119