DSA_SIGN(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’– DSA_SIGN(3) β€” the DSA signatures glow-up πŸ’–

ok so bestie, you're reading the Library Functions Manual page for DSA_sign, DSA_sign_setup, and DSA_verify β€” three little functions that do that whole digital-signature thing for DSA. let's get into it 🫢


✨ NAME ✨

DSA_sign, DSA_sign_setup, DSA_verify β€” DSA signatures, literally the whole point of this page πŸ’…


🌸 SYNOPSIS 🌸

       library β€œlibcrypto” #include <openssl/dsa.h>

       int
       DSA_sign(int type, const unsigned char *dgst, int len,
           unsigned char *sigret, unsigned int *siglen, DSA *dsa);

       int
       DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, BIGNUM **rp);

       int
       DSA_verify(int type, const unsigned char *dgst, int len,
           unsigned char *sigbuf, int siglen, DSA *dsa);

like, copy it exactly, no typos, it's giving header-file supremacy πŸŽ€


πŸ’œ DESCRIPTION πŸ’œ

πŸ¦‹ DSA_sign() β€” the main character πŸ¦‹

so DSA_sign() computes a digital signature on the len byte message digest dgst using the private key dsa, and it places its ASN.1 DER encoding at sigret. length of the signature goes in *siglen. and here's the ✨iconic✨ little detail: sigret must point to DSA_size(dsa) bytes of memory. no skipping that, it's non-negotiable 🫢

🧚 DSA_sign_setup() β€” pregame era 🧚

DSA_sign_setup() may be used to precompute part of the signing operation in case signature generation is time-critical. like, bestie is in a rush, we get it ⏱️

it expects dsa to contain DSA parameters. it places the precomputed values in newly allocated BIGNUMs at *kinvp and *rp, after freeing the old ones β€” unless kinvp and rp are NULL. πŸ‘€ these values may be passed to DSA_sign() in dsa->kinv and dsa->r. and ctx is a pre-allocated BN_CTX or NULL.

🌈 DSA_verify() β€” the vibe check 🌈

DSA_verify() verifies that the signature sigbuf of size siglen matches a given message digest dgst of size len. dsa is the signer's public key. it's checking IDs at the door, periodt πŸ”₯

and the type parameter? ignored. not even invited to the party. πŸ’€

⭐ RETURN VALUES ⭐

  • DSA_sign() and DSA_sign_setup() β€” return 1 on success or 0 on error πŸ™ˆ
  • DSA_verify() β€” returns 1 for a valid signature πŸ‘‘, 0 for an incorrect signature πŸ’€, and -1 on error 😭

the error codes can be obtained by ERR_get_error(3) β€” go read that one if you need the tea β˜•


πŸŽ€ SEE ALSO πŸŽ€

iykyk, go click through them πŸ’…


🌟 STANDARDS 🌟

US Federal Information Processing Standard FIPS 186 (Digital Signature Standard, DSS), ANSI X9.30. very official, very federal, very slay πŸŽ–οΈ


πŸ’« HISTORY πŸ’«

DSA_sign() and DSA_verify() first appeared in SSLeay 0.6.0. DSA_sign_setup() first appeared in SSLeay 0.8.0. all these functions have been available since OpenBSD 2.4. elders of the group chat fr fr πŸ§“βœ¨


ok that's the whole page, you ate that πŸ“

Debian πŸ’– June 8, 2025 πŸ’– that's the version and the date, mwah, bye bestie 🫢

πŸ“¦ where this page comes from