📄 frmmain.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Encrypt Data"
ClientHeight = 3780
ClientLeft = 45
ClientTop = 435
ClientWidth = 6015
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3780
ScaleWidth = 6015
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdDecrypt
Caption = "Decrypt"
Height = 375
Left = 3240
TabIndex = 4
Top = 3240
Width = 1215
End
Begin VB.CommandButton cmdEncrypt
Caption = "Encrypt"
Height = 375
Left = 4680
TabIndex = 3
Top = 3240
Width = 1215
End
Begin VB.TextBox txtPassword
Height = 285
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 2
Top = 3240
Width = 1215
End
Begin VB.TextBox txtMessage
Height = 3015
Left = 120
MultiLine = -1 'True
TabIndex = 0
Text = "frmMain.frx":0000
Top = 120
Width = 5655
End
Begin VB.Label Label1
Caption = "Password:"
Height = 255
Left = 240
TabIndex = 1
Top = 3240
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdDecrypt_Click()
'Make sure we have entered all the information:
If txtMessage.Text <> "" And txtPassword <> "" Then
'This is our encryption object
Dim DecryptData As New EncryptedData
'We send the object the password to use to unlock the encryption:
DecryptData.SetSecret (txtPassword.Text)
'Send the ciphertext to the object and tell it to decrypt it.
DecryptData.Decrypt (txtMessage.Text)
'Get our plaintext from the object
txtMessage.Text = DecryptData.Content
End If
End Sub
Private Sub cmdEncrypt_Click()
'Make sure we have entered all the information:
If txtMessage.Text <> "" And txtPassword <> "" Then
'This is our encryption object
Dim encryptdata As New EncryptedData
'Before we can start encrypting, we got to define the
'algorithm, keysize, and the password (Used to generate key)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Algorithm to use: AES (Advanced Encryption Standard)
encryptdata.Algorithm = CAPICOM_ENCRYPTION_ALGORITHM_AES
'You could also use:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'encryptdata.Algorithm =CAPICOM_ENCRYPTION_ALGORITHM_3DES
'encryptdata.Algorithm = CAPICOM_ENCRYPTION_ALGORITHM_DES
'encryptdata.algorithm = CAPICOM_ENCRYPTION_ALGORITHM_RC2
'encryptdata.Algorithm = CAPICOM_ENCRYPTION_ALGORITHM_RC4
'Next we set our key size, which is a no brainer to put to max.
encryptdata.Algorithm.KeyLength = CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM
'Next we set our secret password to unlock the message.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''
encryptdata.SetSecret (txtPassword.Text)
'We send the object the plaintext scramble:
encryptdata.Content = txtMessage.Text
'Return message as base64
txtMessage.Text = encryptdata.Encrypt(CAPICOM_ENCODE_BASE64)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -