RSA_sign.pod 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. B<type> denotes the message digest algorithm that was used to generate
  16. B<m>. It usually is one of B<NID_sha1>, B<NID_ripemd160> and B<NID_md5>;
  17. see L<objects(3)|objects(3)> for details. If B<type> is B<NID_md5_sha1>,
  18. an SSL signature (MD5 and SHA1 message digests with PKCS #1 padding
  19. and no algorithm identifier) is created.
  20. RSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
  21. matches a given message digest B<m> of size B<m_len>. B<type> denotes
  22. the message digest algorithm that was used to generate the signature.
  23. B<rsa> is the signer's public key.
  24. =head1 RETURN VALUES
  25. RSA_sign() returns 1 on success, 0 otherwise. RSA_verify() returns 1
  26. on successful verification, 0 otherwise.
  27. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
  28. =head1 BUGS
  29. Certain signatures with an improper algorithm identifier are accepted
  30. for compatibility with SSLeay 0.4.5 :-)
  31. =head1 CONFORMING TO
  32. SSL, PKCS #1 v2.0
  33. =head1 SEE ALSO
  34. L<ERR_get_error(3)|ERR_get_error(3)>, L<objects(3)|objects(3)>,
  35. L<rsa(3)|rsa(3)>, L<RSA_private_encrypt(3)|RSA_private_encrypt(3)>,
  36. L<RSA_public_decrypt(3)|RSA_public_decrypt(3)>
  37. =head1 HISTORY
  38. RSA_sign() and RSA_verify() are available in all versions of SSLeay
  39. and OpenSSL.
  40. =cut