EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod 4.0 KB

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