Retrieve and save new fingerprints from libstrophe.

This also reads the certificate SHA256 and pubkey fingerprint from
libstrophe, but doesn't store it persistently yet.

Related-to: https://github.com/profanity-im/profanity/issues/2068
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel
2025-11-04 17:41:05 +01:00
parent 4dcaa839fa
commit 0acea8d0d2
5 changed files with 47 additions and 8 deletions

View File

@@ -1082,6 +1082,10 @@ _connection_certfail_cb(const xmpp_tlscert_t* xmpptlscert, const char* errormsg)
TLSCertificate*
_xmppcert_to_profcert(const xmpp_tlscert_t* xmpptlscert)
{
const char* pubkey_fp = NULL;
#ifdef HAVE_XMPP_CERT_PUBKEY_FINGERPRINT_SHA256
pubkey_fp = xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_PUBKEY_FINGERPRINT_SHA256);
#endif
int version = (int)strtol(
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_VERSION), NULL, 10);
return tlscerts_new(
@@ -1094,7 +1098,9 @@ _xmppcert_to_profcert(const xmpp_tlscert_t* xmpptlscert)
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_NOTAFTER),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_KEYALG),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_SIGALG),
xmpp_tlscert_get_pem(xmpptlscert));
xmpp_tlscert_get_pem(xmpptlscert),
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_FINGERPRINT_SHA256),
pubkey_fp);
}
static void