EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod 3.3 KB

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