RSA_private_encrypt.pod 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. Deprecated since OpenSSL 3.0, can be hidden entirely by defining
  7. B<OPENSSL_API_COMPAT> with a suitable version value, see
  8. 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_init_ex(3)> and
  17. L<EVP_PKEY_verify(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. =head1 HISTORY
  50. Both of these functions were deprecated in OpenSSL 3.0.
  51. =head1 COPYRIGHT
  52. Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
  53. Licensed under the Apache License 2.0 (the "License"). You may not use
  54. this file except in compliance with the License. You can obtain a copy
  55. in the file LICENSE in the source distribution or at
  56. L<https://www.openssl.org/source/license.html>.
  57. =cut