SSL_GET_PEER_TMP_KEY(3ossl)
π 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 π
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
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms