Changeset 51736 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 26, 2014 9:53:45 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp
r51734 r51736 34 34 #include <iprt/http.h> 35 35 #include <iprt/err.h> 36 #include <iprt/zip.h> 36 37 37 38 /* Our network-reply thread: */ … … 76 77 static int performGetRequestForBinary(RTHTTP pHttp, const QNetworkRequest &request, QByteArray &reply); 77 78 static int checkCertificates(RTHTTP pHttp, const QString &strFullCertificateFileName); 79 static int decompressCertificate(const QByteArray &package, QByteArray &certificate, const QString &strName); 78 80 static int downloadCertificates(RTHTTP pHttp, const QString &strFullCertificateFileName); 79 81 static int downloadCertificatePca3G5(RTHTTP pHttp, QByteArray &certificate); … … 355 357 356 358 /* static */ 359 int UINetworkReplyPrivateThread::decompressCertificate(const QByteArray &package, QByteArray &certificate, const QString &strName) 360 { 361 /* Decompress certificate: */ 362 void *pDecompressedBuffer; 363 size_t cDecompressedSize; 364 int rc = RTZipPkzipMemDecompress(&pDecompressedBuffer, &cDecompressedSize, package, package.size(), strName.toLatin1().constData()); 365 if (RT_SUCCESS(rc)) 366 { 367 /* Copy certificate: */ 368 certificate = QByteArray((const char*)pDecompressedBuffer, (int)cDecompressedSize); 369 /* Free decompressed buffer: */ 370 RTMemFree(pDecompressedBuffer); 371 } 372 /* Return result: */ 373 return rc; 374 } 375 376 /* static */ 357 377 int UINetworkReplyPrivateThread::downloadCertificates(RTHTTP pHttp, const QString &strFullCertificateFileName) 358 378 { … … 360 380 QByteArray certificatePca3G5; 361 381 QByteArray certificatePca3; 362 /* Prepare result: */ 363 int rc = VINF_SUCCESS; 364 365 /* Download PCA-3G5 certificate: */ 366 if (RT_SUCCESS(rc)) 367 rc = downloadCertificatePca3G5(pHttp, certificatePca3G5); 368 /* Download PCA-3 certificate: */ 369 if (RT_SUCCESS(rc)) 370 rc = downloadCertificatePca3(pHttp, certificatePca3); 382 383 /* Receive certificate package: */ 384 QByteArray package; 385 const QNetworkRequest address(QUrl("http://www.verisign.com/support/roots.zip")); 386 int rc = performGetRequestForBinary(pHttp, address, package); 387 /* UnZIP PCA-3G5 certificate: */ 388 if (RT_SUCCESS(rc)) 389 { 390 rc = decompressCertificate(package, certificatePca3G5, 391 "VeriSign Root Certificates/Generation 5 (G5) PCA/VeriSign Class 3 Public Primary Certification Authority - G5.pem"); 392 /* Verify PCA-3G5 certificate: */ 393 if (RT_SUCCESS(rc)) 394 rc = verifyCertificatePca3G5(pHttp, certificatePca3G5); 395 } 396 /* UnZIP PCA-3 certificate: */ 397 if (RT_SUCCESS(rc)) 398 { 399 rc = decompressCertificate(package, certificatePca3, 400 "VeriSign Root Certificates/Generation 1 (G1) PCAs/Class 3 Public Primary Certification Authority.pem"); 401 /* Verify PCA-3 certificate: */ 402 if (RT_SUCCESS(rc)) 403 rc = verifyCertificatePca3(pHttp, certificatePca3); 404 } 405 406 /* Fallback.. download certificates separately: */ 407 if (!RT_SUCCESS(rc)) 408 { 409 /* Reset result: */ 410 rc = VINF_SUCCESS; 411 /* Download PCA-3G5 certificate: */ 412 if (RT_SUCCESS(rc)) 413 rc = downloadCertificatePca3G5(pHttp, certificatePca3G5); 414 /* Download PCA-3 certificate: */ 415 if (RT_SUCCESS(rc)) 416 rc = downloadCertificatePca3(pHttp, certificatePca3); 417 } 371 418 372 419 /* Save certificates: */
Note:
See TracChangeset
for help on using the changeset viewer.