42 lines
1.3 KiB
VB.net
42 lines
1.3 KiB
VB.net
Public Class frmCryptTest
|
|
|
|
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
|
|
txtDecrypt.Text = "Hallo"
|
|
txtPassword.Text = "MeinPasswort"
|
|
End Sub
|
|
Private Sub Button1_Click(ByVal sender As System.Object, _
|
|
ByVal e As System.EventArgs) Handles Button1.Click
|
|
|
|
If txtDecrypt.TextLength = 0 Then
|
|
MsgBox("Es ist kein Text zum Verschlüsseln vorhanden.")
|
|
Exit Sub
|
|
End If
|
|
|
|
' Klasse cCrypt instanzieren zur Verschlüsselung
|
|
Dim cCrypt As cCrypt = New cCrypt
|
|
|
|
' Text aus txtDecrypt verschlüsseln mit 256 bit:
|
|
cCrypt.Encrypt(256, txtDecrypt.Text, txtPassword.Text)
|
|
|
|
' Verschlüsselten Text anzeigen:
|
|
txtEncrypt.Text = cCrypt.EncryptedString
|
|
|
|
txtDecrypt.Clear()
|
|
End Sub
|
|
|
|
Private Sub Button2_Click(ByVal sender As System.Object, _
|
|
ByVal e As System.EventArgs) Handles Button2.Click
|
|
|
|
' Klasse cCrypt instanzieren zur Entschlüsselung
|
|
Dim cCrypt As cCrypt = New cCrypt
|
|
|
|
' Text aus txtEncrypt entschlüsseln mit 256 bit:
|
|
cCrypt.Decrypt(256, txtEncrypt.Text, txtPassword.Text)
|
|
|
|
' Entschlüsselten Text anzeigen:
|
|
txtDecrypt.Text = cCrypt.DecryptedString
|
|
|
|
txtEncrypt.Clear()
|
|
End Sub
|
|
End Class |