DSA_sign.pod 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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, BIGNUM **rp);
  9. int DSA_verify(int type, const unsigned char *dgst, int len,
  10. unsigned char *sigbuf, int siglen, DSA *dsa);
  11. =head1 DESCRIPTION
  12. DSA_sign() computes a digital signature on the B<len> byte message
  13. digest B<dgst> using the private key B<dsa> and places its ASN.1 DER
  14. encoding at B<sigret>. The length of the signature is places in
  15. *B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory.
  16. DSA_sign_setup() is defined only for backward binary compatibility and
  17. should not be used.
  18. Since OpenSSL 1.1.0 the DSA type is opaque and the output of
  19. DSA_sign_setup() cannot be used anyway: calling this function will only
  20. cause overhead, and does not affect the actual signature
  21. (pre-)computation.
  22. DSA_verify() verifies that the signature B<sigbuf> of size B<siglen>
  23. matches a given message digest B<dgst> of size B<len>.
  24. B<dsa> is the signer's public key.
  25. The B<type> parameter is ignored.
  26. The random generator must be seeded when DSA_sign() (or DSA_sign_setup())
  27. is called.
  28. If the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to
  29. external circumstances (see L<RAND(7)>), the operation will fail.
  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)>.
  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_new(3)>, L<ERR_get_error(3)>, L<RAND_bytes(3)>,
  40. L<DSA_do_sign(3)>,
  41. L<RAND(7)>
  42. =head1 COPYRIGHT
  43. Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
  44. Licensed under the Apache License 2.0 (the "License"). You may not use
  45. this file except in compliance with the License. You can obtain a copy
  46. in the file LICENSE in the source distribution or at
  47. L<https://www.openssl.org/source/license.html>.
  48. =cut