change: SecretSettings.secretKeyOutputPath拆为staticSecretKeyOutputPath和dynamicSecretKeyOutputPath,方便单独指定每个key的输出路径
parent
32d1aac9ba
commit
d06caf5e38
|
@ -224,9 +224,9 @@ namespace Obfuz
|
||||||
{
|
{
|
||||||
_buildTarget = target,
|
_buildTarget = target,
|
||||||
_defaultStaticSecretKey = settings.secretSettings.defaultStaticSecretKey,
|
_defaultStaticSecretKey = settings.secretSettings.defaultStaticSecretKey,
|
||||||
_defaultStaticSecretKeyOutputPath = settings.secretSettings.DefaultStaticSecretKeyOutputPath,
|
_defaultStaticSecretKeyOutputPath = settings.secretSettings.staticSecretKeyOutputPath,
|
||||||
_defaultDynamicSecretKey = settings.secretSettings.defaultDynamicSecretKey,
|
_defaultDynamicSecretKey = settings.secretSettings.defaultDynamicSecretKey,
|
||||||
_defaultDynamicSecretKeyOutputPath = settings.secretSettings.DefaultDynamicSecretKeyOutputPath,
|
_defaultDynamicSecretKeyOutputPath = settings.secretSettings.dynamicSecretKeyOutputPath,
|
||||||
_assembliesUsingDynamicSecretKeys = settings.secretSettings.assembliesUsingDynamicSecretKeys.ToList(),
|
_assembliesUsingDynamicSecretKeys = settings.secretSettings.assembliesUsingDynamicSecretKeys.ToList(),
|
||||||
_randomSeed = settings.secretSettings.randomSeed,
|
_randomSeed = settings.secretSettings.randomSeed,
|
||||||
_encryptionVmGenerationSecretKey = settings.encryptionVMSettings.codeGenerationSecretKey,
|
_encryptionVmGenerationSecretKey = settings.encryptionVMSettings.codeGenerationSecretKey,
|
||||||
|
|
|
@ -93,7 +93,6 @@ namespace Obfuz.Settings
|
||||||
{
|
{
|
||||||
if (!s_Instance)
|
if (!s_Instance)
|
||||||
{
|
{
|
||||||
Debug.LogError("Cannot save ScriptableSingleton: no instance!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,17 +14,16 @@ namespace Obfuz.Settings
|
||||||
[Tooltip("default dynamic secret key")]
|
[Tooltip("default dynamic secret key")]
|
||||||
public string defaultDynamicSecretKey = "Code Philosophy-Dynamic";
|
public string defaultDynamicSecretKey = "Code Philosophy-Dynamic";
|
||||||
|
|
||||||
[Tooltip("secret key output path")]
|
[Tooltip("default static secret key output path")]
|
||||||
public string secretKeyOutputPath = $"Assets/Resources/Obfuz";
|
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")]
|
[Tooltip("random seed")]
|
||||||
public int randomSeed = 0;
|
public int randomSeed = 0;
|
||||||
|
|
||||||
[Tooltip("name of assemblies those use dynamic secret key")]
|
[Tooltip("name of assemblies those use dynamic secret key")]
|
||||||
public string[] assembliesUsingDynamicSecretKeys;
|
public string[] assembliesUsingDynamicSecretKeys;
|
||||||
|
|
||||||
public string DefaultStaticSecretKeyOutputPath => Path.Combine(secretKeyOutputPath, "defaultStaticSecretKey.bytes");
|
|
||||||
|
|
||||||
public string DefaultDynamicSecretKeyOutputPath => Path.Combine(secretKeyOutputPath, "defaultDynamicSecretKey.bytes");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,11 @@ namespace Obfuz.Unity
|
||||||
SecretSettings settings = ObfuzSettings.Instance.secretSettings;
|
SecretSettings settings = ObfuzSettings.Instance.secretSettings;
|
||||||
|
|
||||||
var staticSecretBytes = KeyGenerator.GenerateKey(settings.defaultStaticSecretKey, VirtualMachine.SecretKeyLength);
|
var staticSecretBytes = KeyGenerator.GenerateKey(settings.defaultStaticSecretKey, VirtualMachine.SecretKeyLength);
|
||||||
SaveKey(staticSecretBytes, settings.DefaultStaticSecretKeyOutputPath);
|
SaveKey(staticSecretBytes, settings.staticSecretKeyOutputPath);
|
||||||
Debug.Log($"Save static secret key to {settings.DefaultStaticSecretKeyOutputPath}");
|
Debug.Log($"Save static secret key to {settings.staticSecretKeyOutputPath}");
|
||||||
var dynamicSecretBytes = KeyGenerator.GenerateKey(settings.defaultDynamicSecretKey, VirtualMachine.SecretKeyLength);
|
var dynamicSecretBytes = KeyGenerator.GenerateKey(settings.defaultDynamicSecretKey, VirtualMachine.SecretKeyLength);
|
||||||
SaveKey(dynamicSecretBytes, settings.DefaultDynamicSecretKeyOutputPath);
|
SaveKey(dynamicSecretBytes, settings.dynamicSecretKeyOutputPath);
|
||||||
Debug.Log($"Save dynamic secret key to {settings.DefaultDynamicSecretKeyOutputPath}");
|
Debug.Log($"Save dynamic secret key to {settings.dynamicSecretKeyOutputPath}");
|
||||||
AssetDatabase.Refresh();
|
AssetDatabase.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue