RSA_private_encrypt.pod 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. =pod
  2. =head1 NAME
  3. RSA_private_encrypt, RSA_public_decrypt - low-level signature operations
  4. =head1 SYNOPSIS
  5. #include <openssl/rsa.h>
  6. The following functions have been deprecated since OpenSSL 3.0, and can be
  7. hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
  8. see L<openssl_user_macros(7)>:
  9. int RSA_private_encrypt(int flen, unsigned char *from,
  10. unsigned char *to, RSA *rsa, int padding);
  11. int RSA_public_decrypt(int flen, unsigned char *from,
  12. unsigned char *to, RSA *rsa, int padding);
  13. =head1 DESCRIPTION
  14. Both of the functions described on this page are deprecated.
  15. Applications should instead use L<EVP_PKEY_sign_init_ex(3)>,
  16. L<EVP_PKEY_sign(3)>, L<EVP_PKEY_verify_recover_init(3)>, and
  17. L<EVP_PKEY_verify_recover(3)>.
  18. These functions handle RSA signatures at a low-level.
  19. RSA_private_encrypt() signs the B<flen> bytes at B<from> (usually a
  20. message digest with an algorithm identifier) using the private key
  21. B<rsa> and stores the signature in B<to>. B<to> must point to
  22. B<RSA_size(rsa)> bytes of memory.
  23. B<padding> denotes one of the following modes:
  24. =over 4
  25. =item RSA_PKCS1_PADDING
  26. PKCS #1 v1.5 padding. This function does not handle the
  27. B<algorithmIdentifier> specified in PKCS #1. When generating or
  28. verifying PKCS #1 signatures, L<RSA_sign(3)> and L<RSA_verify(3)> should be
  29. used.
  30. =item RSA_NO_PADDING
  31. Raw RSA signature. This mode should I<only> be used to implement
  32. cryptographically sound padding modes in the application code.
  33. Signing user data directly with RSA is insecure.
  34. =back
  35. RSA_public_decrypt() recovers the message digest from the B<flen>
  36. bytes long signature at B<from> using the signer's public key
  37. B<rsa>. B<to> must point to a memory section large enough to hold the
  38. message digest (which is smaller than B<RSA_size(rsa) -
  39. 11>). B<padding> is the padding mode that was used to sign the data.
  40. =head1 RETURN VALUES
  41. RSA_private_encrypt() returns the size of the signature (i.e.,
  42. RSA_size(rsa)). RSA_public_decrypt() returns the size of the
  43. recovered message digest.
  44. On error, -1 is returned; the error codes can be
  45. obtained by L<ERR_get_error(3)>.
  46. =head1 SEE ALSO
  47. L<ERR_get_error(3)>,
  48. L<RSA_sign(3)>, L<RSA_verify(3)>,
  49. L<EVP_PKEY_sign(3)>, L<EVP_PKEY_verify_recover(3)>
  50. =head1 HISTORY
  51. Both of these functions were deprecated in OpenSSL 3.0.
  52. =head1 COPYRIGHT
  53. Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
  54. Licensed under the Apache License 2.0 (the "License"). You may not use
  55. this file except in compliance with the License. You can obtain a copy
  56. in the file LICENSE in the source distribution or at
  57. L<https://www.openssl.org/source/license.html>.
  58. =cut