[EU-FOSSA] Check Updater's certificate before launching it

This commit is contained in:
Don HO 2019-02-13 19:39:39 +01:00
parent 1ab1624800
commit 501980782f

View File

@ -37,6 +37,7 @@
#include "functionListPanel.h" #include "functionListPanel.h"
#include "fileBrowser.h" #include "fileBrowser.h"
#include "Sorters.h" #include "Sorters.h"
#include "verifySignedFile.h"
#include "LongRunningOperation.h" #include "LongRunningOperation.h"
#include "md5.h" #include "md5.h"
#include "sha-256.h" #include "sha-256.h"
@ -2811,6 +2812,15 @@ void Notepad_plus::command(int id)
generic_string updaterFullPath = updaterDir; generic_string updaterFullPath = updaterDir;
PathAppend(updaterFullPath, TEXT("gup.exe")); PathAppend(updaterFullPath, TEXT("gup.exe"));
#ifdef DEBUG // if not debug, then it's release
bool isCertifVerified = true;
#else //RELEASE
// check the signature on updater
bool isCertifVerified = VerifySignedLibrary(updaterFullPath.c_str(), NPP_COMPONENT_SIGNER_KEY_ID, NPP_COMPONENT_SIGNER_SUBJECT, NPP_COMPONENT_SIGNER_DISPLAY_NAME, false, false, false);
#endif
if (isCertifVerified)
{
generic_string param; generic_string param;
if (id == IDM_CONFUPDATERPROXY) if (id == IDM_CONFUPDATERPROXY)
{ {
@ -2830,6 +2840,7 @@ void Notepad_plus::command(int id)
updater.run(); updater.run();
} }
}
break; break;
} }