[#DH_compute_key_padded]
= DH&lowbar;compute&lowbar;key&lowbar;padded
:mrdocs:

Derive the DH shared secret with NIST SP 800&hyphen;56A leading&hyphen;zero padding (deprecated)&period;

== Synopsis

Declared in `&lt;openssl&sol;dh&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;deprecated&rsqb;&rsqb;
int
DH&lowbar;compute&lowbar;key&lowbar;padded(
    unsigned char* key,
    xref:BIGNUM.adoc[BIGNUM] const* pub&lowbar;key,
    xref:DH.adoc[DH]* dh);
----

[WARNING]
====
https://en.cppreference.com/cpp/language/attributes/deprecated[Deprecated^]. Use of this entity is allowed but discouraged.
====
== Description

Like DH&lowbar;compute&lowbar;key() but always writes DH&lowbar;size(`dh)` bytes, retaining leading zeros (constant&hyphen;time w&period;r&period;t&period; the secret length)&period; Prefer EVP&lowbar;PKEY&lowbar;derive for new code&period;

== Return Value

DH&lowbar;size(`dh)` on success, or &hyphen;1 on error&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *key*
| Output buffer of at least DH&lowbar;size(`dh)` bytes&period;
| *pub&lowbar;key*
| Peer public value&period;
| *dh*
| DH object holding the private key and domain parameters&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
