DSA_GET0_PQG(3SSL)
π DSA_GET0_PQG π
okay bestie, so this is the manual page for DSA_GET0_PQG from the OpenSSL crew (yes, manual section 3SSL, we're in the big leagues). It's the whole squad of routines for getting and setting data inside a DSA object β and it's a big squad, so let's meet everybody:
DSA_get0_pqg,DSA_set0_pqgDSA_get0_key,DSA_set0_keyDSA_get0_p,DSA_get0_q,DSA_get0_gDSA_get0_pub_key,DSA_get0_priv_keyDSA_clear_flags,DSA_test_flags,DSA_set_flags
Routines for getting and setting data in a DSA object. yes that's literally the whole mission statement. π
β¨ SYNOPSIS β¨
#include <openssl/dsa.h>
β οΈ heads up bestie: the following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by definingOPENSSL_API_COMPATwith a suitable version value β peepopenssl_user_macros(7)for that.
void DSA_get0_pqg(const DSA *d,
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
void DSA_get0_key(const DSA *d,
const BIGNUM **pub_key, const BIGNUM **priv_key);
int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
const BIGNUM *DSA_get0_p(const DSA *d);
const BIGNUM *DSA_get0_q(const DSA *d);
const BIGNUM *DSA_get0_g(const DSA *d);
const BIGNUM *DSA_get0_pub_key(const DSA *d);
const BIGNUM *DSA_get0_priv_key(const DSA *d);
void DSA_clear_flags(DSA *d, int flags);
int DSA_test_flags(const DSA *d, int flags);
void DSA_set_flags(DSA *d, int flags);
πΈ DESCRIPTION πΈ
okay real talk first: every single function on this page is deprecated. like, all of them. full roster. the glow-up replacement is EVP_PKEY_get_bn_param(3) β applications should be using that instead. periodt. π
So. A DSA object holds the parameters p, q and g. It also holds a public key (pub_key) and, optionally, a private key (priv_key). it's giving little fam of values.
π¦ getting the pqg gang
You can grab p, q and g by calling DSA_get0_pqg(). If those parameters haven't been set yet, then *p, *q and *g get set to NULL. Otherwise they're set to pointers to their respective values. β¨
π«Ά important: those pointers point directly to the internal representations of the values, so you should not free them yourself. hands off, bestie.
π setting the pqg gang
You can set p, q and g by calling DSA_set0_pqg() and passing the new values for p, q and g as parameters to the function. calling this function transfers the memory management of the values to the DSA object, so the values you passed in should not be freed directly after this function has been called. the DSA object owns them now, they live there. π
π the keys
To get the public and private key values, use DSA_get0_key(). A pointer to the public key lands in *pub_key, and a pointer to the private key lands in *priv_key. Either one may be NULL if they haven't been set yet β although if the private key has been set then the public key must be. the values point to the internal representation of the public key and private key values. this memory should not be freed directly. π
The public and private key values can be set using DSA_set0_key(). The public key must be non-NULL the first time this function is called on a given DSA object. The private key may be NULL. On subsequent calls, either one may be NULL, which means the corresponding DSA field is left untouched. And just like DSA_set0_pqg(), this function transfers the memory management of the key values to the DSA object, so they should not be freed directly after this function has been called. β¨
π grab one at a time
Any of the values p, q, g, priv_key, and pub_key can also be retrieved separately by the corresponding function β DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_priv_key(), and DSA_get0_pub_key(), respectively. one at a time, individually wrapped, very demure. π
π the flags era
DSA_set_flags()sets the flags in theflagsparameter on the DSA object. Multiple flags can be passed in one go (bitwise ORed together). Any flags that are already set are left set. no unsetting here, we're only adding. πDSA_test_flags()tests to see whether the flags passed in theflagsparameter are currently set in the DSA object. Multiple flags can be tested in one go. All flags that are currently set are returned, or zero if none of the flags are set.DSA_clear_flags()clears the specified flags within the DSA object. bye flag π
π NOTES π
Values retrieved with DSA_get0_key() are owned by the DSA object used in the call, and may therefore not be passed to DSA_set0_key(). If you need to do that, duplicate the received value using BN_dup() and pass the duplicate. π«Ά
same energy applies toDSA_get0_pqg()andDSA_set0_pqg(). don't try to hand the original back, make a copy.
π― RETURN VALUES π―
DSA_set0_pqg()andDSA_set0_key()return1on success or0on failure. classic.DSA_test_flags()returns the current state of the flags in the DSA object.
π SEE ALSO π
EVP_PKEY_get_bn_param(3), DSA_new(3), DSA_new(3), DSA_generate_parameters(3), DSA_generate_key(3), DSA_dup_DH(3), DSA_do_sign(3), DSA_set_method(3), DSA_SIG_new(3), DSA_sign(3), DSA_size(3), DSA_meth_new(3)
β HISTORY β
The functions described here were added in OpenSSL 1.1.0 and deprecated in OpenSSL 3.0.
The DSA_get0_engine() was removed in OpenSSL 4.0. π she's gone, she's not coming back.
βοΈ COPYRIGHT βοΈ
Copyright 2016-2018 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>.
okay that's the whole page bestie, no cap π this was OpenSSL 4.0.3, dated 2026-09-29, manual page DSA_GET0_PQG(3SSL) β go forth and BN_dup() responsibly, mwah πβ¨
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms