SSL_CTX_set1_sigalgs.pod 4.7 KB

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