public string Decrypt(String encryptedString) { try { tripleDes.Key = CriptografiaDAO.MD5Hash("U&4v)G$KL$Lf55"); tripleDes.Mode = CipherMode.ECB; byte[] buffer = Convert.FromBase64String(encryptedString); return(ASCIIEncoding.ASCII.GetString(tripleDes.CreateDecryptor().TransformFinalBlock(buffer, 0, buffer.Length))); } catch (Exception) { return(string.Empty); } }
public string EncryptInterna(String stringToEncrypt) { try { tripleDes.Key = CriptografiaDAO.MD5Hash("U&4v)G$KL$Lf55"); tripleDes.Mode = CipherMode.ECB; byte[] buffer = ASCIIEncoding.ASCII.GetBytes(stringToEncrypt); KeyChave = null; return(Convert.ToBase64String(tripleDes.CreateEncryptor().TransformFinalBlock(buffer, 0, buffer.Length))); } catch (Exception ex) { throw new Exception(ex.Message); } }