SSL_CTX_set1_sigalgs.pod 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.
  28. SSL_CTX_set1_client_sigalgs(), SSL_set1_client_sigalgs(),
  29. SSL_CTX_set1_client_sigalgs_list() and SSL_set1_client_sigalgs_list() set
  30. signature algorithms related to client authentication, otherwise they are
  31. identical to SSL_CTX_set1_sigalgs(), SSL_set1_sigalgs(),
  32. SSL_CTX_set1_sigalgs_list() and SSL_set1_sigalgs_list().
  33. All these functions are implemented as macros. The signature algorithm
  34. parameter (integer array or string) is not freed: the application should
  35. free it, if necessary.
  36. =head1 NOTES
  37. If an application wishes to allow the setting of signature algorithms
  38. as one of many user configurable options it should consider using the more
  39. flexible SSL_CONF API instead.
  40. The signature algorithms set by a client are used directly in the supported
  41. signature algorithm in the client hello message.
  42. The supported signature algorithms set by a server are not sent to the
  43. client but are used to determine the set of shared signature algorithms
  44. and (if server preferences are set with SSL_OP_CIPHER_SERVER_PREFERENCE)
  45. their order.
  46. The client authentication signature algorithms set by a server are sent
  47. in a certificate request message if client authentication is enabled,
  48. otherwise they are unused.
  49. Similarly client authentication signature algorithms set by a client are
  50. used to determined the set of client authentication shared signature
  51. algorithms.
  52. Signature algorithms will neither be advertised nor used if the security level
  53. prohibits them (for example SHA1 if the security level is 4 or more).
  54. Currently the NID_md5, NID_sha1, NID_sha224, NID_sha256, NID_sha384 and
  55. NID_sha512 digest NIDs are supported and the public key algorithm NIDs
  56. EVP_PKEY_RSA, EVP_PKEY_RSA_PSS, EVP_PKEY_DSA and EVP_PKEY_EC.
  57. The short or long name values for digests can be used in a string (for
  58. example "MD5", "SHA1", "SHA224", "SHA256", "SHA384", "SHA512") and
  59. the public key algorithm strings "RSA", "RSA-PSS", "DSA" or "ECDSA".
  60. The TLS 1.3 signature scheme names (such as "rsa_pss_pss_sha256") can also
  61. be used with the B<_list> forms of the API.
  62. The use of MD5 as a digest is strongly discouraged due to security weaknesses.
  63. =head1 EXAMPLES
  64. Set supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA
  65. using an array:
  66. const int slist[] = {NID_sha256, EVP_PKEY_EC, NID_sha256, EVP_PKEY_RSA};
  67. SSL_CTX_set1_sigalgs(ctx, slist, 4);
  68. Set supported signature algorithms to SHA256 with ECDSA and SHA256 with RSA
  69. using a string:
  70. SSL_CTX_set1_sigalgs_list(ctx, "ECDSA+SHA256:RSA+SHA256");
  71. =head1 RETURN VALUES
  72. All these functions return 1 for success and 0 for failure.
  73. =head1 SEE ALSO
  74. L<ssl(7)>, L<SSL_get_shared_sigalgs(3)>,
  75. L<SSL_CONF_CTX_new(3)>
  76. =head1 COPYRIGHT
  77. Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
  78. Licensed under the Apache License 2.0 (the "License"). You may not use
  79. this file except in compliance with the License. You can obtain a copy
  80. in the file LICENSE in the source distribution or at
  81. L<https://www.openssl.org/source/license.html>.
  82. =cut