Search results “Convert cryptostream to byte array in java”
How to Encode and Decode with Base64 and cryptor in C#
https://www.facebook.com/DotNetChannel/ https://twitter.com/DotNetChannel/ https://www.youtube.com/Dotnetchannel/ https://www.instagram.com/DotNetChannel/ How to Encode and Decode with Base64 and cryptor in C# // Base64 public static string Base64Encode(string plainText) { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); return System.Convert.ToBase64String(plainTextBytes); } public static string Base64Decode(string base64EncodedData) { var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData); return System.Text.Encoding.UTF8.GetString(base64EncodedBytes); } // cryptor byte[] source = Encoding.Unicode.GetBytes(String str); TripleDESCryptoServiceProvider des = new TripleDESCryptoServiceProvider(); MemoryStream ms = new MemoryStream() ; CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(DesKey, DesIV), CryptoStreamMode.Write); cs.Write(source, 0, source.Length); cs.Close(); byte[] destination = ms.ToArray(); ms.Close(); textBox2.Text = Encoding.Unicode.GetString(destination); textBox3.Text = ""; TripleDESCryptoServiceProvider TDES = new TripleDESCryptoServiceProvider(); DesKey = TDES.Key; DesIV = TDES.IV; Thanks you!
Views: 514 DotNet Channel