using System.Security.Cryptography;
public static void Main()
string username = "aa75a18c-57f1-4e8e-a0ee-7e1f66fcdf78";
string password = "1ia7fzdj9v3zadf9";
string key = "41f95wy0iwy1mja5";
string input = "{\"CustomerID\":\"10KA92TN8\",\"RefNumber\":\"STB1098581924\"}";
string encryptedText = "iJRQ5ZpnY9p6gay1w9DbWoJnkV9kgss7hTvP3MAqmxmMpFaUsVqJ9GhQTr+cCHRhHg3V9+2nmiVS+RdQ4thLfZph43cucdM4mBIgtKeEtJ008nDlFjwd6n6GwVaGM+1puGguRWc8EdNONQ5CGDjMI/lpmOVPGyYcSkjTdrDVODOxtZcD51v6zXGCCBKOoePppLNlGfoVELoc6wDwblPlM/szet+LhEOd1wmp7NwaiB3w1soOKxAUo1fta8w49hgv";
Console.WriteLine(TrippleDESDecrypt(key, encryptedText));
public static string GetSignature(Request request)
var jsonString = JsonConvert.SerializeObject(request);
StringBuilder hash = new StringBuilder();
MD5CryptoServiceProvider md5provider = new MD5CryptoServiceProvider();
byte[] bytes = md5provider.ComputeHash(new UTF8Encoding().GetBytes(jsonString));
for (int i = 0; i < bytes.Length; i++)
hash.Append(bytes[i].ToString("x2"));
return hash.ToString().ToUpper();
public static string GetBasicAuthen(string username, string password)
return System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
public static string TrippleDESEncrypt(string key, string input)
TripleDESCryptoServiceProvider cipher = new TripleDESCryptoServiceProvider();
cipher.Key = Encoding.UTF8.GetBytes(key) ;
cipher.Mode = CipherMode.ECB;
cipher.Padding = PaddingMode.PKCS7;
byte[] data = Encoding.ASCII.GetBytes(input);
return Convert.ToBase64String(cipher.CreateEncryptor().TransformFinalBlock(data, 0, data.Length));
public static string TrippleDESDecrypt(string key, string input)
byte[] myDecryptArray = Convert.FromBase64String(input);
TripleDESCryptoServiceProvider cipher = new TripleDESCryptoServiceProvider();
cipher.Key = Encoding.UTF8.GetBytes(key) ;
cipher.Mode = CipherMode.ECB;
cipher.Padding = PaddingMode.PKCS7;
return UTF8Encoding.UTF8.GetString(cipher.CreateDecryptor().TransformFinalBlock(myDecryptArray, 0, myDecryptArray.Length));
public string Data {get;set;}
public string FunctionName {get;set;}
public string RequestDateTime {get;set;}
public string RequestID {get;set;}