SSL_GET0_PEER_RPK(3ossl)
π¦ NAME π¦
okay bestie, welcome to the SSL_get0_peer_rpk(3ossl) page β it's all about raw public key (RFC7250) support β¨ and these are the main characters:
SSL_add_expected_rpkSSL_get_negotiated_client_cert_typeSSL_get_negotiated_server_cert_typeSSL_get0_peer_rpkSSL_SESSION_get0_peer_rpk
β¨ 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);
π DESCRIPTION π
SSL_add_expected_rpk(SSL *s, EVP_PKEY *rpk)β adds a DANE TLSA record matching public keyrpktoSSL s's DANE validation policy. literally adding a trusted-key receipt to the vibe check π§ΎSSL_get_negotiated_client_cert_type(const SSL *s)β returns the connection's negotiated client certificate type. what did we agree on for the client cert moment? πSSL_get_negotiated_server_cert_type(const SSL *s)β returns the connection's negotiated server certificate type. same energy, but for the server side π«ΆSSL_get0_peer_rpk(const SSL *s)β returns the peer's raw public key fromSSL s. gimme the peer's raw public key pls πSSL_SESSION_get0_peer_rpk(const SSL_SESSION *ss)β returns the peer's raw public key fromSSL_SESSION ss. same key-hunting energy, but from the session π
π NOTES π
Raw public keys are used in place of certificates when the option is negotiated. no cap, that's the whole setup π«
SSL_add_expected_rpk() may be called multiple times to configure multiple trusted keys. This makes it possible to allow for key rotation, where a peer might be expected to offer an "old" or "new" key and the endpoint must be able to accept either one. key rotation? we love a graceful era transition π
When raw public keys are used, the certificate verify callback is called, and may be used to inspect the public key via X509_STORE_CTX_get0_rpk(3). Raw public keys have no subject, issuer, validity dates nor digital signature to verify. They can, however, be matched verbatim or by their digest value; this is done by specifying one or more TLSA records, see SSL_CTX_dane_enable(3). no subject, no issuer, no dates, no signature β it's giving minimalist icon behavior π
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. so it's either cert-sourced or private-key-sourced β tracked, bestie π§
The SSL_add_expected_rpk() function 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. important: no DANE enabled means no validation, periodt π¨
π«Ά RETURN VALUES π«Ά
SSL_add_expected_rpk() returns 1 on success and 0 on failure. simple binary slay β
SSL_get0_peer_rpk() and SSL_SESSION_get0_peer_rpk() return the peer's raw public key as an EVP_PKEY or NULL when the raw public key is not available. if it's not there, it's a big ol' NULL π
SSL_get_negotiated_client_cert_type() and SSL_get_negotiated_server_cert_type() return one of the following values:
TLSEXT_cert_type_x509TLSEXT_cert_type_rpk
those two are the whole menu, iykyk π
π 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)
π HISTORY π
These functions were added in OpenSSL 3.2. new-ish era, iconic behavior π
π COPYRIGHT π
Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
xoxo, your Unix bestie π β this page is from OpenSSL 3.5.0, dated 2026-09-25, and yes, SSL_GET0_PEER_RPK(3ossl) ate and left no crumbs ππ«Ά
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms