libpurple/plugins/ssl/ssl-gnutls.c

changeset 36149
89bda8c0750d
parent 36148
5c9a99b257c0
child 36150
d8633f765a9e
equal deleted inserted replaced
36148:5c9a99b257c0 36149:89bda8c0750d
1230 static gchar * 1230 static gchar *
1231 x509_display_string(PurpleCertificate *crt) 1231 x509_display_string(PurpleCertificate *crt)
1232 { 1232 {
1233 gchar *sha_asc; 1233 gchar *sha_asc;
1234 GByteArray *sha_bin; 1234 GByteArray *sha_bin;
1235 gchar *cn; 1235 gchar *cn, *issuer_id;
1236 gint64 activation, expiration; 1236 gint64 activation, expiration;
1237 gchar *activ_str, *expir_str; 1237 gchar *activ_str, *expir_str;
1238 gboolean self_signed;
1238 gchar *text; 1239 gchar *text;
1239 #if GLIB_CHECK_VERSION(2,26,0) 1240 #if GLIB_CHECK_VERSION(2,26,0)
1240 GDateTime *act_dt, *exp_dt; 1241 GDateTime *act_dt, *exp_dt;
1241 #endif 1242 #endif
1242 1243
1246 sha_asc = purple_base16_encode_chunked(sha_bin->data, sha_bin->len); 1247 sha_asc = purple_base16_encode_chunked(sha_bin->data, sha_bin->len);
1247 1248
1248 /* Get the cert Common Name */ 1249 /* Get the cert Common Name */
1249 /* TODO: Will break on CA certs */ 1250 /* TODO: Will break on CA certs */
1250 cn = x509_common_name(crt); 1251 cn = x509_common_name(crt);
1252
1253 issuer_id = purple_certificate_get_issuer_unique_id(crt);
1251 1254
1252 /* Get the certificate times */ 1255 /* Get the certificate times */
1253 /* TODO: Check the times against localtime */ 1256 /* TODO: Check the times against localtime */
1254 /* TODO: errorcheck? */ 1257 /* TODO: errorcheck? */
1255 if (!x509_times(crt, &activation, &expiration)) { 1258 if (!x509_times(crt, &activation, &expiration)) {
1269 #else 1272 #else
1270 activ_str = g_strdup(ctime(&activation)); 1273 activ_str = g_strdup(ctime(&activation));
1271 expir_str = g_strdup(ctime(&expiration)); 1274 expir_str = g_strdup(ctime(&expiration));
1272 #endif 1275 #endif
1273 1276
1277 self_signed = purple_certificate_signed_by(crt, crt);
1278
1274 /* Make messages */ 1279 /* Make messages */
1275 text = g_strdup_printf( 1280 text = g_strdup_printf(
1276 _("Common name: %s\n\n" 1281 _("Common name: %s\n\n"
1282 "Issued by: %s\n\n"
1277 "Fingerprint (SHA1): %s\n\n" 1283 "Fingerprint (SHA1): %s\n\n"
1278 "Activation date: %s\n" 1284 "Activation date: %s\n"
1279 "Expiration date: %s\n"), 1285 "Expiration date: %s\n"),
1280 cn ? cn : "(null)", 1286 cn ? cn : "(null)",
1287 self_signed ? _("(self-signed)") : (issuer_id ? issuer_id : "(null)"),
1281 sha_asc ? sha_asc : "(null)", 1288 sha_asc ? sha_asc : "(null)",
1282 activ_str ? activ_str : "(null)", 1289 activ_str ? activ_str : "(null)",
1283 expir_str ? expir_str : "(null)"); 1290 expir_str ? expir_str : "(null)");
1284 1291
1285 /* Cleanup */ 1292 /* Cleanup */
1286 g_free(cn); 1293 g_free(cn);
1294 g_free(issuer_id);
1287 g_free(sha_asc); 1295 g_free(sha_asc);
1288 g_free(activ_str); 1296 g_free(activ_str);
1289 g_free(expir_str); 1297 g_free(expir_str);
1290 g_byte_array_free(sha_bin, TRUE); 1298 g_byte_array_free(sha_bin, TRUE);
1291 1299

mercurial