Remove legacy AttackTracer repo content
Some checks failed
OfficeCom Sentinel Client / build-client (push) Has been cancelled

This commit is contained in:
OfficeCom Codex
2026-07-17 00:55:16 +02:00
parent 85e394f647
commit b5e06b885a
57 changed files with 98 additions and 3602 deletions

View File

@@ -0,0 +1,28 @@
using System.Security.Cryptography;
using System.Text;
namespace OCSentinelCli.Security;
internal static class ProtectedSecretStore
{
public static string LoadSecret(string path)
{
byte[] protectedBytes = File.ReadAllBytes(path);
byte[] plainBytes = ProtectedData.Unprotect(protectedBytes, null, DataProtectionScope.LocalMachine);
return Encoding.UTF8.GetString(plainBytes);
}
public static void SaveSecret(string path, string secret)
{
string fullPath = Path.GetFullPath(path);
string? directory = Path.GetDirectoryName(fullPath);
if (!string.IsNullOrWhiteSpace(directory))
{
Directory.CreateDirectory(directory);
}
byte[] plainBytes = Encoding.UTF8.GetBytes(secret);
byte[] protectedBytes = ProtectedData.Protect(plainBytes, null, DataProtectionScope.LocalMachine);
File.WriteAllBytes(fullPath, protectedBytes);
}
}