Mercurial > trustbridge
comparison ui/downloader_win.cpp @ 18:f4f957c58e0a
Move listuitol and add cert pinning with a test certificate
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 19 Feb 2014 15:41:14 +0000 |
parents | c12825a651ed |
children | fec1a610d43f |
comparison
equal
deleted
inserted
replaced
17:c12825a651ed | 18:f4f957c58e0a |
---|---|
212 retval = (serverCert == mCert); | 212 retval = (serverCert == mCert); |
213 | 213 |
214 if (!retval) { | 214 if (!retval) { |
215 DEBUG << "Certificate is not the same as the pinned one!" | 215 DEBUG << "Certificate is not the same as the pinned one!" |
216 << "Base64 cert: " << serverCert.toBase64(); | 216 << "Base64 cert: " << serverCert.toBase64(); |
217 emit error("Invalid certificate", InvalidCertificate); | |
217 } | 218 } |
218 | 219 |
219 CertFreeCertificateContext(certContext); | 220 CertFreeCertificateContext(certContext); |
220 return retval; | 221 return retval; |
221 } | 222 } |
256 goto cleanup; | 257 goto cleanup; |
257 } | 258 } |
258 | 259 |
259 if (!verifyCertificate(hRequest)) { | 260 if (!verifyCertificate(hRequest)) { |
260 DEBUG << "Certificate verification failed"; | 261 DEBUG << "Certificate verification failed"; |
261 // TODO error out | 262 goto cleanup; |
262 } | 263 } |
263 | 264 |
264 if (!(WinHttpQueryHeaders(hRequest, | 265 if (!(WinHttpQueryHeaders(hRequest, |
265 WINHTTP_QUERY_LAST_MODIFIED | | 266 WINHTTP_QUERY_LAST_MODIFIED | |
266 WINHTTP_QUERY_FLAG_SYSTEMTIME, | 267 WINHTTP_QUERY_FLAG_SYSTEMTIME, |
325 goto cleanup; | 326 goto cleanup; |
326 } | 327 } |
327 | 328 |
328 if (!verifyCertificate(hRequest)) { | 329 if (!verifyCertificate(hRequest)) { |
329 DEBUG << "Certificate verification failed"; | 330 DEBUG << "Certificate verification failed"; |
330 // TODO error out | 331 goto cleanup; |
331 } | 332 } |
332 | 333 |
333 | 334 |
334 if (!(WinHttpQueryHeaders(hRequest, | 335 if (!(WinHttpQueryHeaders(hRequest, |
335 WINHTTP_QUERY_CONTENT_LENGTH | | 336 WINHTTP_QUERY_CONTENT_LENGTH | |