DSA_sign.pod 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. =pod
  2. =head1 NAME
  3. DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures
  4. =head1 SYNOPSIS
  5. #include <openssl/dsa.h>
  6. int DSA_sign(int type, const unsigned char *dgst, int len,
  7. unsigned char *sigret, unsigned int *siglen, DSA *dsa);
  8. int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp,
  9. BIGNUM **rp);
  10. int DSA_verify(int type, const unsigned char *dgst, int len,
  11. unsigned char *sigbuf, int siglen, DSA *dsa);
  12. =head1 DESCRIPTION
  13. DSA_sign() computes a digital signature on the B<len> byte message
  14. digest B<dgst> using the private key B<dsa> and places its ASN.1 DER
  15. encoding at B<sigret>. The length of the signature is places in
  16. *B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory.
  17. DSA_sign_setup() may be used to precompute part of the signing
  18. operation in case signature generation is time-critical. It expects
  19. B<dsa> to contain DSA parameters. It places the precomputed values
  20. in newly allocated B<BIGNUM>s at *B<kinvp> and *B<rp>, after freeing
  21. the old ones unless *B<kinvp> and *B<rp> are NULL. These values may
  22. be passed to DSA_sign() in B<dsa-E<gt>kinv> and B<dsa-E<gt>r>.
  23. B<ctx> is a pre-allocated B<BN_CTX> or NULL.
  24. DSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
  25. matches a given message digest B<dgst> of size B<len>.
  26. B<dsa> is the signer's public key.
  27. The B<type> parameter is ignored.
  28. The PRNG must be seeded before DSA_sign() (or DSA_sign_setup())
  29. is called.
  30. =head1 RETURN VALUES
  31. DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error.
  32. DSA_verify() returns 1 for a valid signature, 0 for an incorrect
  33. signature and -1 on error. The error codes can be obtained by
  34. L<ERR_get_error(3)|ERR_get_error(3)>.
  35. =head1 CONFORMING TO
  36. US Federal Information Processing Standard FIPS 186 (Digital Signature
  37. Standard, DSS), ANSI X9.30
  38. =head1 SEE ALSO
  39. L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>,
  40. L<DSA_do_sign(3)|DSA_do_sign(3)>
  41. =head1 HISTORY
  42. DSA_sign() and DSA_verify() are available in all versions of SSLeay.
  43. DSA_sign_setup() was added in SSLeay 0.8.
  44. =cut