Logging moved to cryptographic classes

This commit is contained in:
Simon Rozman 2016-03-18 12:40:25 +01:00
parent bd1652bd5f
commit 8933dfc4ce

View File

@ -73,10 +73,8 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
// Create RSA AES cryptographic context. // Create RSA AES cryptographic context.
wxCryptoSessionRSAAES cs; wxCryptoSessionRSAAES cs;
if (!cs.IsOk()) { if (!cs.IsOk())
wxLogError(wxT("Failed to create cryptographics session."));
return -1; return -1;
}
// Import public key. // Import public key.
wxCryptoKey ck; wxCryptoKey ck;
@ -86,11 +84,9 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
HGLOBAL res_handle = ::LoadResource(NULL, res); HGLOBAL res_handle = ::LoadResource(NULL, res);
wxASSERT_MSG(res_handle, wxT("loading resource failed")); wxASSERT_MSG(res_handle, wxT("loading resource failed"));
if (!ck.ImportPublic(cs, ::LockResource(res_handle), ::SizeofResource(NULL, res))) { if (!ck.ImportPublic(cs, ::LockResource(res_handle), ::SizeofResource(NULL, res)))
wxLogError(wxT("Failed to import public key."));
return -1; return -1;
} }
}
for (const wxChar *server = wxT(UPDATER_HTTP_SERVER); server[0]; server += wcslen(server) + 1) { for (const wxChar *server = wxT(UPDATER_HTTP_SERVER); server[0]; server += wcslen(server) + 1) {
wxXmlDocument doc; wxXmlDocument doc;
@ -156,10 +152,8 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
// Hash the content. // Hash the content.
wxCryptoHashSHA1 ch(cs); wxCryptoHashSHA1 ch(cs);
if (!wxXmlHashNode(ch, document)) { if (!wxXmlHashNode(ch, document))
wxLogWarning(wxT("Failed to hash the repository catalogue."));
continue; continue;
}
// We have the hash, we have the signature, we have the public key. Now verify. // We have the hash, we have the signature, we have the public key. Now verify.
if (!wxCryptoVerifySignature(ch, sig.data(), sig.size(), ck)) { if (!wxCryptoVerifySignature(ch, sig.data(), sig.size(), ck)) {