Re: Encrypt & Compression a file failed - WeOnlyDo Discussion board

Re: Encrypt & Compression a file failed (General questions)

by clement su, Thursday, January 12, 2012, 11:16 (4486 days ago) @ woddrazen

Hi
program code as follow:

Private Sub cmdDecrypt_Click()

Dim srcfile As New FileBlob
Dim destfile As New FileBlob

Set oCrypt = New wodCryptCom
If Check1.Value = 1 Then
oCrypt.Type = TripleDES
oCrypt.InitVector = 123
oCrypt.SecretKey = Now
Else
oCrypt.Type = None
End If


If Check1.Value = 1 Then
oCrypt.Optimized = True
Else
oCrypt.Optimized = False
End If

oCrypt.Compression = GZipCompression

srcfile.FileName = txtSourceDec.Text
destfile.FileName = txtDestDec.Text

oCrypt.Decrypt srcfile, destfile

Set srcfile = Nothing
Set destfile = Nothing

MsgBox Decryption Complete
End Sub


Private Sub cmdEncrypt_Click()
Dim srcfile As New FileBlob
Dim destfile As New FileBlob
Dim a As IStream

Set oCrypt = New wodCryptCom

If Check1.Value = 1 Then
oCrypt.Type = TripleDES
oCrypt.InitVector = 123
oCrypt.SecretKey = Now
Else
oCrypt.Type = None
End If

oCrypt.Compression = GZipCompression

If Check1.Value = 1 Then
oCrypt.Optimized = True
Else
oCrypt.Optimized = False
End If



srcfile.FileName = txtSource.Text
destfile.FileName = txtDest.Text

oCrypt.Encrypt srcfile, destfile

MsgBox Encyption Complete

End Sub


Complete thread: