comparison libpurple/certificate.c @ 18964:7b03727b10b4

- x509_singleuse uses the subject_name field...somewhat
author William Ehlhardt <williamehlhardt@gmail.com>
date Wed, 27 Jun 2007 04:14:16 +0000
parents fcd05c39803e
children 898e2bd70f23
comparison
equal deleted inserted replaced
18963:146907cd3b07 18964:7b03727b10b4
188 static void 188 static void
189 x509_singleuse_start_verify (PurpleCertificateVerificationRequest *vrq) 189 x509_singleuse_start_verify (PurpleCertificateVerificationRequest *vrq)
190 { 190 {
191 gchar *sha_asc; 191 gchar *sha_asc;
192 GByteArray *sha_bin; 192 GByteArray *sha_bin;
193 gchar *cn;
194 const gchar *cn_match;
193 gchar *primary, *secondary; 195 gchar *primary, *secondary;
194 PurpleCertificate *crt = (PurpleCertificate *) vrq->cert_chain->data; 196 PurpleCertificate *crt = (PurpleCertificate *) vrq->cert_chain->data;
195 197
196 /* Pull out the SHA1 checksum */ 198 /* Pull out the SHA1 checksum */
197 sha_bin = purple_certificate_get_fingerprint_sha1(crt); 199 sha_bin = purple_certificate_get_fingerprint_sha1(crt);
198 /* Now decode it for display */ 200 /* Now decode it for display */
199 sha_asc = purple_base16_encode_chunked(sha_bin->data, 201 sha_asc = purple_base16_encode_chunked(sha_bin->data,
200 sha_bin->len); 202 sha_bin->len);
201 203
204 /* Get the cert Common Name */
205 cn = purple_certificate_get_subject_name(crt);
206
207 /* Determine whether the name matches */
208 /* TODO: Worry about strcmp safety? */
209 if (!strcmp(cn, vrq->subject_name)) {
210 cn_match = _("");
211 } else {
212 cn_match = _("(DOES NOT MATCH)");
213 }
214
202 /* Make messages */ 215 /* Make messages */
203 primary = g_strdup_printf(_("%s has presented the following certificate for just-this-once use:"), vrq->subject_name); 216 primary = g_strdup_printf(_("%s has presented the following certificate for just-this-once use:"), vrq->subject_name);
204 secondary = g_strdup_printf(_("Fingerprint (SHA1): %s"), sha_asc); 217 secondary = g_strdup_printf(_("Common name: %s %s\nFingerprint (SHA1): %s"), cn, cn_match, sha_asc);
205 218
206 /* Make a semi-pretty display */ 219 /* Make a semi-pretty display */
207 purple_request_accept_cancel( 220 purple_request_accept_cancel(
208 vrq->cb_data, /* TODO: Find what the handle ought to be */ 221 vrq->cb_data, /* TODO: Find what the handle ought to be */
209 _("Single-use Certificate Verification"), 222 _("Single-use Certificate Verification"),