Encrypt-file - WeOnlyDo Software example code



All

wodCrypt (12)
wodSSH (10)
wodSFTP (23)
wodSSHServer (1)
wodSSHTunnel (11)
wodSSHpackage
wodSFTPdll

wodSSH.NET (10)
wodSFTP.NET (24)
wodFtpDLX.NET (22)
wodWebServer.NET (10)

wodAppUpdate (13)
wodHttpDLX (8)
wodFtpDLX (22)
wodTelnetDLX
wodFTPServer (3)
wodWebServer (10)
wodVPN
wodXMPP (13)
All ** [Visual Basic] ** [C#] ** [VB.NET] **

Encrypt file
VB code
'Declare wodCrypt ActiveX component.
Dim wodCrypt1 As wodCryptCom
Set wodCrypt1 = New wodCryptCom

'Declare wodCrypt file blob.
'FileBlob is needed when we want to work with files in wodCrypt.
Dim srcfile As New FileBlob
Dim destfile As New FileBlob

'Load some file for encryption.
srcfile.FileName = "c:\somefile.exe"
'Specify where encrypted file will be saved.
destfile.FileName = "c:\somefile_enc.exe"

'We will use Optimized mode for better performance.
wodCrypt1.Optimized = True
'Using Type we can decide which type of encryption we want to use.
wodCrypt1.Type = AES256
'Set some secret password for encryption.
wodCrypt1.SecretKey = "WeOnlyDo!"

'Finally we will encrypt file using Encrypt Method.
wodCrypt1.Encrypt srcfile, destfile
VB.NET code
'Declare wodCrypt ActiveX component.
Dim wodCrypt1 As New WODCRYPTCOMLib.wodCryptCom

'Declare wodCrypt file blob.
'FileBlob is needed when we want to work with files in wodCrypt.
Dim srcfile As New WODCRYPTCOMLib.FileBlob
Dim destfile As New WODCRYPTCOMLib.FileBlob

'Load some file for encryption.
srcfile.Filename = "c:\somefile.exe"
'Specify where encrypted file will be saved.
destfile.Filename = "c:\somefile_enc.exe"

'We will use Optimized mode for better performance.
wodCrypt1.Optimized = True
'Using Type we can decide which type of encryption we want to use.
wodCrypt1.type = WODCRYPTCOMLib.CryptoTypes.AES256
'Set some secret password for encryption.
wodCrypt1.SecretKey = "WeOnlyDo!"

'Finally we will encrypt file using Encrypt Method.
wodCrypt1.Encrypt(srcfile, destfile)
C# code
//Declare wodCrypt ActiveX component.
WODCRYPTCOMLib.wodCryptCom wodCrypt1 = new WODCRYPTCOMLib.wodCryptCom();

//Declare wodCrypt file blob.
//FileBlob is needed when we want to work with files in wodCrypt.
WODCRYPTCOMLib.FileBlob srcfile = new WODCRYPTCOMLib.FileBlob();
WODCRYPTCOMLib.FileBlob destfile = new WODCRYPTCOMLib.FileBlob();

//Load some file for encryption.
srcfile.Filename = "c:\\somefile.exe";
//Specify where encrypted file will be saved.
destfile.Filename = "c:\\somefile_enc.exe";

//We will use Optimized mode for better performance.
wodCrypt1.Optimized = true;
//Using Type we can decide which type of encryption we want to use.
wodCrypt1.type = WODCRYPTCOMLib.CryptoTypes.AES256;
//Set some secret password for encryption.
wodCrypt1.SecretKey = "WeOnlyDo!";

//Finally we will encrypt file using Encrypt Method.
wodCrypt1.Encrypt((WODCRYPTCOMLib.Blob)srcfile, (WODCRYPTCOMLib.Blob)destfile);