SSL_GET_PEER_SIGNATURE_NID(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… 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 *sigalg to 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 the SSL connection, copy it β€” the original does not survive the breakup.
  • SSL_get_peer_signature_nid() sets *psig_nid to 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_nid to 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's EVP_PKEY_RSA_PSS. And if you want to tell rsa_pss_rsae_* apart from rsa_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(), and SSL_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 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