Method: Cipher::EncryptStringBinary
EncryptStringBinary(PlainText)
The string given in the
PlainText argument is encrypted, and the resulting cipher text is
returned as a raw binary value.
PlainText
The
PlainText argument is the string to be encrypted.
Example:
Private g_objKey As DGENCRYPTLib.Key
' . . .
Dim intFile As Integer
Dim strPWD As String
Dim strFileName As String
Dim strData As String
Dim CipherText() As Byte
Dim objCipher As DGENCRYPTLib.Cipher
strPWD = App.Path & "\"
strFileName = strPWD & Text1.Text & ".txt"
intFile = FreeFile
Open strFileName For Binary As #intFile
strData = Space(LOF(intFile))
Get intFile, , strData
Close intFile
Set objCipher = New DGENCRYPTLib.Cipher
objCipher.SetKey g_objKey
CipherText = objCipher.EncryptStringBinary(strData)
strFileName = strPWD & Text1.Text & ".dat"
intFile = FreeFile
Open strFileName For Binary As #intFile
Put intFile, , CipherText
Close intFile
MsgBox "the data has been encrypted"
Set objCipher = Nothing