SSL_GET_PEER_TMP_KEY(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… SSL_GET_PEER_TMP_KEY(3ossl) β€” the OpenSSL girlies' guide to temporary keys ✨

okay so bestie, welcome to SSL_GET_PEER_TMP_KEY(3ossl), one of the OpenSSL man pages and honestly kind of a hidden gem 🫢 it's all about getting info on the temporary keys that get used during a handshake β€” yes, the little throwaway keys the two sides cook up mid-conversation. no cap, it's giving "short-lived but crucial" πŸ’–


✨ SYNOPSIS ✨

like, here's the whole cast, in code, verbatim, don't @ me:

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

three functions, one signature vibe, all returning a long. slay πŸ’…


🌸 DESCRIPTION 🌸

πŸ’– SSL_get_peer_tmp_key()

this one returns the temporary key that the peer handed over, the one that got used during key exchange πŸ”₯ for example (and yes this is the actual example from the page, i'm not making it up): if ECDHE is in use, then this represents the peer's public ECDHE key. iconic.

on success, a pointer to the key gets stored in *key ✨ and then β€” listen, this is the important part β€” it is the caller's responsibility to free this key after use using EVP_PKEY_free(3) 🧚 like, you gotta clean up after yourself, bestie, no leaving your keys lying around 😭

πŸŽ€ SSL_get_server_tmp_key()

this is a backwards compatibility alias for SSL_get_peer_tmp_key() β€” same thing, different name, vintage edition πŸ¦‹ under that name it worked just on the client side of the connection, and its behaviour on the server end is release-dependent. so like… don't come for me if it acts different depending on your release, that's literally what the page says πŸ™ˆ

⭐ SSL_get_tmp_key()

this one returns the equivalent information but for the local end of the connection β€” same energy, opposite side of the group chat πŸ’œ


🌈 RETURN VALUES 🌈

all of these functions return 1 on success and 0 otherwise. that's it, that's the whole section, short and sweet like a good text back πŸ˜ŒπŸ’…


πŸ‘‘ NOTES πŸ‘‘

heads up: this function is implemented as a macro. yes, a macro. i know. it's giving "not a real function call" but it works, trust 🀑

πŸ¦‹ SEE ALSO πŸ¦‹

go read those too, i'm not asking πŸ’–


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 tea, bestie 🧚✨ this little masterpiece is from OpenSSL 3.5.6, dated 2026-04-07 β€” the SSL_GET_PEER_TMP_KEY(3ossl) manual page, signed, sealed, delivered, periodt πŸ’…πŸ’–πŸ”₯

πŸ“¦ where this page comes from