Merge branch 'release/AddSublicGen02'
This commit is contained in:
@@ -30,6 +30,10 @@
|
||||
<div class="px-1">CodImpiego</div>
|
||||
<div class="px-1">@codImpiego</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<div class="px-1">Payload</div>
|
||||
<div class="px-1">@decVal</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<div class="px-1">AppKey</div>
|
||||
<div class="px-1">@appKey</div>
|
||||
@@ -69,6 +73,7 @@
|
||||
|
||||
protected string codImpiego = "";
|
||||
protected string appKey = "";
|
||||
protected string decVal = "";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
@@ -112,7 +117,8 @@
|
||||
protected void Regenerate()
|
||||
{
|
||||
codImpiego = SubLicManager.CodImpiego();
|
||||
appKey = SubLicManager.GenKey(passphrase);
|
||||
appKey = SubLicManager.GenKey(passphrase, false);
|
||||
decVal = SteamCrypto.DecryptString(appKey, passphrase);
|
||||
}
|
||||
|
||||
private string passphrase = "SaltPass";
|
||||
|
||||
@@ -12,9 +12,7 @@ namespace EgwCoreLib.Utils
|
||||
/// </summary>
|
||||
public class SubLicManager
|
||||
{
|
||||
private MachineDataValidator MachineDataValidator { get; set; } = null!;
|
||||
|
||||
private MachineInfo MachineInfo { get; set; } = null!;
|
||||
#region Public Constructors
|
||||
|
||||
public SubLicManager()
|
||||
{
|
||||
@@ -22,6 +20,10 @@ namespace EgwCoreLib.Utils
|
||||
MachineInfo = new MachineInfo();
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string CodImpiego()
|
||||
{
|
||||
Guid tempKey = Guid.NewGuid();
|
||||
@@ -39,31 +41,42 @@ namespace EgwCoreLib.Utils
|
||||
.ToString();
|
||||
return codice;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Genera KEY macchina in modalità encrypt
|
||||
/// </summary>
|
||||
/// <param name="passphrase"></param>
|
||||
/// <param name="addGuid"></param>
|
||||
/// <returns></returns>
|
||||
public string GenKey(string passphrase)
|
||||
public string GenKey(string passphrase, bool addGuid = false)
|
||||
{
|
||||
Guid tempKey = Guid.NewGuid();
|
||||
string message = $"{tempKey}";
|
||||
var UserData = MachineInfo.GetInfo("USER");
|
||||
string payload = $"{DateTime.Now:yyMMdd}-{DateTime.Now:HHmmss}";
|
||||
string payload = addGuid ? $"|{tempKey}|" : "";
|
||||
if (UserData.ContainsKey("MachineName"))
|
||||
{
|
||||
payload += $"|{UserData["MachineName"]}";
|
||||
payload += $"{UserData["MachineName"]}|";
|
||||
}
|
||||
if (UserData.ContainsKey("UserDomainName"))
|
||||
{
|
||||
payload += $"|{UserData["UserDomainName"]}";
|
||||
payload += $"{UserData["UserDomainName"]}|";
|
||||
}
|
||||
if (UserData.ContainsKey("UserName"))
|
||||
{
|
||||
payload += $"|{UserData["UserName"]}";
|
||||
payload += $"{UserData["UserName"]}|";
|
||||
}
|
||||
return SteamCrypto.EncryptString(message, passphrase);
|
||||
payload += $"{DateTime.Now:yyMMdd}-{DateTime.Now:HHmmss}|";
|
||||
return SteamCrypto.EncryptString(payload, passphrase);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private MachineDataValidator MachineDataValidator { get; set; } = null!;
|
||||
|
||||
private MachineInfo MachineInfo { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user