SSL_GET_PEER_TMP_KEY(3ossl)

πŸ’– SSL_GET_PEER_TMP_KEY πŸ’–

okay bestie, welcome to the 3ossl corner of the manual-verse ✨ this one's all about peeking at the lil' temporary keys your connection is out here using during a handshake. not the long-term identity keys, the ephemeral ones β€” the ones that get made, used, and yeeted. very demure, very forward-secret. πŸ¦‹


🌸 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 ✨

SSL_get_peer_tmp_key() β€” okay so this one hands you the temporary key that the peer gave you, the one that got used during key exchange. like, if ECDHE is what's happening, then this is literally the peer's public ECDHE key. πŸ’… on success it drops a pointer to the key into *key. and bestie, listen: it is the caller's responsibility to free that key after use, using EVP_PKEY_free(3). no cap. you own it now. free it. 🫢

SSL_get_server_tmp_key() β€” this one is a backwards compatibility alias for SSL_get_peer_tmp_key(). back in the day under that name it only worked on the client side of the connection, and its behaviour on the server end is release-dependent. so like… vintage behaviour, y2k energy, handle with care. πŸ™ˆ

SSL_get_tmp_key() β€” same vibe, but for the local end of the connection. it's giving "the equivalent information, but for you." πŸ’–


πŸ”₯ RETURN VALUES πŸ”₯

all three of these return 1 on success and 0 otherwise. that's it. binary. slay. ⭐


πŸ‘‘ NOTES πŸ‘‘

this function is implemented as a macro. yes, a macro. so don't go trying to take its address or whatever, iykyk. πŸ’€


πŸŽ€ SEE ALSO πŸŽ€


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


and that's the whole page, bestie 🧚 this was OpenSSL 3.5.9, dated 2026-09-29, and it lives under the name SSL_GET_PEER_TMP_KEY(3ossl). go forth and free your EVP_PKEYs. πŸŒˆπŸ’–βœ¨

πŸ“¦ where this page comes from