SSL_GET_PEER_TMP_KEY(3SSL)

πŸ’– SSL_GET_PEER_TMP_KEY πŸ’–

okay bestie so this is the 3SSL manual page β€” SSL_get_peer_tmp_key, SSL_get_server_tmp_key, and SSL_get_tmp_key, aka the little trio that tells you about the temporary keys getting used during a handshake πŸ”βœ¨ like the ephemeral gossip of the TLS world, except it's cryptographic and also extremely important.


✨ NAME ✨

SSL_get_peer_tmp_key, SSL_get_server_tmp_key, SSL_get_tmp_key β€” get information about temporary keys used during a handshake 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <openssl/ssl.h>

long SSL_get_peer_tmp_key(SSL *ssl, EVP_PKEY **key);
long SSL_get_server_tmp_key(SSL *ssl, EVP_PKEY **key);
long SSL_get_tmp_key(SSL *ssl, EVP_PKEY **key);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so, function by function, because they are siblings not clones:

  • SSL_get_peer_tmp_key() β€” this one hands you the temporary key the peer gave you, the one that was used during key exchange. So say ECDHE is in play, right? Then this is literally the peer's public ECDHE key πŸ’…. If it works, a pointer to that key gets stashed into *key. And heads up king/queen: it is the caller's responsibility to free this key after use, using EVP_PKEY_free(3). That's on you. Not on OpenSSL. On you πŸ™ˆ.
  • SSL_get_server_tmp_key() β€” this is a backwards compatibility alias for SSL_get_peer_tmp_key(). Under that name it only ever worked just on the client side of the connection, and its behaviour on the server end is release-dependent. So like… it's the older sibling who still gets invited to stuff but things are, um, situational.
  • SSL_get_tmp_key() β€” same energy, except it returns the equivalent info for the local end of the connection. Your side. Your key. Main character energy, honestly πŸ‘‘.

🌸 RETURN VALUES 🌸

All three of them return 1 on success and 0 otherwise. That's it. Binary. No half-sends, no "it's complicated" πŸ’€.


⭐ NOTES ⭐

This function is implemented as a macro. yes, a macro. it's giving sneaky 🧚.


🌈 SEE ALSO 🌈


πŸ’œ HISTORY πŸ’œ

SSL_get_peer_tmp_key() and SSL_get_tmp_key() were added in OpenSSL 1.1.1a. glow-up era fr fr ✨


Copyright 2017-2025 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 whole page bestie!! πŸ“ this dropped as version 4.0.3 on 2026-09-29, filed under the SSL_GET_PEER_TMP_KEY(3SSL) manual β€” go forth and free your keys with EVP_PKEY_free(3), i am literally begging you πŸ’–πŸ«Ά

πŸ“¦ where this page comes from