EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod 3.6 KB

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