First off I am SO tired it's not even funny!
I am trying to make sure my encrypt and decrypt functions are working
properly.
I was testing them out when I accidentally lost my work.
I have put everything back together and I'm exhausted and I can't figure
out where I am going wrong with this.
Basically I'm taking a value from textbox1 and decrypting it and showing that
value in textbox 2. Simple right?
Here is the code for the decrypt button, how would I then call for the value
in textbox 2?
Here is the decrypt function:Code:Dim strArray As String() = Me.Decrypt(TextBox1.Text).Split(New Char() {"|"c}) TextBox2 = ?
-ChrisCode:Public Function Decrypt(ByVal ciphertext As String) As String Dim str2 As String Dim str3 As String = DateTime.UtcNow.Hour.ToString.PadLeft(2, "0"c) Dim bytes As Byte() = Encoding.UTF8.GetBytes(("GpWhFbntD" & str3.ToString & "Qpop38D@dUnrF")) Dim rgbIV As Byte() = Encoding.UTF8.GetBytes("wFyEQPdN") Dim provider As New TripleDESCryptoServiceProvider With { _ .BlockSize = &H40, _ .Padding = PaddingMode.Zeros _ } Using stream As MemoryStream = New MemoryStream Using stream2 As CryptoStream = New CryptoStream(stream, provider.CreateDecryptor(bytes, rgbIV), CryptoStreamMode.Write) Dim buffer As Byte() = Convert.FromBase64String(ciphertext) stream2.Write(buffer, 0, buffer.Length) stream2.FlushFinalBlock() str2 = Encoding.UTF8.GetString(stream.ToArray) End Using End Using Return str2 End Function





Reply With Quote