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