SSL_GET_PEER_TMP_KEY(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… SSL_GET_PEER_TMP_KEY β€” bestie edition πŸŽ€

okay so this is the 3ossl page for the OpenSSL functions SSL_get_peer_tmp_key, SSL_get_server_tmp_key, and SSL_get_tmp_key β€” they're all about getting info on the temporary keys used during a handshake, and honestly? kind of iconic. let's get into it ✨


🌸 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 πŸ¦‹

So SSL_get_peer_tmp_key() hands you back the temporary key that the peer provided and that got used during key exchange. Like, for example, if ECDHE is in use, then this represents the peer's public ECDHE key. On success, a pointer to the key gets stored in *key.

🫢 Heads up bestie: it is the caller's responsibility to free this key after use, using EVP_PKEY_free(3). Don't just leave it there, okay? no cap.

SSL_get_server_tmp_key() is a backwards compatibility alias for SSL_get_peer_tmp_key(). Under that name it worked just on the client side of the connection β€” and its behaviour on the server end is release-dependent (iykyk, it varies by release 😭).

SSL_get_tmp_key() returns the equivalent information, but for the local end of the connection. main character energy, but for your side of the wire πŸ’…

πŸ”₯ RETURN VALUES πŸ”₯

All these functions return 1 on success and 0 otherwise. that's it, that's the vibe check ⭐

πŸ‘‘ NOTES πŸ‘‘

This function is implemented as a macro. (yes, really β€” don't come for me, that's just how it is πŸ™ˆ)

πŸŽ€ SEE ALSO πŸŽ€

ssl(7), EVP_PKEY_free(3)

Copyright 2017-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>.


aaand that's the whole page, bestie πŸ’œ this one's from OpenSSL 3.5.0, dated 2026-09-25 β€” go forth and free your EVP_PKEYs πŸŒˆπŸ¦‹βœ¨

πŸ“¦ where this page comes from