Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Specialized;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading;
- using System.Timers;
- using System.Windows.Forms;
- using Microsoft.VisualBasic;
- using Microsoft.VisualBasic.CompilerServices;
- using WindowsApplication1.My;
- namespace WindowsApplication1.CodeVest
- {
- // Token: 0x02000008 RID: 8
- internal class CodeVest
- {
- // Token: 0x14000001 RID: 1
- // (add) Token: 0x06000024 RID: 36 RVA: 0x00033B30 File Offset: 0x00031F30
- // (remove) Token: 0x06000025 RID: 37 RVA: 0x00033B4C File Offset: 0x00031F4C
- public event CodeVest.RunHookHandler RunHookSuccess
- {
- [MethodImpl(MethodImplOptions.Synchronized)]
- add
- {
- this.RunHookSuccessEvent = (CodeVest.RunHookHandler)Delegate.Combine(this.RunHookSuccessEvent, value);
- }
- [MethodImpl(MethodImplOptions.Synchronized)]
- remove
- {
- this.RunHookSuccessEvent = (CodeVest.RunHookHandler)Delegate.Remove(this.RunHookSuccessEvent, value);
- }
- }
- // Token: 0x14000002 RID: 2
- // (add) Token: 0x06000026 RID: 38 RVA: 0x00033B68 File Offset: 0x00031F68
- // (remove) Token: 0x06000027 RID: 39 RVA: 0x00033B84 File Offset: 0x00031F84
- public event CodeVest.RunHookHandler RunHookFail
- {
- [MethodImpl(MethodImplOptions.Synchronized)]
- add
- {
- this.RunHookFailEvent = (CodeVest.RunHookHandler)Delegate.Combine(this.RunHookFailEvent, value);
- }
- [MethodImpl(MethodImplOptions.Synchronized)]
- remove
- {
- this.RunHookFailEvent = (CodeVest.RunHookHandler)Delegate.Remove(this.RunHookFailEvent, value);
- }
- }
- // Token: 0x1700000B RID: 11
- // (get) Token: 0x06000028 RID: 40 RVA: 0x00033BA0 File Offset: 0x00031FA0
- public string UserName
- {
- get
- {
- return this._Username;
- }
- }
- // Token: 0x1700000C RID: 12
- // (get) Token: 0x06000029 RID: 41 RVA: 0x00033BB4 File Offset: 0x00031FB4
- public DateTime ExpirationDate
- {
- get
- {
- return this.valid_till;
- }
- }
- // Token: 0x1700000D RID: 13
- // (get) Token: 0x0600002A RID: 42 RVA: 0x00033BC8 File Offset: 0x00031FC8
- public TimeSpan TimeRemaining
- {
- get
- {
- if (this.valid_till.Subtract(DateTime.Now).Days < 0)
- {
- return TimeSpan.Zero;
- }
- return this.valid_till.Subtract(DateTime.Now);
- }
- }
- // Token: 0x1700000E RID: 14
- // (get) Token: 0x0600002B RID: 43 RVA: 0x00033C08 File Offset: 0x00032008
- public CodeVest.LicenseTypes LicenseType
- {
- get
- {
- return this._license_type;
- }
- }
- // Token: 0x1700000F RID: 15
- // (get) Token: 0x0600002C RID: 44 RVA: 0x00033C1C File Offset: 0x0003201C
- public bool LicenseExpires
- {
- get
- {
- return true;
- }
- }
- // Token: 0x17000010 RID: 16
- // (get) Token: 0x0600002D RID: 45 RVA: 0x00033C2C File Offset: 0x0003202C
- public string MachineId
- {
- get
- {
- return this.hardwareId;
- }
- }
- // Token: 0x0600002E RID: 46 RVA: 0x00033C40 File Offset: 0x00032040
- public CodeVest()
- {
- this._Version = new Version(0, 2, 1, 1);
- CodeVest.cv = this;
- this._PreferredMetadataEndPoint = "https://codevest.sh/codevest_api.php";
- this._AlternateMetadataEndPoint = "http://codevest.sh/codevest_api2.php";
- }
- // Token: 0x0600002F RID: 47 RVA: 0x00033C74 File Offset: 0x00032074
- public void Initialize(string productId, string key)
- {
- this.Initialize(productId, key, new CodeVest.codeVestSettings());
- }
- // Token: 0x06000030 RID: 48 RVA: 0x00033C84 File Offset: 0x00032084
- public static void ClipboardTimerHandler(object sender, ElapsedEventArgs e)
- {
- Thread thread = new Thread(delegate()
- {
- if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text))
- {
- string text = Clipboard.GetText();
- if (Operators.CompareString(text, Encoding.ASCII.GetString(CodeVest._PrivateKey_new), false) == 0 | Operators.CompareString(text, Encoding.ASCII.GetString(CodeVest._PrivateKey_first), false) == 0)
- {
- Clipboard.SetText(text.Substring(0, 5) + text.Substring(6));
- }
- }
- });
- thread.SetApartmentState(ApartmentState.STA);
- thread.Start();
- thread.Join();
- }
- // Token: 0x17000011 RID: 17
- // (get) Token: 0x06000031 RID: 49 RVA: 0x00033CBC File Offset: 0x000320BC
- // (set) Token: 0x06000032 RID: 50 RVA: 0x00033CD0 File Offset: 0x000320D0
- public virtual WebClient client
- {
- get
- {
- return this._client;
- }
- [MethodImpl(MethodImplOptions.Synchronized)]
- set
- {
- DownloadProgressChangedEventHandler value2 = new DownloadProgressChangedEventHandler(this.download_progress);
- if (this._client != null)
- {
- this._client.DownloadProgressChanged -= value2;
- }
- this._client = value;
- if (this._client != null)
- {
- this._client.DownloadProgressChanged += value2;
- }
- }
- }
- // Token: 0x06000033 RID: 51 RVA: 0x00033D1C File Offset: 0x0003211C
- public void updateApp(string url)
- {
- this.client = new WebClient();
- try
- {
- if (Operators.CompareString(url.Substring(0, 1), "@", false) == 0)
- {
- if (File.Exists(Path.GetTempPath() + "codevest_update.exe"))
- {
- File.Delete(Path.GetTempPath() + "codevest_update.exe");
- }
- MyProject.Forms.frmCVUpdate.Show();
- this.client.DownloadFileAsync(new Uri(url.Substring(1)), Path.GetTempPath() + "codevest_update.exe");
- }
- else
- {
- this.client.DownloadFileAsync(new Uri(url), Path.GetTempPath() + "codevest_update.exe");
- Process.Start(Path.GetTempPath() + "codevest_update.exe");
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show("The update can't be found, please make sure that any security software is disabled and lastly use a VPN !");
- Environment.Exit(0);
- }
- for (;;)
- {
- Application.DoEvents();
- }
- }
- // Token: 0x06000034 RID: 52 RVA: 0x00033E18 File Offset: 0x00032218
- private void download_progress(object sender, DownloadProgressChangedEventArgs e)
- {
- checked
- {
- int value = (int)Math.Round((double)e.BytesReceived / 1000000.0);
- int value2 = (int)Math.Round((double)e.TotalBytesToReceive / 1000000.0);
- MyProject.Forms.frmCVUpdate.Label1.Text = string.Concat(new string[]
- {
- "Download:",
- Conversions.ToString(value),
- " MB / ",
- Conversions.ToString(value2),
- "MB"
- });
- MyProject.Forms.frmCVUpdate.ProgressBar1.Value = e.ProgressPercentage;
- MyProject.Forms.frmCVUpdate.Label2.Text = Conversions.ToString(MyProject.Forms.frmCVUpdate.ProgressBar1.Value) + "%";
- if (MyProject.Forms.frmCVUpdate.ProgressBar1.Value == 100)
- {
- try
- {
- if (File.Exists(Path.GetTempPath() + "codevest_update.exe"))
- {
- string text = AppDomain.CurrentDomain.BaseDirectory + AppDomain.CurrentDomain.FriendlyName;
- if (File.Exists(text + ".bck"))
- {
- File.Delete(text + ".bck");
- }
- File.Move(text, text + ".bck");
- File.Move(Path.GetTempPath() + "codevest_update.exe", text);
- if (File.Exists(text))
- {
- Process.Start(text);
- }
- else
- {
- Interaction.MsgBox("There seems to be an error, make sure any security software is disabled, lastly use a VPN !", MsgBoxStyle.OkOnly, null);
- }
- Environment.Exit(0);
- }
- }
- catch (Exception ex)
- {
- }
- }
- }
- }
- // Token: 0x06000035 RID: 53 RVA: 0x00033FD4 File Offset: 0x000323D4
- public void Initialize(string productId, string Privatekey, CodeVest.codeVestSettings settings)
- {
- if (this._Authenticator != null)
- {
- throw new Exception("Loader has already been initialized.");
- }
- if (settings == null)
- {
- throw new ArgumentNullException("settings");
- }
- this._k = "";
- this._ProductId = productId;
- this._PrivateKey = Privatekey;
- CodeVest._timer = new System.Timers.Timer(3000.0);
- CodeVest._timer.Elapsed += CodeVest.ClipboardTimerHandler;
- CodeVest._timer.Enabled = true;
- CodeVest._PrivateKey_first = Encoding.ASCII.GetBytes(FingerPrint.GetMD5("o6806a42kbM7c5K%!>" + Privatekey).Substring(0, 14));
- CodeVest._PrivateKey_new = CodeVest._PrivateKey_first;
- this.hardwareId = FingerPrint.Value();
- NameValueCollection nameValueCollection = new NameValueCollection();
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- while (Operators.CompareString(nameValueCollection2["success"], "1", false) != 0)
- {
- frmCVLogin frmCVLogin = new frmCVLogin();
- DialogResult dialogResult = frmCVLogin.ShowDialog();
- if (dialogResult == DialogResult.OK)
- {
- nameValueCollection["username"] = frmCVLogin.username;
- nameValueCollection["password"] = frmCVLogin.password;
- nameValueCollection["fn"] = "login";
- nameValueCollection2 = this.HTTP_request(nameValueCollection);
- if (Operators.CompareString(nameValueCollection2["error"], "1", false) == 0)
- {
- MessageBox.Show(nameValueCollection2["msg"]);
- }
- }
- else
- {
- Environment.Exit(-1);
- }
- }
- if (Operators.CompareString(nameValueCollection2["startup_message"], "", false) != 0)
- {
- MessageBox.Show(nameValueCollection2["startup_message"]);
- }
- DateTime.TryParse(nameValueCollection2["valid_till"], out this.valid_till);
- this._license_type = (CodeVest.LicenseTypes)Conversions.ToByte(Enum.Parse(typeof(CodeVest.LicenseTypes), nameValueCollection2["license_type"]));
- this._Username = nameValueCollection["username"];
- this._Password = nameValueCollection["password"];
- if (Operators.CompareString(nameValueCollection2["last_version"], Assembly.GetEntryAssembly().GetName().Version.ToString(4), false) != 0)
- {
- if (Operators.CompareString(nameValueCollection2["force_update"], "2", false) != 0)
- {
- if (Operators.CompareString(nameValueCollection2["force_update"], "1", false) == 0)
- {
- this.updateApp(nameValueCollection2["update_url"]);
- }
- else if (MessageBox.Show(string.Concat(new string[]
- {
- "New version available. Do you want to update from",
- Assembly.GetEntryAssembly().GetName().Version.ToString(4),
- " to ",
- nameValueCollection2["last_version"],
- "?"
- }), "CodeVest", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- this.updateApp(nameValueCollection2["update_url"]);
- }
- }
- }
- }
- // Token: 0x06000036 RID: 54 RVA: 0x000342A4 File Offset: 0x000326A4
- public void runHook()
- {
- NameValueCollection nameValueCollection = new NameValueCollection();
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- nameValueCollection["username"] = this._Username;
- nameValueCollection["password"] = this._Password;
- nameValueCollection["fn"] = "login";
- nameValueCollection2 = this.HTTP_request(nameValueCollection);
- if (Operators.CompareString(nameValueCollection2["error"], "1", false) == 0)
- {
- CodeVest.RunHookHandler runHookHandler = this.RunHookFailEvent;
- if (runHookHandler != null)
- {
- runHookHandler(this, new EventArgs());
- }
- }
- else
- {
- CodeVest.RunHookHandler runHookHandler = this.RunHookSuccessEvent;
- if (runHookHandler != null)
- {
- runHookHandler(this, new EventArgs());
- }
- }
- }
- // Token: 0x06000037 RID: 55 RVA: 0x00034340 File Offset: 0x00032740
- public string getGlobalSecureVariable(string name)
- {
- NameValueCollection nameValueCollection = new NameValueCollection();
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- nameValueCollection["fn"] = "getVar";
- nameValueCollection["varName"] = name;
- nameValueCollection2 = this.HTTP_request(nameValueCollection);
- if (Operators.CompareString(nameValueCollection2["success"], "1", false) == 0)
- {
- return nameValueCollection2["value"];
- }
- return "";
- }
- // Token: 0x06000038 RID: 56 RVA: 0x000343A8 File Offset: 0x000327A8
- public string getSecureVariable(string name)
- {
- NameValueCollection nameValueCollection = new NameValueCollection();
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- nameValueCollection["username"] = this._Username;
- nameValueCollection["password"] = this._Password;
- nameValueCollection["fn"] = "getVar";
- nameValueCollection["varName"] = name;
- nameValueCollection2 = this.HTTP_request(nameValueCollection);
- if (Operators.CompareString(nameValueCollection2["success"], "1", false) == 0)
- {
- return nameValueCollection2["value"];
- }
- return "";
- }
- // Token: 0x06000039 RID: 57 RVA: 0x00034434 File Offset: 0x00032834
- public bool setSecureVariable(string name, string value)
- {
- NameValueCollection nameValueCollection = new NameValueCollection();
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- nameValueCollection["username"] = this._Username;
- nameValueCollection["password"] = this._Password;
- nameValueCollection["fn"] = "setVar";
- nameValueCollection["varName"] = name;
- nameValueCollection["varValue"] = value;
- nameValueCollection2 = this.HTTP_request(nameValueCollection);
- return Operators.CompareString(nameValueCollection2["success"], "1", false) == 0;
- }
- // Token: 0x0600003A RID: 58 RVA: 0x000344BC File Offset: 0x000328BC
- public bool blocLicense()
- {
- NameValueCollection nameValueCollection = new NameValueCollection();
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- nameValueCollection["username"] = this._Username;
- nameValueCollection["password"] = this._Password;
- nameValueCollection["fn"] = "blockLic";
- nameValueCollection2 = this.HTTP_request(nameValueCollection);
- return Operators.CompareString(nameValueCollection2["success"], "1", false) == 0;
- }
- // Token: 0x0600003B RID: 59 RVA: 0x0003452C File Offset: 0x0003292C
- public bool setGlobalSecureVariable(string name, string value)
- {
- NameValueCollection nameValueCollection = new NameValueCollection();
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- nameValueCollection["fn"] = "setVar";
- nameValueCollection["varName"] = name;
- nameValueCollection["varValue"] = value;
- nameValueCollection2 = this.HTTP_request(nameValueCollection);
- return Operators.CompareString(nameValueCollection2["success"], "1", false) == 0;
- }
- // Token: 0x0600003C RID: 60 RVA: 0x00034594 File Offset: 0x00032994
- public NameValueCollection HTTP_request(NameValueCollection values)
- {
- WebClient webClient = new WebClient();
- NameValueCollection nameValueCollection = new NameValueCollection();
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- NameValueCollection nameValueCollection3 = new NameValueCollection();
- webClient.Proxy = new WebProxy();
- nameValueCollection3["hardware_id"] = this.hardwareId;
- nameValueCollection3["hid"] = FingerPrint.fingerPrintDebug;
- nameValueCollection3["fn"] = "get_key";
- if (Operators.CompareString(values["username"], "", false) != 0)
- {
- this._Username = values["username"];
- this._Password = values["password"];
- }
- nameValueCollection3["username"] = this._Username;
- nameValueCollection3["password"] = this._Password;
- string text = "";
- int num = 0;
- checked
- {
- int num2 = nameValueCollection3.AllKeys.Count<string>() - 1;
- for (int i = num; i <= num2; i++)
- {
- text = string.Concat(new string[]
- {
- text,
- nameValueCollection3.GetKey(i),
- "=",
- nameValueCollection3.Get(i).Replace("\n", "\r\r"),
- "\n"
- });
- }
- nameValueCollection.Add("data", this.EncryptStringAES(text, this._PrivateKey));
- byte[] bytes = webClient.UploadValues(string.Concat(new string[]
- {
- this._PreferredMetadataEndPoint,
- "?p_id=",
- this._ProductId,
- "&v=",
- this._Version.ToString(4),
- "&k=",
- this._k,
- "&get_key=1"
- }), "POST", nameValueCollection);
- string @string = Encoding.ASCII.GetString(bytes);
- string text2 = this.DecryptStringAES(@string, this._PrivateKey);
- if (text2.Length > 5 & (text2.IndexOf("ror=1") < 1 & text2.IndexOf("ccess=1") < 1))
- {
- CodeVest._PrivateKey_new = CodeVest._PrivateKey_first;
- nameValueCollection2.Add("data", this.EncryptStringAES(text, this._PrivateKey));
- bytes = webClient.UploadValues(string.Concat(new string[]
- {
- this._PreferredMetadataEndPoint,
- "?p_id=",
- this._ProductId,
- "&v=",
- this._Version.ToString(4),
- "&get_key=1"
- }), "POST", nameValueCollection2);
- @string = Encoding.ASCII.GetString(bytes);
- text2 = this.DecryptStringAES(@string, this._PrivateKey);
- if (text2.Length > 5 & (text2.IndexOf("ror=1") < 1 & text2.IndexOf("ccess=1") < 1))
- {
- MessageBox.Show("Application license error");
- Environment.Exit(1);
- }
- }
- string[] array = text2.Split(new char[]
- {
- '\n'
- });
- NameValueCollection nameValueCollection4 = new NameValueCollection();
- foreach (string text3 in array)
- {
- if (text3.Length > 0 && Operators.CompareString(Conversions.ToString(text3[0]), "\0", false) != 0)
- {
- nameValueCollection4.Set(text3.Split(new char[]
- {
- '='
- }).ElementAt(0), text3.Split(new char[]
- {
- '='
- }).ElementAt(1).Replace("\r\r", "\n"));
- }
- }
- if (Operators.CompareString(nameValueCollection4["error"], "1", false) == 0)
- {
- MessageBox.Show(nameValueCollection4["msg"]);
- }
- else
- {
- CodeVest._PrivateKey_new = Encoding.ASCII.GetBytes(nameValueCollection4["key"]);
- this._k = nameValueCollection4["key_id"];
- }
- return this.HTTP_direct_request(values);
- }
- }
- // Token: 0x0600003D RID: 61 RVA: 0x00034998 File Offset: 0x00032D98
- public NameValueCollection HTTP_direct_request(NameValueCollection values)
- {
- WebClient webClient = new WebClient();
- NameValueCollection nameValueCollection = new NameValueCollection();
- webClient.Proxy = new WebProxy();
- values["hardware_id"] = this.hardwareId;
- values["hid"] = FingerPrint.fingerPrintDebug;
- string text = "";
- int num = 0;
- checked
- {
- int num2 = values.AllKeys.Count<string>() - 1;
- for (int i = num; i <= num2; i++)
- {
- text = string.Concat(new string[]
- {
- text,
- values.GetKey(i),
- "=",
- values.Get(i).Replace("\n", "\r\\n\r"),
- "\n"
- });
- }
- nameValueCollection.Add("data", this.EncryptStringAES(text, this._PrivateKey));
- byte[] bytes = webClient.UploadValues(string.Concat(new string[]
- {
- this._PreferredMetadataEndPoint,
- "?p_id=",
- this._ProductId,
- "&v=",
- this._Version.ToString(4),
- "&k=",
- this._k,
- (Operators.CompareString(values["fn"], "get_key", false) == 0) ? "&get_key=1" : ""
- }), "POST", nameValueCollection);
- string @string = Encoding.ASCII.GetString(bytes);
- string text2 = this.DecryptStringAES(@string, this._PrivateKey);
- if (text2.Length > 5 & (text2.IndexOf("ror=1") < 1 & text2.IndexOf("ccess=1") < 1))
- {
- MessageBox.Show("Application license error");
- Environment.Exit(1);
- }
- string[] array = text2.Split(new char[]
- {
- '\n'
- });
- NameValueCollection nameValueCollection2 = new NameValueCollection();
- foreach (string text3 in array)
- {
- if (text3.Length > 0 && Operators.CompareString(Conversions.ToString(text3[0]), "\0", false) != 0)
- {
- nameValueCollection2.Set(text3.Split(new char[]
- {
- '='
- }).ElementAt(0), text3.Split(new char[]
- {
- '='
- }).ElementAt(1).Replace("\r\\n\r", "\n"));
- }
- }
- return nameValueCollection2;
- }
- }
- // Token: 0x0600003E RID: 62 RVA: 0x00034C18 File Offset: 0x00033018
- public string EncryptStringAES(string plainText, string sharedSecret)
- {
- if (string.IsNullOrEmpty(plainText))
- {
- throw new ArgumentNullException("plainText");
- }
- if (string.IsNullOrEmpty(sharedSecret))
- {
- throw new ArgumentNullException("sharedSecret");
- }
- Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(sharedSecret, CodeVest._PrivateKey_new);
- RijndaelManaged rijndaelManaged = new RijndaelManaged();
- rijndaelManaged.BlockSize = 256;
- rijndaelManaged.Mode = CipherMode.ECB;
- rijndaelManaged.Padding = PaddingMode.Zeros;
- rijndaelManaged.IV = Encoding.ASCII.GetBytes("2017+-04+-2017+T+12:12:230000000");
- rijndaelManaged.Key = rfc2898DeriveBytes.GetBytes(checked((int)Math.Round((double)rijndaelManaged.KeySize / 8.0)));
- ICryptoTransform transform = rijndaelManaged.CreateEncryptor(rijndaelManaged.Key, rijndaelManaged.IV);
- MemoryStream memoryStream = new MemoryStream();
- CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write);
- StreamWriter streamWriter = new StreamWriter(cryptoStream);
- streamWriter.AutoFlush = true;
- streamWriter.Write(plainText);
- streamWriter.Flush();
- cryptoStream.FlushFinalBlock();
- string result = Convert.ToBase64String(memoryStream.ToArray(), Base64FormattingOptions.None);
- if (rijndaelManaged != null)
- {
- rijndaelManaged.Clear();
- }
- return result;
- }
- // Token: 0x0600003F RID: 63 RVA: 0x00034D18 File Offset: 0x00033118
- private static string DecryptStringFromBytes(byte[] cipherText, byte[] key)
- {
- if (cipherText == null || cipherText.Length <= 0)
- {
- throw new ArgumentNullException("cipherText");
- }
- if (key == null || key.Length <= 0)
- {
- throw new ArgumentNullException("key");
- }
- RijndaelManaged rijndaelManaged = new RijndaelManaged();
- rijndaelManaged.BlockSize = 256;
- rijndaelManaged.Key = key;
- rijndaelManaged.Mode = CipherMode.ECB;
- rijndaelManaged.Padding = PaddingMode.Zeros;
- rijndaelManaged.IV = new byte[]
- {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- };
- ICryptoTransform transform = rijndaelManaged.CreateDecryptor(rijndaelManaged.Key, rijndaelManaged.IV);
- MemoryStream stream = new MemoryStream(cipherText);
- CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Read);
- StreamReader streamReader = new StreamReader(stream2);
- return streamReader.ReadToEnd();
- }
- // Token: 0x06000040 RID: 64 RVA: 0x00034E7C File Offset: 0x0003327C
- public string DecryptStringAES(string cipherText, string sharedSecret)
- {
- if (string.IsNullOrEmpty(cipherText))
- {
- throw new ArgumentNullException("cipherText");
- }
- if (string.IsNullOrEmpty(sharedSecret))
- {
- throw new ArgumentNullException("sharedSecret");
- }
- RijndaelManaged rijndaelManaged = null;
- string result = null;
- try
- {
- Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(sharedSecret, CodeVest._PrivateKey_new);
- byte[] buffer = Convert.FromBase64String(cipherText);
- MemoryStream stream = new MemoryStream(buffer);
- rijndaelManaged = new RijndaelManaged();
- rijndaelManaged.Key = rfc2898DeriveBytes.GetBytes(checked((int)Math.Round((double)rijndaelManaged.KeySize / 8.0)));
- rijndaelManaged.BlockSize = 256;
- rijndaelManaged.Mode = CipherMode.ECB;
- rijndaelManaged.Padding = PaddingMode.Zeros;
- rijndaelManaged.IV = Encoding.ASCII.GetBytes("2017+-04+-2017+T+12:12:230000000");
- ICryptoTransform transform = rijndaelManaged.CreateDecryptor(rijndaelManaged.Key, rijndaelManaged.IV);
- CryptoStream stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Read);
- StreamReader streamReader = new StreamReader(stream2);
- result = streamReader.ReadToEnd();
- }
- catch (Exception ex)
- {
- MessageBox.Show("Server error or encoding error: " + ex.Message);
- }
- finally
- {
- if (rijndaelManaged != null)
- {
- rijndaelManaged.Clear();
- }
- }
- return result;
- }
- // Token: 0x06000041 RID: 65 RVA: 0x00034FA8 File Offset: 0x000333A8
- private static byte[] ReadByteArray(Stream s)
- {
- byte[] array = new byte[0];
- if (s.Read(array, 0, array.Length) != array.Length)
- {
- throw new SystemException("Stream did not contain properly formatted byte array");
- }
- byte[] array2 = new byte[checked(BitConverter.ToInt32(array, 0) - 1 + 1)];
- if (s.Read(array2, 0, array2.Length) != array2.Length)
- {
- throw new SystemException("Did not read byte array properly");
- }
- return array2;
- }
- // Token: 0x0400000C RID: 12
- public static CodeVest cv = null;
- // Token: 0x0400000D RID: 13
- private CodeVest.RunHookHandler RunHookSuccessEvent;
- // Token: 0x0400000E RID: 14
- private CodeVest.RunHookHandler RunHookFailEvent;
- // Token: 0x0400000F RID: 15
- public DateTime valid_till;
- // Token: 0x04000010 RID: 16
- private static System.Timers.Timer _timer;
- // Token: 0x04000011 RID: 17
- private CodeVest.LicenseTypes _license_type;
- // Token: 0x04000012 RID: 18
- private Version _Version;
- // Token: 0x04000013 RID: 19
- private string _PreferredMetadataEndPoint;
- // Token: 0x04000014 RID: 20
- private string _AlternateMetadataEndPoint;
- // Token: 0x04000015 RID: 21
- private object _Authenticator;
- // Token: 0x04000016 RID: 22
- private string _k;
- // Token: 0x04000017 RID: 23
- private string _ProductDirectory;
- // Token: 0x04000018 RID: 24
- private string _ProductId;
- // Token: 0x04000019 RID: 25
- private string _PrivateKey;
- // Token: 0x0400001A RID: 26
- private string _Username;
- // Token: 0x0400001B RID: 27
- private string _Password;
- // Token: 0x0400001C RID: 28
- public string hardwareId;
- // Token: 0x0400001D RID: 29
- private static byte[] _PrivateKey_first;
- // Token: 0x0400001E RID: 30
- private static byte[] _PrivateKey_new;
- // Token: 0x0400001F RID: 31
- [AccessedThroughProperty("client")]
- private WebClient _client;
- // Token: 0x0200000A RID: 10
- // (Invoke) Token: 0x06000054 RID: 84
- public delegate void RunHookHandler(object sender, EventArgs e);
- // Token: 0x0200000B RID: 11
- public enum LicenseTypes : byte
- {
- // Token: 0x04000023 RID: 35
- Special,
- // Token: 0x04000024 RID: 36
- Bronze,
- // Token: 0x04000025 RID: 37
- Silver,
- // Token: 0x04000026 RID: 38
- Gold,
- // Token: 0x04000027 RID: 39
- Platinum,
- // Token: 0x04000028 RID: 40
- Diamond
- }
- // Token: 0x0200000C RID: 12
- public sealed class codeVestSettings
- {
- // Token: 0x17000012 RID: 18
- // (get) Token: 0x06000055 RID: 85 RVA: 0x00035004 File Offset: 0x00033404
- // (set) Token: 0x06000056 RID: 86 RVA: 0x00035014 File Offset: 0x00033414
- public bool CatchUnhandledExceptions
- {
- get
- {
- bool result = new bool();
- return result;
- }
- set
- {
- }
- }
- // Token: 0x17000013 RID: 19
- // (get) Token: 0x06000057 RID: 87 RVA: 0x00035018 File Offset: 0x00033418
- // (set) Token: 0x06000058 RID: 88 RVA: 0x00035028 File Offset: 0x00033428
- public bool DeferAutomaticUpdates
- {
- get
- {
- bool result = new bool();
- return result;
- }
- set
- {
- }
- }
- // Token: 0x17000014 RID: 20
- // (get) Token: 0x06000059 RID: 89 RVA: 0x0003502C File Offset: 0x0003342C
- // (set) Token: 0x0600005A RID: 90 RVA: 0x0003503C File Offset: 0x0003343C
- public bool SilentAuthentication
- {
- get
- {
- bool result = new bool();
- return result;
- }
- set
- {
- }
- }
- // Token: 0x17000015 RID: 21
- // (get) Token: 0x0600005B RID: 91 RVA: 0x00035040 File Offset: 0x00033440
- // (set) Token: 0x0600005C RID: 92 RVA: 0x00035050 File Offset: 0x00033450
- public bool VerifyRuntimeIntegrity
- {
- get
- {
- bool result = new bool();
- return result;
- }
- set
- {
- }
- }
- // Token: 0x0600005D RID: 93 RVA: 0x00035054 File Offset: 0x00033454
- public codeVestSettings()
- {
- this.CatchUnhandledExceptions = true;
- this.VerifyRuntimeIntegrity = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement