RSA_private_encrypt.pod 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. int RSA_private_encrypt(int flen, unsigned char *from,
  7. unsigned char *to, RSA *rsa, int padding);
  8. int RSA_public_decrypt(int flen, unsigned char *from,
  9. unsigned char *to, RSA *rsa, int padding);
  10. =head1 DESCRIPTION
  11. These functions handle RSA signatures at a low level.
  12. RSA_private_encrypt() signs the B<flen> bytes at B<from> (usually a
  13. message digest with an algorithm identifier) using the private key
  14. B<rsa> and stores the signature in B<to>. B<to> must point to
  15. B<RSA_size(rsa)> bytes of memory.
  16. B<padding> denotes one of the following modes:
  17. =over 4
  18. =item RSA_PKCS1_PADDING
  19. PKCS #1 v1.5 padding. This function does not handle the
  20. B<algorithmIdentifier> specified in PKCS #1. When generating or
  21. verifying PKCS #1 signatures, L<RSA_sign(3)|RSA_sign(3)> and L<RSA_verify(3)|RSA_verify(3)> should be
  22. used.
  23. =item RSA_NO_PADDING
  24. Raw RSA signature. This mode should I<only> be used to implement
  25. cryptographically sound padding modes in the application code.
  26. Signing user data directly with RSA is insecure.
  27. =back
  28. RSA_public_decrypt() recovers the message digest from the B<flen>
  29. bytes long signature at B<from> using the signer's public key
  30. B<rsa>. B<to> must point to a memory section large enough to hold the
  31. message digest (which is smaller than B<RSA_size(rsa) -
  32. 11>). B<padding> is the padding mode that was used to sign the data.
  33. =head1 RETURN VALUES
  34. RSA_private_encrypt() returns the size of the signature (i.e.,
  35. RSA_size(rsa)). RSA_public_decrypt() returns the size of the
  36. recovered message digest.
  37. On error, -1 is returned; the error codes can be
  38. obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
  39. =head1 SEE ALSO
  40. L<ERR_get_error(3)|ERR_get_error(3)>, L<rsa(3)|rsa(3)>,
  41. L<RSA_sign(3)|RSA_sign(3)>, L<RSA_verify(3)|RSA_verify(3)>
  42. =head1 HISTORY
  43. The B<padding> argument was added in SSLeay 0.8. RSA_NO_PADDING is
  44. available since SSLeay 0.9.0.
  45. =cut