Skip to content

Commit

Permalink
Resolved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelvds committed Jan 23, 2024
1 parent 4d66c72 commit 8925726
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/fiskaltrust.Launcher/Commands/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,28 +301,28 @@ public static async Task<ECDiffieHellman> LoadCurve(Guid cashboxId, string acces
Log.Warning($"Error loading or decrypting ECDH curve: {e.Message}. Regenerating new curve.");
}

// Handling offline client ECDH path
// Handling offline client ECDH path and regenerating curve logic
ECDiffieHellman clientEcdh = CashboxConfigEncryption.CreateCurve();
const string offlineClientEcdhPath = "/client.ecdh";
if (!dryRun && useOffline && File.Exists(offlineClientEcdhPath))
{
var clientEcdh = ECDiffieHellmanExt.Deserialize(await File.ReadAllTextAsync(offlineClientEcdhPath));
try
{
clientEcdh = ECDiffieHellmanExt.Deserialize(await File.ReadAllTextAsync(offlineClientEcdhPath));
File.Delete(offlineClientEcdhPath);
}
catch { }

return clientEcdh;
catch (Exception ex)
{
Log.Warning($"Failed to use offline ECDH curve: {ex.Message}");
}
}

// Regenerating the curve if it's not loaded or in case of an error
var newClientEcdh = CashboxConfigEncryption.CreateCurve();
if (!dryRun)
{
await File.WriteAllTextAsync(clientEcdhPath, dataProtector.Protect(newClientEcdh.Serialize()));
await File.WriteAllTextAsync(clientEcdhPath, dataProtector.Protect(clientEcdh.Serialize()));
}

return newClientEcdh;
return clientEcdh;
}
}
}
Expand Down

0 comments on commit 8925726

Please sign in to comment.