Mercurial > pidgin.yaz
comparison libpurple/certificate.c @ 19014:bc4d0ebeabd3
- Add expiration/activation time display to tls_cached verifier
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Thu, 12 Jul 2007 03:00:07 +0000 |
parents | b1090cbfc286 |
children | d6f902265076 |
comparison
equal
deleted
inserted
replaced
19013:5157ebe90b93 | 19014:bc4d0ebeabd3 |
---|---|
522 { | 522 { |
523 gchar *sha_asc; | 523 gchar *sha_asc; |
524 GByteArray *sha_bin; | 524 GByteArray *sha_bin; |
525 gchar *cn; | 525 gchar *cn; |
526 const gchar *cn_match; | 526 const gchar *cn_match; |
527 time_t activation, expiration; | |
528 /* Length of these buffers is dictated by 'man ctime_r' */ | |
529 gchar activ_str[26], expir_str[26]; | |
527 gchar *primary, *secondary; | 530 gchar *primary, *secondary; |
528 PurpleCertificate *crt = (PurpleCertificate *) vrq->cert_chain->data; | 531 PurpleCertificate *crt = (PurpleCertificate *) vrq->cert_chain->data; |
529 | 532 |
530 /* Pull out the SHA1 checksum */ | 533 /* Pull out the SHA1 checksum */ |
531 sha_bin = purple_certificate_get_fingerprint_sha1(crt); | 534 sha_bin = purple_certificate_get_fingerprint_sha1(crt); |
540 if (purple_certificate_check_subject_name(crt, vrq->subject_name)) { | 543 if (purple_certificate_check_subject_name(crt, vrq->subject_name)) { |
541 cn_match = _(""); | 544 cn_match = _(""); |
542 } else { | 545 } else { |
543 cn_match = _("(DOES NOT MATCH)"); | 546 cn_match = _("(DOES NOT MATCH)"); |
544 } | 547 } |
548 | |
549 /* Get the certificate times */ | |
550 /* TODO: Check the times against localtime */ | |
551 /* TODO: errorcheck? */ | |
552 g_assert(purple_certificate_get_times(crt, &activation, &expiration)); | |
553 ctime_r(&activation, activ_str); | |
554 ctime_r(&expiration, expir_str); | |
545 | 555 |
546 /* Make messages */ | 556 /* Make messages */ |
547 primary = g_strdup_printf(_("%s has presented the following certificate:"), vrq->subject_name); | 557 primary = g_strdup_printf(_("%s has presented the following certificate:"), vrq->subject_name); |
548 secondary = g_strdup_printf(_("Common name: %s %s\nFingerprint (SHA1): %s"), cn, cn_match, sha_asc); | 558 secondary = g_strdup_printf(_("Common name: %s %s\n\nFingerprint (SHA1): %s\n\nActivation date: %s\nExpiration date: %s\n"), cn, cn_match, sha_asc, activ_str, expir_str); |
549 | 559 |
550 /* Make a semi-pretty display */ | 560 /* Make a semi-pretty display */ |
551 purple_request_accept_cancel( | 561 purple_request_accept_cancel( |
552 vrq->cb_data, /* TODO: Find what the handle ought to be */ | 562 vrq->cb_data, /* TODO: Find what the handle ought to be */ |
553 _("SSL Certificate Verification"), | 563 _("SSL Certificate Verification"), |