[Auth] Generate new key when key is invalid.

This commit is contained in:
RektInator 2019-10-03 09:16:26 +02:00
parent e2965aeb9a
commit 28721a9742
2 changed files with 13 additions and 5 deletions

View File

@ -70,7 +70,8 @@ namespace Components
if (std::find(Auth::BannedUids.begin(), Auth::BannedUids.end(), Steam::SteamUser()->GetSteamID().bits) != Auth::BannedUids.end()) if (std::find(Auth::BannedUids.begin(), Auth::BannedUids.end(), Steam::SteamUser()->GetSteamID().bits) != Auth::BannedUids.end())
{ {
Logger::SoftError("Your online profile is invalid. Delete your players folder and restart ^2IW4x^7."); Auth::GenerateKey();
Logger::SoftError("Your online profile is invalid. A new key has been generated.");
return; return;
} }
@ -284,6 +285,14 @@ namespace Components
} }
} }
void Auth::GenerateKey()
{
Auth::GuidToken.clear();
Auth::ComputeToken.clear();
Auth::GuidKey = Utils::Cryptography::ECC::GenerateKey(512);
Auth::StoreKey();
}
void Auth::LoadKey(bool force) void Auth::LoadKey(bool force)
{ {
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) return; if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled()) return;
@ -303,10 +312,7 @@ namespace Components
if (!Auth::GuidKey.isValid()) if (!Auth::GuidKey.isValid())
{ {
Auth::GuidToken.clear(); Auth::GenerateKey();
Auth::ComputeToken.clear();
Auth::GuidKey = Utils::Cryptography::ECC::GenerateKey(512);
Auth::StoreKey();
} }
} }

View File

@ -13,6 +13,8 @@ namespace Components
static void StoreKey(); static void StoreKey();
static void LoadKey(bool force = false); static void LoadKey(bool force = false);
static void GenerateKey();
static unsigned __int64 GetKeyHash(); static unsigned __int64 GetKeyHash();
static unsigned __int64 GetKeyHash(const std::string& key); static unsigned __int64 GetKeyHash(const std::string& key);