DSA_SIGN(3ossl)
π DSA_SIGN β bestie's guide to DSA signatures π
okay so this is the DSA_SIGN(3ossl) page from the OpenSSL manual (yes, that OpenSSL, the big one), and it's lowkey a deprecation notice wrapped in a hug. sit down, grab a strawberry π, we're getting into it.
β¨ NAME β¨
DSA_sign, DSA_sign_setup, DSA_verify β DSA signatures. that's it, that's the trio. the girlies of the DSA world π
πΈ SYNOPSIS πΈ
first things first, you gotta include the header:
#include <openssl/dsa.h>
now listen up because this is important β the following functions have been deprecated since OpenSSL 3.0, and you can hide them entirely by defining OPENSSL_API_COMPAT with a suitable version value. see openssl_user_macros(7) for the tea on that. β
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);
π¦ DESCRIPTION π¦
THE WHOLE FUNCTION FAMILY ON THIS PAGE IS DEPRECATED. like, all of them. every single one. bestie, applications should instead be usingEVP_PKEY_sign_init(3),EVP_PKEY_sign(3),EVP_PKEY_verify_init(3)andEVP_PKEY_verify(3). that's the glow-up. that's the move. β¨
okay but for the history girlies, here's what each one does:
DSA_sign()β computes a digital signature over thelenbyte message digestdgst, using the private keydsa, and drops its ASN.1 DER encoding atsigret. the length of that signature lands in*siglen. and this part is non-negotiable:sigretmust point toDSA_size(dsa)bytes of memory. no more, no less, she needs her space. πDSA_sign_setup()β okay so this one is defined only for backward binary compatibility and you genuinely should not use it. since OpenSSL 1.1.0 the DSA type is opaque, and the output ofDSA_sign_setup()can't be used anyway. calling it will only cause overhead, and it does not affect the actual signature (pre-)computation. it's giving "shows up to the party, contributes nothing" πDSA_verify()β verifies that the signaturesigbufof sizesiglenmatches a given message digestdgstof sizelen.dsahere is the signer's public key. vibe check, but cryptographic. π
and one more lil detail that applies across the board: the type parameter is ignored. that's right, she's just there for the aesthetic. π
also, real talk β the random generator must be seeded when DSA_sign() (or DSA_sign_setup()) is called. and if the automatic seeding or reseeding of the OpenSSL CSPRNG fails due to external circumstances (see RAND(7)), the operation will fail. no luck, no signature, periodt. π
π RETURN VALUES π
DSA_sign()andDSA_sign_setup()β return1on success,0on error.DSA_verify()β returns1for a valid signature,0for an incorrect signature, and-1on error.
and the error codes? you can grab those with ERR_get_error(3). receipts always available, bestie π§Ύ
π CONFORMING TO π
- US Federal Information Processing Standard
FIPS186-4(Digital Signature Standard, DSS) ANSI X9.30
look at her, certified and standards-compliant, we love a queen who follows the rules π
π SEE ALSO π
DSA_new(3), ERR_get_error(3), RAND_bytes(3), DSA_do_sign(3), RAND(7)
iykyk β go read those next, they're the supporting cast π«Ά
β HISTORY β
all of these functions were deprecated in OpenSSL 3.0. that's the whole story. that's the arc. she had her era and now she's retired π
π COPYRIGHT π
Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the page, babe π this was OpenSSL 3.5.9, dated 2026-09-29, signing off from the DSA_SIGN(3ossl) era. deprecated but never forgotten, fr fr. stay seeded, stay secure, and go use EVP_PKEY_sign_init(3) like a main character. β¨π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms