Scroll to navigation

DSA_GET0_PQG(3) Library Functions Manual DSA_GET0_PQG(3)

NAME

DSA_get0_pqg, DSA_get0_p, DSA_get0_q, DSA_get0_g, DSA_set0_pqg, DSA_get0_key, DSA_get0_pub_key, DSA_get0_priv_key, DSA_set0_key, DSA_clear_flags, DSA_test_flags, DSA_set_flags, DSA_get0_engineget data from and set data in a DSA object

SYNOPSIS

#include <openssl/dsa.h>

void
DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);

const BIGNUM *
DSA_get0_p(const DSA *d);

const BIGNUM *
DSA_get0_q(const DSA *d);

const BIGNUM *
DSA_get0_g(const DSA *d);

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);

const BIGNUM *
DSA_get0_pub_key(const DSA *d);

const BIGNUM *
DSA_get0_priv_key(const DSA *d);

int
DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);

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);

ENGINE *
DSA_get0_engine(DSA *d);

DESCRIPTION

A DSA object contains the parameters p, q, and g. It also contains a public key pub_key and an optional private key priv_key.

The p, q, and g parameters can be obtained by calling (). If the parameters have not yet been set, then *p, *q, and *g are set to NULL. Otherwise, they are set to pointers to the internal representations of the values that should not be freed by the application.

The p, q, and g values can be set by calling (). Calling this function transfers the memory management of the values to d, and therefore they should not be freed by the caller.

The () function stores pointers to the internal representations of the public key in *pub_key and to the private key in *priv_key. Either may be NULL if it has not yet been set. If the private key has been set, then the public key must be.

The public and private key values can be set using (). 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 may be NULL, which means the corresponding DSA field is left untouched. DSA_set0_key() transfers the memory management of the key values to d, and therefore they should not be freed by the caller.

Values retrieved with () and DSA_get0_key() are owned by the DSA object and may therefore not be passed to DSA_set0_pqg() or DSA_set0_key(). If needed, duplicate the received values using BN_dup(3) and pass the duplicates.

Any of the values p, q, g, pub_key, and priv_key can also be retrieved separately by the corresponding functions (), (), (), (), and (), respectively. The pointers are owned by the DSA object.

() clears the specified flags in d. () tests the flags in d. () sets the flags in d; any flags already set remain set. For all three functions, multiple flags can be passed in one call, OR'ed together bitwise.

RETURN VALUES

DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_pub_key(), and DSA_get0_priv_key() return a pointer owned by the DSA object if the corresponding value has been set, otherwise they return NULL. DSA_set0_pqg() and DSA_set0_key() return 1 on success or 0 on failure.

DSA_test_flags() returns those of the given flags currently set in d or 0 if none of the given flags are set.

DSA_get0_engine() always returns NULL.

SEE ALSO

DSA_do_sign(3), DSA_dup_DH(3), DSA_generate_key(3), DSA_generate_parameters_ex(3), DSA_new(3), DSA_print(3), DSA_security_bits(3), DSA_sign(3), DSA_size(3)

HISTORY

DSA_get0_pqg(), DSA_set0_pqg(), DSA_get0_key(), DSA_set0_key(), DSA_clear_flags(), DSA_test_flags(), DSA_set_flags(), and DSA_get0_engine() first appeared in OpenSSL 1.1.0 and have been available since OpenBSD 6.3.

DSA_get0_p(), DSA_get0_q(), DSA_get0_g(), DSA_get0_pub_key(), and DSA_get0_priv_key() first appeared in OpenSSL 1.1.1 and have been available since OpenBSD 7.1.

July 21, 2024 Linux 6.4.0-150600.23.25-default