Mercurial > pidgin
comparison libpurple/certificate.c @ 19081:bdd8911d5031
- Add debugging babble to check_signature_chain
author | William Ehlhardt <williamehlhardt@gmail.com> |
---|---|
date | Wed, 08 Aug 2007 04:38:26 +0000 |
parents | 3bdede51c007 |
children | 344fc06139b4 |
comparison
equal
deleted
inserted
replaced
19080:3bdede51c007 | 19081:bdd8911d5031 |
---|---|
170 gboolean | 170 gboolean |
171 purple_certificate_check_signature_chain(GList *chain) | 171 purple_certificate_check_signature_chain(GList *chain) |
172 { | 172 { |
173 GList *cur; | 173 GList *cur; |
174 PurpleCertificate *crt, *issuer; | 174 PurpleCertificate *crt, *issuer; |
175 gchar *uid; | |
175 | 176 |
176 g_return_val_if_fail(chain, FALSE); | 177 g_return_val_if_fail(chain, FALSE); |
178 | |
179 uid = purple_certificate_get_unique_id((PurpleCertificate *) chain->data); | |
180 purple_debug_info("certificate", | |
181 "Checking signature chain for uid=%s\n", | |
182 uid); | |
183 g_free(uid); | |
177 | 184 |
178 /* If this is a single-certificate chain, say that it is valid */ | 185 /* If this is a single-certificate chain, say that it is valid */ |
179 if (chain->next == NULL) { | 186 if (chain->next == NULL) { |
187 purple_debug_info("certificate", | |
188 "...Singleton. We'll say it's valid.\n"); | |
180 return TRUE; | 189 return TRUE; |
181 } | 190 } |
182 | 191 |
183 /* Load crt with the first certificate */ | 192 /* Load crt with the first certificate */ |
184 crt = (PurpleCertificate *)(chain->data); | 193 crt = (PurpleCertificate *)(chain->data); |
187 | 196 |
188 issuer = (PurpleCertificate *)(cur->data); | 197 issuer = (PurpleCertificate *)(cur->data); |
189 | 198 |
190 /* Check the signature for this link */ | 199 /* Check the signature for this link */ |
191 if (! purple_certificate_signed_by(crt, issuer) ) { | 200 if (! purple_certificate_signed_by(crt, issuer) ) { |
201 uid = purple_certificate_get_unique_id(issuer); | |
202 purple_debug_info("certificate", | |
203 "...Bad or missing signature by %s\nChain is INVALID\n", | |
204 uid); | |
205 g_free(uid); | |
206 | |
192 return FALSE; | 207 return FALSE; |
193 } | 208 } |
194 | 209 |
210 uid = purple_certificate_get_unique_id(issuer); | |
211 purple_debug_info("certificate", | |
212 "...Good signature by %s\n", | |
213 uid); | |
214 g_free(uid); | |
215 | |
195 /* The issuer is now the next crt whose signature is to be | 216 /* The issuer is now the next crt whose signature is to be |
196 checked */ | 217 checked */ |
197 crt = issuer; | 218 crt = issuer; |
198 } | 219 } |
199 | 220 |
200 /* If control reaches this point, the chain is valid */ | 221 /* If control reaches this point, the chain is valid */ |
222 purple_debug_info("certificate", "Chain is VALID\n"); | |
201 return TRUE; | 223 return TRUE; |
202 } | 224 } |
203 | 225 |
204 PurpleCertificate * | 226 PurpleCertificate * |
205 purple_certificate_import(PurpleCertificateScheme *scheme, const gchar *filename) | 227 purple_certificate_import(PurpleCertificateScheme *scheme, const gchar *filename) |