RSA_sign.pod 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. =pod
  2. =head1 NAME
  3. RSA_sign, RSA_verify - RSA signatures
  4. =head1 SYNOPSIS
  5. #include <openssl/rsa.h>
  6. int RSA_sign(int type, const unsigned char *m, unsigned int m_len,
  7. unsigned char *sigret, unsigned int *siglen, RSA *rsa);
  8. int RSA_verify(int type, const unsigned char *m, unsigned int m_len,
  9. unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
  10. =head1 DESCRIPTION
  11. RSA_sign() signs the message digest B<m> of size B<m_len> using the
  12. private key B<rsa> as specified in PKCS #1 v2.0. It stores the
  13. signature in B<sigret> and the signature size in B<siglen>. B<sigret>
  14. must point to RSA_size(B<rsa>) bytes of memory.
  15. Note that PKCS #1 adds meta-data, placing limits on the size of the
  16. key that can be used.
  17. See L<RSA_private_encrypt(3)|RSA_private_encrypt(3)> for lower-level
  18. operations.
  19. B<type> denotes the message digest algorithm that was used to generate
  20. B<m>. It usually is one of B<NID_sha1>, B<NID_ripemd160> and B<NID_md5>;
  21. see L<objects(3)|objects(3)> for details. If B<type> is B<NID_md5_sha1>,
  22. an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding
  23. and no algorithm identifier) is created.
  24. RSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
  25. matches a given message digest B<m> of size B<m_len>. B<type> denotes
  26. the message digest algorithm that was used to generate the signature.
  27. B<rsa> is the signer's public key.
  28. =head1 RETURN VALUES
  29. RSA_sign() returns 1 on success, 0 otherwise. RSA_verify() returns 1
  30. on successful verification, 0 otherwise.
  31. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
  32. =head1 BUGS
  33. Certain signatures with an improper algorithm identifier are accepted
  34. for compatibility with SSLeay 0.4.5 :-)
  35. =head1 CONFORMING TO
  36. SSL, PKCS #1 v2.0
  37. =head1 SEE ALSO
  38. L<ERR_get_error(3)|ERR_get_error(3)>, L<objects(3)|objects(3)>,
  39. L<rsa(3)|rsa(3)>, L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>,
  40. L<RSA_public_decrypt(3)|RSA_public_decrypt(3)>
  41. =head1 HISTORY
  42. RSA_sign() and RSA_verify() are available in all versions of SSLeay
  43. and OpenSSL.
  44. =cut