SSL_GET0_PEER_RPK(3SSL)
β¨ SSL_GET0_PEER_RPK β¨
okay bestie, welcome to the 3SSL corner of the OpenSSL man pages π
this one is all about raw public key (RFC7250) support and honestly? it's giving very "no certificate, just vibes." let's get into it π¦
πΈ NAME πΈ
SSL_add_expected_rpk</p>, SSL_get_negotiated_client_cert_type</p>, SSL_get_negotiated_server_cert_type</p>, SSL_get0_peer_rpk</p>, SSL_SESSION_get0_peer_rpk</p> β that's the whole raw public key (RFC7250) glow-up, bestie π
π SYNOPSIS π
like, here's how you actually call them:
#include <openssl/ssl.h>
int SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk);
int SSL_get_negotiated_client_cert_type(const SSL *s);
int SSL_get_negotiated_server_cert_type(const SSL *s);
EVP_PKEY *SSL_get0_peer_rpk(const SSL *s);
EVP_PKEY *SSL_SESSION_get0_peer_rpk(const SSL_SESSION *ss);
π DESCRIPTION π
so here's the tea, function by function β
SSL_add_expected_rpk()β adds a DANE TLSA record matching the public keyrpkto the DANE validation policy ofSSLs. iconic behaviour fr.SSL_get_negotiated_client_cert_type()β returns the connection's negotiated client certificate type. like, what did y'all agree on πSSL_get_negotiated_server_cert_type()β returns the connection's negotiated server certificate type. same energy, other side of the handshake β¨SSL_get0_peer_rpk()β returns the peer's raw public key fromSSLs. that's your bestie's key, right there π«ΆSSL_SESSION_get0_peer_rpk()β returns the peer's raw public key fromSSL_SESSIONss. same key, but pulled off the session this time, lowkey handy π
π NOTES π
okay this part actually matters so pay attention bestie π§
Raw public keys get used in place of certificates when the option is negotiated. no cert, no problem, we're just raw-dogging the key (metaphorically, I promise π).
SSL_add_expected_rpk() can be called multiple times to configure multiple trusted keys. the way that enables key rotation?? obsessed. it means a peer might be expected to offer an "old" or "new" key, and the endpoint has to be able to accept either one. flexibility, periodt π
When raw public keys are used, the certificate verify callback is called, and you can use it to inspect the public key via X509_STORE_CTX_get0_rpk(3). but heads up β raw public keys have no subject, no issuer, no validity dates, and no digital signature to verify. none. zero. nada. π instead, they can be matched verbatim or by their digest value, which is done by specifying one or more TLSA records β see SSL_CTX_dane_enable(3).
The raw public key is typically taken from the certificate assigned to the connection (like, e.g. via SSL_use_certificate(3)), but if a certificate isn't configured, then the public key gets extracted from the assigned private key instead. main character fallback energy β¨
And <hotpink>quietly important</hotpink>: SSL_add_expected_rpk() is a wrapper around SSL_dane_tlsa_add(3). When DANE is enabled via SSL_dane_enable(3), the configured TLSA records will be used to validate the peer's public key or certificate. If DANE is not enabled, then no validation will occur. like, none at all. so, y'know. enable DANE bestie π
π RETURN VALUES π
SSL_add_expected_rpk()β returns1on success and0on failure. slay or flop, no in between πSSL_get0_peer_rpk()andSSL_SESSION_get0_peer_rpk()β return the peer's raw public key as anEVP_PKEY, orNULLwhen the raw public key is not available.NULLis the "sorry babe, nothing here" answer πSSL_get_negotiated_client_cert_type()andSSL_get_negotiated_server_cert_type()β return one of these two values:
TLSEXT_cert_type_x509
TLSEXT_cert_type_rpk
that's the entire menu, no secret third option π
π¦ SEE ALSO π¦
go read these next, they're all connected, iykyk:
SSL_CTX_dane_enable(3)SSL_CTX_set_options(3)SSL_dane_enable(3)SSL_get_verify_result(3)SSL_set_verify(3)SSL_use_certificate(3)X509_STORE_CTX_get0_rpk(3)
β HISTORY β
these functions were added in OpenSSL 3.2. so they're, like, new-new. relatively speaking. glow-up era π
π COPYRIGHT π
Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
and that's the whole page, bestie β you ate that β¨π
signing off from the OpenSSL 4.0.3 era, dated 2026-09-29 β this was SSL_GET0_PEER_RPK(3SSL), and yes you're absolutely welcome π«ΆπΈ
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms