mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
also store PEM in TLSCertificate
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
parent
44e65f3089
commit
7c56eac154
@ -130,7 +130,7 @@ tlscerts_list(void)
|
|||||||
char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
|
char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
|
||||||
|
|
||||||
TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
|
TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
|
||||||
notafter, keyalg, signaturealg);
|
notafter, keyalg, signaturealg, NULL);
|
||||||
|
|
||||||
free(fingerprint);
|
free(fingerprint);
|
||||||
free(serialnumber);
|
free(serialnumber);
|
||||||
@ -154,7 +154,7 @@ tlscerts_list(void)
|
|||||||
TLSCertificate*
|
TLSCertificate*
|
||||||
tlscerts_new(const char* const fingerprint, int version, const char* const serialnumber, const char* const subjectname,
|
tlscerts_new(const char* const fingerprint, int version, const char* const serialnumber, const char* const subjectname,
|
||||||
const char* const issuername, const char* const notbefore, const char* const notafter,
|
const char* const issuername, const char* const notbefore, const char* const notafter,
|
||||||
const char* const key_alg, const char* const signature_alg)
|
const char* const key_alg, const char* const signature_alg, const char* const pem)
|
||||||
{
|
{
|
||||||
TLSCertificate* cert = calloc(1, sizeof(TLSCertificate));
|
TLSCertificate* cert = calloc(1, sizeof(TLSCertificate));
|
||||||
|
|
||||||
@ -183,6 +183,9 @@ tlscerts_new(const char* const fingerprint, int version, const char* const seria
|
|||||||
if (signature_alg) {
|
if (signature_alg) {
|
||||||
cert->signature_alg = strdup(signature_alg);
|
cert->signature_alg = strdup(signature_alg);
|
||||||
}
|
}
|
||||||
|
if (pem) {
|
||||||
|
cert->pem = strdup(pem);
|
||||||
|
}
|
||||||
|
|
||||||
gchar** fields = g_strsplit(subjectname, "/", 0);
|
gchar** fields = g_strsplit(subjectname, "/", 0);
|
||||||
for (int i = 0; i < g_strv_length(fields); i++) {
|
for (int i = 0; i < g_strv_length(fields); i++) {
|
||||||
@ -322,7 +325,7 @@ tlscerts_get_trusted(const char* const fingerprint)
|
|||||||
char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
|
char* signaturealg = g_key_file_get_string(tlscerts, fingerprint, "signaturealg", NULL);
|
||||||
|
|
||||||
TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
|
TLSCertificate* cert = tlscerts_new(fingerprint, version, serialnumber, subjectname, issuername, notbefore,
|
||||||
notafter, keyalg, signaturealg);
|
notafter, keyalg, signaturealg, NULL);
|
||||||
|
|
||||||
free(serialnumber);
|
free(serialnumber);
|
||||||
free(subjectname);
|
free(subjectname);
|
||||||
@ -380,6 +383,8 @@ tlscerts_free(TLSCertificate* cert)
|
|||||||
free(cert->key_alg);
|
free(cert->key_alg);
|
||||||
free(cert->signature_alg);
|
free(cert->signature_alg);
|
||||||
|
|
||||||
|
free(cert->pem);
|
||||||
|
|
||||||
free(cert);
|
free(cert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,13 +65,14 @@ typedef struct tls_cert_t
|
|||||||
char* fingerprint;
|
char* fingerprint;
|
||||||
char* key_alg;
|
char* key_alg;
|
||||||
char* signature_alg;
|
char* signature_alg;
|
||||||
|
char* pem;
|
||||||
} TLSCertificate;
|
} TLSCertificate;
|
||||||
|
|
||||||
void tlscerts_init(void);
|
void tlscerts_init(void);
|
||||||
|
|
||||||
TLSCertificate* tlscerts_new(const char* const fingerprint, int version, const char* const serialnumber, const char* const subjectname,
|
TLSCertificate* tlscerts_new(const char* const fingerprint, int version, const char* const serialnumber, const char* const subjectname,
|
||||||
const char* const issuername, const char* const notbefore, const char* const notafter,
|
const char* const issuername, const char* const notbefore, const char* const notafter,
|
||||||
const char* const key_alg, const char* const signature_alg);
|
const char* const key_alg, const char* const signature_alg, const char* const pem);
|
||||||
|
|
||||||
void tlscerts_set_current(const char* const fp);
|
void tlscerts_set_current(const char* const fp);
|
||||||
|
|
||||||
|
@ -1100,7 +1100,8 @@ _xmppcert_to_profcert(const xmpp_tlscert_t* xmpptlscert)
|
|||||||
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_NOTBEFORE),
|
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_NOTBEFORE),
|
||||||
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_NOTAFTER),
|
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_NOTAFTER),
|
||||||
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_KEYALG),
|
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_KEYALG),
|
||||||
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_SIGALG));
|
xmpp_tlscert_get_string(xmpptlscert, XMPP_CERT_SIGALG),
|
||||||
|
xmpp_tlscert_get_pem(xmpptlscert));
|
||||||
}
|
}
|
||||||
|
|
||||||
static xmpp_log_t*
|
static xmpp_log_t*
|
||||||
|
Loading…
Reference in New Issue
Block a user