Changeset 45573 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 16, 2013 2:11:17 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp
r45570 r45573 22 22 #include <QFile> 23 23 #include <QThread> 24 #include <Q SslCertificate>24 #include <QRegExp> 25 25 26 26 /* GUI includes: */ … … 289 289 { 290 290 /* Parse the file content: */ 291 QByteArray data(file.readAll()); 292 QList<QSslCertificate> certificates = QSslCertificate::fromData(data); 293 if (certificates.size() != 2) 291 QString strData(file.readAll()); 292 QRegExp regExp("(-{5}BEGIN CERTIFICATE-{5}[\\s\\S\\n]+-{5}END CERTIFICATE-{5})\\n" 293 "(-{5}BEGIN CERTIFICATE-{5}[\\s\\S\\n]+-{5}END CERTIFICATE-{5})"); 294 regExp.setMinimal(true); 295 int iIndex = regExp.indexIn(strData); 296 if (iIndex == -1) 294 297 rc = VERR_FILE_IO_ERROR; 295 298 … … 297 300 if (RT_SUCCESS(rc)) 298 301 { 299 QByteArray certificate = certificates.first().toPem();302 QByteArray certificate = regExp.cap(1).toAscii(); 300 303 rc = verifyCertificatePca3G5(pHttp, certificate); 301 304 } 302 305 if (RT_SUCCESS(rc)) 303 306 { 304 QByteArray certificate = certificates.last().toPem();307 QByteArray certificate = regExp.cap(2).toAscii(); 305 308 rc = verifyCertificatePca3(pHttp, certificate); 306 309 } … … 479 482 { 480 483 /* Save certificate: */ 481 QSslCertificate formattedCertificate = QSslCertificate::fromData(certificate).first(); 482 int rc = file.write(formattedCertificate.toPem()) != -1 ? VINF_SUCCESS : VERR_WRITE_ERROR; 484 int rc = VINF_SUCCESS; 485 if (RT_SUCCESS(rc)) 486 rc = file.write(certificate) != -1 ? VINF_SUCCESS : VERR_WRITE_ERROR; 487 488 /* Add 'new-line' character: */ 489 if (RT_SUCCESS(rc)) 490 rc = file.write("\n") != -1 ? VINF_SUCCESS : VERR_WRITE_ERROR; 491 492 /* Return result-code: */ 483 493 return rc; 484 494 }
Note:
See TracChangeset
for help on using the changeset viewer.