RSA_sign.pod 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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> using RSASSA-PKCS1-v1_5 as specified in RFC 3447. It
  13. stores the signature in B<sigret> and the signature size in B<siglen>.
  14. B<sigret> 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)> for lower-level
  18. operations.
  19. B<type> denotes the message digest algorithm that was used to generate
  20. B<m>.
  21. 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.
  30. RSA_verify() returns 1 on successful verification.
  31. The error codes can be obtained by L<ERR_get_error(3)>.
  32. =head1 CONFORMING TO
  33. SSL, PKCS #1 v2.0
  34. =head1 SEE ALSO
  35. L<ERR_get_error(3)>,
  36. L<RSA_private_encrypt(3)>,
  37. L<RSA_public_decrypt(3)>
  38. =head1 COPYRIGHT
  39. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  40. Licensed under the OpenSSL license (the "License"). You may not use
  41. this file except in compliance with the License. You can obtain a copy
  42. in the file LICENSE in the source distribution or at
  43. L<https://www.openssl.org/source/license.html>.
  44. =cut