mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-29 00:06:21 +00:00
Move tls peer cert function
This commit is contained in:
@@ -266,6 +266,30 @@ connection_is_secured(void)
|
||||
return xmpp_conn_is_secured(conn.conn);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBMESODE
|
||||
TLSCertificate*
|
||||
connection_get_tls_peer_cert(void)
|
||||
{
|
||||
xmpp_tlscert_t *xmpptlscert = xmpp_conn_tls_peer_cert(conn.conn);
|
||||
int version = xmpp_conn_tlscert_version(xmpptlscert);
|
||||
char *serialnumber = xmpp_conn_tlscert_serialnumber(xmpptlscert);
|
||||
char *subjectname = xmpp_conn_tlscert_subjectname(xmpptlscert);
|
||||
char *issuername = xmpp_conn_tlscert_issuername(xmpptlscert);
|
||||
char *fingerprint = xmpp_conn_tlscert_fingerprint(xmpptlscert);
|
||||
char *notbefore = xmpp_conn_tlscert_notbefore(xmpptlscert);
|
||||
char *notafter = xmpp_conn_tlscert_notafter(xmpptlscert);
|
||||
char *key_alg = xmpp_conn_tlscert_key_algorithm(xmpptlscert);
|
||||
char *signature_alg = xmpp_conn_tlscert_signature_algorithm(xmpptlscert);
|
||||
|
||||
TLSCertificate *cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
|
||||
notafter, key_alg, signature_alg);
|
||||
|
||||
xmpp_conn_free_tlscert(conn.ctx, xmpptlscert);
|
||||
|
||||
return cert;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
_connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, const int error,
|
||||
xmpp_stream_error_t *const stream_error, void *const userdata)
|
||||
|
||||
Reference in New Issue
Block a user