Changeset 65269 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 12, 2017 7:13:14 PM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r65268 r65269 2172 2172 "from <nobr><a href=\"%1\">%1</a></nobr> " 2173 2173 "and saved locally as <nobr><b>%2</b>, </nobr>" 2174 "but theSHA-256 checksum verification failed.</p>"2174 "but SHA-256 checksum verification failed.</p>" 2175 2175 "<p>Please do the download, installation and verification manually.</p>") 2176 2176 .arg(strUrl, strSrc)); … … 2266 2266 } 2267 2267 2268 void UIMessageCenter::cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const 2269 { 2270 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error, 2271 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded " 2272 "from <nobr><a href=\"%2\">%2</a></nobr> " 2273 "and saved locally as <nobr><b>%3</b>, </nobr>" 2274 "but SHA-256 checksum verification failed.</p>" 2275 "<p>Please do the download, installation and verification manually.</p>") 2276 .arg(strExtPackName, strFrom, strTo)); 2277 } 2278 2268 2279 bool UIMessageCenter::proposeDeleteExtentionPack(const QString &strTo) const 2269 2280 { … … 2282 2293 0 /* auto-confirm id */, 2283 2294 tr("Delete", "extension pack")); 2284 }2285 2286 void UIMessageCenter::cannotValidateExtentionPackSHA256Sum(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const2287 {2288 alert(windowManager().networkManagerOrMainWindowShown(), MessageType_Error,2289 tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "2290 "from <nobr><a href=\"%2\">%2</a></nobr> "2291 "and saved locally as <nobr><b>%3</b>, </nobr>"2292 "but the SHA-256 checksum verification failed.</p>"2293 "<p>Please do the download, installation and verification manually.</p>")2294 .arg(strExtPackName, strFrom, strTo));2295 2295 } 2296 2296 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp
r65268 r65269 23 23 # include <QDir> 24 24 # include <QFile> 25 # include <QCryptographicHash> 25 26 26 27 /* Local includes: */ … … 33 34 34 35 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 35 36 #include <iprt/sha.h>37 36 38 37 … … 142 141 const QString strFileName = strRecord.section(" *", 1); 143 142 const QString strDownloadedSumm = strRecord.section(" *", 0, 0); 144 if (strFileName == QFileInfo(source().toString()).fileName())143 if (strFileName == source().fileName()) 145 144 { 146 /* Calculate the SHA-256 on the bytes, creating a string: */ 147 uint8_t abHash[RTSHA256_HASH_SIZE]; 148 RTSha256(m_receivedData.constData(), m_receivedData.length(), abHash); 149 char szDigest[RTSHA256_DIGEST_LEN + 1]; 150 int rc = RTSha256ToString(abHash, szDigest, sizeof(szDigest)); 151 if (RT_FAILURE(rc)) 152 { 153 AssertRC(rc); 154 szDigest[0] = '\0'; 155 } 156 157 const QString strCalculatedSumm(szDigest); 158 // printf("Downloaded SHA-256 summ: [%s]\n", strDownloadedSumm.toUtf8().constData()); 159 // printf("Calculated SHA-256 summ: [%s]\n", strCalculatedSumm.toUtf8().constData()); 145 /* Calculate the SHA-256 hash ourselves: */ 146 QCryptographicHash hashSHA256(QCryptographicHash::Sha256); 147 hashSHA256.addData(m_receivedData); 148 const QString strCalculatedSumm(hashSHA256.result().toHex()); 149 //printf("Downloaded SHA-256 summ: [%s]\n", strDownloadedSumm.toUtf8().constData()); 150 //printf("Calculated SHA-256 summ: [%s]\n", strCalculatedSumm.toUtf8().constData()); 160 151 /* Make sure checksum is valid: */ 161 152 fSuccess = strDownloadedSumm == strCalculatedSumm; -
trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp
r65268 r65269 23 23 # include <QDir> 24 24 # include <QFile> 25 # include <QCryptographicHash> 25 26 26 27 /* Local includes: */ … … 61 62 62 63 /* Prepare source/target: */ 63 QString strVersion = vboxGlobal().vboxVersionStringNormalized();64 64 QString strExtPackUnderscoredName(QString(GUI_ExtPackName).replace(' ', '_')); 65 65 QString strTemplateSourcePath("http://download.virtualbox.org/virtualbox/%1/"); 66 66 QString strTemplateSourceName(QString("%1-%2.vbox-extpack").arg(strExtPackUnderscoredName)); 67 QString strSourcePath(strTemplateSourcePath.arg( strVersion));68 QString strSourceName(strTemplateSourceName.arg( strVersion));67 QString strSourcePath(strTemplateSourcePath.arg(vboxGlobal().vboxVersionStringNormalized())); 68 QString strSourceName(strTemplateSourceName.arg(vboxGlobal().vboxVersionStringNormalized())); 69 69 QString strSource(strSourcePath + strSourceName); 70 QString strPathSHA256SumsFile = QString("https://www.virtualbox.org/download/hashes/%1/SHA256SUMS").arg( strVersion);70 QString strPathSHA256SumsFile = QString("https://www.virtualbox.org/download/hashes/%1/SHA256SUMS").arg(vboxGlobal().vboxVersionStringNormalized()); 71 71 QString strTargetPath(vboxGlobal().homeFolder()); 72 72 QString strTargetName(strSourceName); … … 126 126 const QString strFileName = strRecord.section(" *", 1); 127 127 const QString strDownloadedSumm = strRecord.section(" *", 0, 0); 128 if (strFileName == QFileInfo(source().toString()).fileName())128 if (strFileName == source().fileName()) 129 129 { 130 /* Calculate the SHA-256 on the bytes, creating a string: */ 131 uint8_t abHash[RTSHA256_HASH_SIZE]; 132 RTSha256(m_receivedData.constData(), m_receivedData.length(), abHash); 133 char szDigest[RTSHA256_DIGEST_LEN + 1]; 134 int rc = RTSha256ToString(abHash, szDigest, sizeof(szDigest)); 135 if (RT_FAILURE(rc)) 136 { 137 AssertRC(rc); 138 szDigest[0] = '\0'; 139 } 140 141 const QString strCalculatedSumm(szDigest); 142 // printf("Downloaded SHA-256 summ: [%s]\n", strDownloadedSumm.toUtf8().constData()); 143 // printf("Calculated SHA-256 summ: [%s]\n", strCalculatedSumm.toUtf8().constData()); 130 /* Calculate the SHA-256 hash ourselves: */ 131 QCryptographicHash hashSHA256(QCryptographicHash::Sha256); 132 hashSHA256.addData(m_receivedData); 133 const QString strCalculatedSumm(hashSHA256.result().toHex()); 134 //printf("Downloaded SHA-256 summ: [%s]\n", strDownloadedSumm.toUtf8().constData()); 135 //printf("Calculated SHA-256 summ: [%s]\n", strCalculatedSumm.toUtf8().constData()); 144 136 /* Make sure checksum is valid: */ 145 137 fSuccess = strDownloadedSumm == strCalculatedSumm;
Note:
See TracChangeset
for help on using the changeset viewer.