Exemplo n.º 1
0
 public static string DESEncrypt(string value, Encoding encoding)
 {
     return EncryptHelper.DESEncrypt(value, encoding, EncryptHelper.cryptKey, EncryptHelper.cryptIV);
 }
Exemplo n.º 2
0
 public static string DESEncrypt(string value, Encoding encoding, byte[] cryptKey = null, byte[] cryptIV = null)
 {
     byte[] bytes = encoding.GetBytes(value);
     byte[] inArray = EncryptHelper.DESEncrypt(bytes, cryptKey, cryptIV);
     return System.Convert.ToBase64String(inArray);
 }
Exemplo n.º 3
0
 public static string DESEncrypt(string value)
 {
     return EncryptHelper.DESEncrypt(value, Encoding.Default);
 }
Exemplo n.º 4
0
 public static byte[] DESDecrypt(byte[] data, byte[] cryptKey = null, byte[] cryptIV = null)
 {
     System.Security.Cryptography.DESCryptoServiceProvider dESCryptoServiceProvider = EncryptHelper.CreateDESCrypto();
     System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
     System.Security.Cryptography.CryptoStream cryptoStream = new System.Security.Cryptography.CryptoStream(memoryStream, dESCryptoServiceProvider.CreateDecryptor(cryptKey, cryptIV), System.Security.Cryptography.CryptoStreamMode.Write);
     cryptoStream.Write(data, 0, data.Length);
     cryptoStream.FlushFinalBlock();
     return memoryStream.ToArray();
 }
Exemplo n.º 5
0
 public static string DESDecrypt(string value, Encoding encoding, byte[] cryptKey, byte[] cryptIV)
 {
     byte[] data = System.Convert.FromBase64String(value);
     byte[] bytes = EncryptHelper.DESDecrypt(data, cryptKey, cryptIV);
     return encoding.GetString(bytes);
 }
Exemplo n.º 6
0
 public static string Base64Encode(string value)
 {
     return EncryptHelper.Base64Encode(value, System.Text.Encoding.Default);
 }
Exemplo n.º 7
0
 public static string CreateToken(string s1, string s2, string s3)
 {
     return(EncryptHelper.Md5(string.Concat(s1, s2, s3), 32, System.Text.Encoding.UTF8));
 }