SSL_GET_PEER_SIGNATURE_NID(3ossl)
π SSL_GET_PEER_SIGNATURE_NID(3ossl) β ok bestie, let's talk about who signed what
Hey so this is a page from the 3ossl manual, and it's literally all about figuring out which signature scheme got used to sign TLS messages. Both directions. Peer and local. Obsessed.
β¨ NAME β¨
SSL_get0_peer_signature_name, SSL_get_peer_signature_nid, SSL_get_peer_signature_type_nid, SSL_get0_signature_name, SSL_get_signature_nid, SSL_get_signature_type_nid β the whole girl squad that tells you the TLS message signing types π
πΈ SYNOPSIS πΈ
Like, here's the include and the vibes:
#include <openssl/ssl.h>
int SSL_get0_peer_signature_name(const SSL *ssl, const char **sigalg);
int SSL_get_peer_signature_nid(SSL *ssl, int *psig_nid);
int SSL_get_peer_signature_type_nid(const SSL *ssl, int *psigtype_nid);
int SSL_get0_signature_name(SSL *ssl, const char **sigalg);
int SSL_get_signature_nid(SSL *ssl, int *psig_nid);
int SSL_get_signature_type_nid(const SSL *ssl, int *psigtype_nid);
π¦ DESCRIPTION π¦
Okay so, function by function, because we're not skipping a single one:
SSL_get0_peer_signature_name()sets*sigalgto the IANA name of the signature scheme used by the peer to sign the TLS handshake. (The IANA registry lives here, if you're nosy:https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-signaturescheme.) Bestie, do NOT free the returned pointer. It's not yours, you didn't buy it. And if you need that string to stick around past the lifetime of theSSLconnection, copy it β the original does not survive the breakup.SSL_get_peer_signature_nid()sets*psig_nidto the NID of the digest the peer used to sign TLS messages. Also, fun fact: it's implemented as a macro. πSSL_get_peer_signature_type_nid()sets*psigtype_nidto the signature type the peer used to sign TLS messages. Right now, that signature type is the NID of the public key type used for signing β except for PSS signing, where it'sEVP_PKEY_RSA_PSS. And if you want to tellrsa_pss_rsae_*apart fromrsa_pss_pss_*, you're gonna have to check the type of public key in the peer's certificate. No shortcut, iykyk.SSL_get0_signature_name(),SSL_get_signature_nid(), andSSL_get_signature_type_nid()give you the exact same info but for the local end of the connection. Same energy, other side of the handshake. π«Ά
π₯ RETURN VALUES π₯
All of these return 1 for success and 0 for failure. Periodt.
And like, there are several possible reasons for failure β don't come for these functions when it's actually one of these:
- the peer or local end is a client and did not sign the handshake (i.e. did not use a client certificate)
- the cipher suite has no signature at all (e.g. it uses RSA key exchange, or it's anonymous)
- the TLS version is below
1.2 - or the functions were called too early, like before the peer signed a message π
π SEE ALSO π
ssl(7), SSL_get_peer_certificate(3)
π HISTORY π
SSL_get0_peer_signature_name() and SSL_get0_signature_name() are the new girls β they were added in OpenSSL 3.5. β
π COPYRIGHT π
Copyright 2017-2025 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 whole page, bestie β no notes π
this masterpiece is from version 3.5.0, dated 2026-09-25, and it'll be right here whenever you need a vibe check on your signatures. slay πβ¨
π¦ 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