lVwQGb3PcjN0n8o5jfMtkG7yQf9KusW+ehcwfqeNcUmh9xyDZjWLVbbYnY+RrbiUzvfbpRbhqfxDiIqr6i2EP05Bwy5oTFXv3kFdAkcXRf0o3IplTMiQJGOzK5Id/TKmxDvDPmfo9WXPjMFBqB+DPjaI0k2ygqawOIIJTurLZgQGL/XYR6ok+/qCK379qVuXBdiA+N4PC4U=
Imports System.Security.Cryptography Public Class Form1 Private WithEvents WebBrowser As New WebBrowser With {.Dock = DockStyle.Fill} Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Controls.Add(WebBrowser) Me.WebBrowser.Navigate(My.Computer.FileSystem.SpecialDirectories.Desktop & "\HomePage.html") End Sub Private Sub WebBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser.DocumentCompleted If Me.WebBrowser.Url.ToString <> "about:blank" Then Dim cipherText As String = Me.WebBrowser.DocumentText Dim password As String = "VB2010" Dim wrapper As New Simple3Des(password) Dim plainText As String = wrapper.DecryptData(cipherText) Me.WebBrowser.DocumentText = plainText End If End Sub End Class Public NotInheritable Class Simple3Des Private TripleDes As New TripleDESCryptoServiceProvider Private Function TruncateHash(ByVal key As String, ByVal length As Integer) As Byte() Dim sha1 As New SHA1CryptoServiceProvider Dim keyBytes() As Byte = System.Text.Encoding.Unicode.GetBytes(key) Dim hash() As Byte = sha1.ComputeHash(keyBytes) ReDim Preserve hash(length - 1) Return hash End Function Sub New(ByVal key As String) TripleDes.Key = TruncateHash(key, TripleDes.KeySize \ 8) TripleDes.IV = TruncateHash("", TripleDes.BlockSize \ 8) End Sub Public Function EncryptData(ByVal plaintext As String) As String Dim plaintextBytes() As Byte = System.Text.Encoding.Unicode.GetBytes(plaintext) Dim ms As New System.IO.MemoryStream Dim encStream As New CryptoStream(ms, TripleDes.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write) encStream.Write(plaintextBytes, 0, plaintextBytes.Length) encStream.FlushFinalBlock() Return Convert.ToBase64String(ms.ToArray) End Function Public Function DecryptData(ByVal encryptedtext As String) As String Dim encryptedBytes() As Byte = Convert.FromBase64String(encryptedtext) Dim ms As New System.IO.MemoryStream Dim decStream As New CryptoStream(ms, TripleDes.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write) decStream.Write(encryptedBytes, 0, encryptedBytes.Length) decStream.FlushFinalBlock() Return System.Text.Encoding.Unicode.GetString(ms.ToArray) End Function End Class