change: SecretSettings.secretKeyOutputPath拆为staticSecretKeyOutputPath和dynamicSecretKeyOutputPath,方便单独指定每个key的输出路径

before-split
walon 2025-05-23 11:09:27 +08:00
parent 32d1aac9ba
commit d06caf5e38
4 changed files with 11 additions and 13 deletions

View File

@ -224,9 +224,9 @@ namespace Obfuz
{
_buildTarget = target,
_defaultStaticSecretKey = settings.secretSettings.defaultStaticSecretKey,
_defaultStaticSecretKeyOutputPath = settings.secretSettings.DefaultStaticSecretKeyOutputPath,
_defaultStaticSecretKeyOutputPath = settings.secretSettings.staticSecretKeyOutputPath,
_defaultDynamicSecretKey = settings.secretSettings.defaultDynamicSecretKey,
_defaultDynamicSecretKeyOutputPath = settings.secretSettings.DefaultDynamicSecretKeyOutputPath,
_defaultDynamicSecretKeyOutputPath = settings.secretSettings.dynamicSecretKeyOutputPath,
_assembliesUsingDynamicSecretKeys = settings.secretSettings.assembliesUsingDynamicSecretKeys.ToList(),
_randomSeed = settings.secretSettings.randomSeed,
_encryptionVmGenerationSecretKey = settings.encryptionVMSettings.codeGenerationSecretKey,

View File

@ -93,7 +93,6 @@ namespace Obfuz.Settings
{
if (!s_Instance)
{
Debug.LogError("Cannot save ScriptableSingleton: no instance!");
return;
}

View File

@ -14,17 +14,16 @@ namespace Obfuz.Settings
[Tooltip("default dynamic secret key")]
public string defaultDynamicSecretKey = "Code Philosophy-Dynamic";
[Tooltip("secret key output path")]
public string secretKeyOutputPath = $"Assets/Resources/Obfuz";
[Tooltip("default static secret key output path")]
public string staticSecretKeyOutputPath = $"Assets/Resources/Obfuz/defaultStaticSecretKey.bytes";
[Tooltip("default dynamic secret key output path")]
public string dynamicSecretKeyOutputPath = $"Assets/Resources/Obfuz/defaultDynamicSecretKey.bytes";
[Tooltip("random seed")]
public int randomSeed = 0;
[Tooltip("name of assemblies those use dynamic secret key")]
public string[] assembliesUsingDynamicSecretKeys;
public string DefaultStaticSecretKeyOutputPath => Path.Combine(secretKeyOutputPath, "defaultStaticSecretKey.bytes");
public string DefaultDynamicSecretKeyOutputPath => Path.Combine(secretKeyOutputPath, "defaultDynamicSecretKey.bytes");
}
}

View File

@ -28,11 +28,11 @@ namespace Obfuz.Unity
SecretSettings settings = ObfuzSettings.Instance.secretSettings;
var staticSecretBytes = KeyGenerator.GenerateKey(settings.defaultStaticSecretKey, VirtualMachine.SecretKeyLength);
SaveKey(staticSecretBytes, settings.DefaultStaticSecretKeyOutputPath);
Debug.Log($"Save static secret key to {settings.DefaultStaticSecretKeyOutputPath}");
SaveKey(staticSecretBytes, settings.staticSecretKeyOutputPath);
Debug.Log($"Save static secret key to {settings.staticSecretKeyOutputPath}");
var dynamicSecretBytes = KeyGenerator.GenerateKey(settings.defaultDynamicSecretKey, VirtualMachine.SecretKeyLength);
SaveKey(dynamicSecretBytes, settings.DefaultDynamicSecretKeyOutputPath);
Debug.Log($"Save dynamic secret key to {settings.DefaultDynamicSecretKeyOutputPath}");
SaveKey(dynamicSecretBytes, settings.dynamicSecretKeyOutputPath);
Debug.Log($"Save dynamic secret key to {settings.dynamicSecretKeyOutputPath}");
AssetDatabase.Refresh();
}