RSA_private_encrypt.pod 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_encrypt_init(3)>,
  16. L<EVP_PKEY_encrypt(3)>, L<EVP_PKEY_decrypt_init(3)> and L<EVP_PKEY_decrypt(3)>.
  17. These functions handle RSA signatures at a low-level.
  18. RSA_private_encrypt() signs the B<flen> bytes at B<from> (usually a
  19. message digest with an algorithm identifier) using the private key
  20. B<rsa> and stores the signature in B<to>. B<to> must point to
  21. B<RSA_size(rsa)> bytes of memory.
  22. B<padding> denotes one of the following modes:
  23. =over 4
  24. =item RSA_PKCS1_PADDING
  25. PKCS #1 v1.5 padding. This function does not handle the
  26. B<algorithmIdentifier> specified in PKCS #1. When generating or
  27. verifying PKCS #1 signatures, L<RSA_sign(3)> and L<RSA_verify(3)> should be
  28. used.
  29. =item RSA_NO_PADDING
  30. Raw RSA signature. This mode should I<only> be used to implement
  31. cryptographically sound padding modes in the application code.
  32. Signing user data directly with RSA is insecure.
  33. =back
  34. RSA_public_decrypt() recovers the message digest from the B<flen>
  35. bytes long signature at B<from> using the signer's public key
  36. B<rsa>. B<to> must point to a memory section large enough to hold the
  37. message digest (which is smaller than B<RSA_size(rsa) -
  38. 11>). B<padding> is the padding mode that was used to sign the data.
  39. =head1 RETURN VALUES
  40. RSA_private_encrypt() returns the size of the signature (i.e.,
  41. RSA_size(rsa)). RSA_public_decrypt() returns the size of the
  42. recovered message digest.
  43. On error, -1 is returned; the error codes can be
  44. obtained by L<ERR_get_error(3)>.
  45. =head1 SEE ALSO
  46. L<ERR_get_error(3)>,
  47. L<RSA_sign(3)>, L<RSA_verify(3)>
  48. =head1 HISTORY
  49. Both of these functions were deprecated in OpenSSL 3.0.
  50. =head1 COPYRIGHT
  51. Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
  52. Licensed under the Apache License 2.0 (the "License"). You may not use
  53. this file except in compliance with the License. You can obtain a copy
  54. in the file LICENSE in the source distribution or at
  55. L<https://www.openssl.org/source/license.html>.
  56. =cut