SHARE
TWEET

Untitled

a guest Nov 12th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static string DecodeWithAES(byte[] ticket, byte[] aes)
  2.         {
  3.             var iv = aes.Take(16).ToArray();
  4.  
  5.             string text;
  6.  
  7.             var aesAlg = NewRijndaelManaged(aes);
  8.             var decryptor = aesAlg.CreateDecryptor(aes, iv);
  9.  
  10.             using (var msDecrypt = new MemoryStream(ticket))
  11.             {
  12.                 using (var csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
  13.                 {
  14.                     using (var srDecrypt = new StreamReader(csDecrypt))
  15.                     {
  16.                         text = srDecrypt.ReadToEnd();
  17.                     }
  18.                 }
  19.             }
  20.             return text;
  21.         }
  22.         private static Aes NewRijndaelManaged(byte[] key)
  23.         {
  24.  
  25.             var aesAlg = Aes.Create();
  26.             aesAlg.Key = key;
  27.             aesAlg.IV = key.Take(16).ToArray();
  28.  
  29.             return aesAlg;
  30.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top