DSA_DO_SIGN(3)
π DSA_do_sign β raw DSA signature operations π
okay so this is DSA_DO_SIGN(3), a page from the Library Functions Manual β it lives in libcrypto, bestie, and it's all about the β¨rawβ¨ DSA signature moves. no wrapper, no fluff, just you and the math. π
πΈ SYNOPSIS πΈ
first things first, you gotta pull in the library:
library βlibcryptoβ #include <openssl/dsa.h>
then the two functions, iconic duo behavior:
DSA_SIG *
DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
int
DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig,
DSA *dsa);
π¦ DESCRIPTION π¦
π
DSA_do_sign()
so DSA_do_sign() computes a digital signature on a message digest. the digest is dgst, and it's dlen bytes long, and it signs using the private key dsa. then it hands you back the signature in a newly allocated DSA_SIG structure β brand new, freshly malloc'd, main character energy. π
and listen β if signature generation is time-critical for you (like, clock is ticking, deadline is looming π), you can use DSA_sign_setup(3) to precompute part of the signing operation ahead of time. lowkey a lifesaver.
π§ DSA_do_verify()
DSA_do_verify() does the vibe check: it verifies that the signature sig actually matches a given message digest dgst of size dgst_len. and dsa here is the signer's public key β not the private one, bestie, the public one. π«Ά
β RETURN VALUES β
DSA_do_sign()β returns the signature, orNULLon error. πDSA_do_verify()β returns1for a valid signature β ,0for an incorrect signature β, and-1on error π.
and if you're sitting there like "okay but why did it error" β the error codes can be obtained by ERR_get_error(3). iykyk. π₯
π SEE ALSO π
go read these next, fr fr:
π HISTORY π
DSA_do_sign() and DSA_do_verify() first appeared in OpenSSL 0.9.3 and have been available since OpenBSD 2.6. literal legends. β¨
π real talk: this is raw DSA signature work β know your key material and check those return values, okay? no cap.
mwah π that's the whole page β this Debian build is dated June 8, 2025, sourced from the Debian edition of the manual, and it's filed under DSA_DO_SIGN(3). slay, go sign something. πππ¦
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2000 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms