SSL_GET0_PEER_RPK(3ossl)
π SSL_GET0_PEER_RPK π
okay bestie, sit down, hydrate, and let me tell you about raw public keys, because this is the 3ossl manual page for SSL_GET0_PEER_RPK and it is lowkey iconic. we're talking RFC7250 support β raw public key energy, no certificate drama, just vibes and keys. π¦
β¨ NAME β¨
SSL_add_expected_rpk, SSL_get_negotiated_client_cert_type, SSL_get_negotiated_server_cert_type, SSL_get0_peer_rpk, SSL_SESSION_get0_peer_rpk β raw public key (RFC7250) support, bestie. that's the whole squad. π«Ά
πΈ SYNOPSIS πΈ
#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);
like, that's the whole cast list. no notes. π
π DESCRIPTION π
SSL_add_expected_rpk()β adds a DANE TLSA record matching public keyrpktoSSLs's DANE validation policy. she's adding a trusted key to the list, periodt.SSL_get_negotiated_client_cert_type()β returns the connection's negotiated client certificate type. what did y'all agree on? this tells you.SSL_get_negotiated_server_cert_type()β returns the connection's negotiated server certificate type. same energy, server side.SSL_get0_peer_rpk()β returns the peer's raw public key fromSSLs. the actual key, no certificate wrapper, just the raw thing. π₯SSL_SESSION_get0_peer_rpk()β returns the peer's raw public key fromSSL_SESSIONss. same vibe, but from the session instead.
π¦ NOTES π¦
so here's the tea. raw public keys get used in place of certificates when the option is negotiated. no cap.
SSL_add_expected_rpk() may be called multiple times to configure multiple trusted keys. why would you do that? key rotation, bestie. a peer might be expected to offer an "old" or "new" key, and the endpoint must be able to accept either one. slay. π
when raw public keys are used, the certificate verify callback is called, and it may be used to inspect the public key via X509_STORE_CTX_get0_rpk(3). and listen β raw public keys have no subject, issuer, validity dates nor digital signature to verify. they're giving minimalist. but they can be matched verbatim or by their digest value, and that's done by specifying one or more TLSA records, see SSL_CTX_dane_enable(3). iykyk.
the raw public key is typically taken from the certificate assigned to the connection (e.g. via SSL_use_certificate(3)), but if a certificate is not configured, then the public key will be extracted from the assigned private key. she adapts. π
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. and if DANE is not enabled? then no validation will occur. π«
not me telling you that skipping DANE means zero validation β like, none, bestie. if you wanted vibes-only crypto, that's how you get it. enable DANE if you want the TLSA records to actually do their job. π
π RETURN VALUES π
SSL_add_expected_rpk()returns1on success and0on failure. classic.SSL_get0_peer_rpk()andSSL_SESSION_get0_peer_rpk()return the peer's raw public key as anEVP_PKEYorNULLwhen the raw public key is not available. no key, noEVP_PKEY, justNULL. πSSL_get_negotiated_client_cert_type()andSSL_get_negotiated_server_cert_type()return one of the following values:
TLSEXT_cert_type_x509
TLSEXT_cert_type_rpk
like, pick one. those are the options. β
π SEE ALSO π
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)
go read them. they're the extended universe. π
β HISTORY β
these functions were added in OpenSSL 3.2. so if you're on something older, bestie, i'm so sorry, you don't have these. upgrade arc. π§
π COPYRIGHT π
Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
and that's the whole page, bestie!! this was OpenSSL 3.5.9, dated 2026-09-29, and you just read SSL_GET0_PEER_RPK(3ossl) in full. raw public keys, DANE records, key rotation β we ate and left no crumbs. π
β¨ mwah, go forth and negotiate some cert types. ππ¦π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms