Encrypts a file with a password into a SFX (self extracting) executable file.
The generated executable file requires .NET Framework 2.0 or upper.
Namespace: DidiSoft.SfxThe generated executable file requires .NET Framework 2.0 or upper.
Assembly: DidiSoft.Pgp (in DidiSoft.Pgp.dll) Version: 1.7.3.35547
Syntax
| C# |
|---|
public void EnryptFileToExe( FileInfo inputFile, string encryptionPassword, SfxOptions options, FileInfo outputExeFile ) |
| Visual Basic |
|---|
Public Sub EnryptFileToExe ( _ inputFile As FileInfo, _ encryptionPassword As String, _ options As SfxOptions, _ outputExeFile As FileInfo _ ) |
| Visual C++ |
|---|
public: void EnryptFileToExe( FileInfo^ inputFile, String^ encryptionPassword, SfxOptions^ options, FileInfo^ outputExeFile ) |
Parameters
- inputFile
- Type: System.IO..::..FileInfo
input file to be encrypted
- encryptionPassword
- Type: System..::..String
encryption/decryption password
- options
- Type: DidiSoft.Sfx..::..SfxOptions
Options for customization of the generated executable file
- outputExeFile
- Type: System.IO..::..FileInfo
output executable file location
Remarks
The generated SFX (self extracting) executable file upon execution shows a dialog box
that requires the same password used for encryption in order to extract the encrypted file.
If the output exe file already exists, it will be overwritten.
If the output exe file already exists, it will be overwritten.
Examples
This example shows how to create a password protected self extracting (SFX) executable file
with default options.
CopyC#
CopyVB.NET
using System; using System.IO; using DidiSoft.Sfx; class SfxFromFile { static void Main(string[] args) { // customization options for the result EXE file SfxOptions options = new SfxOptions(); options.Copyright = "Copyright (c) My Company Name"; options.ProductName = "My SFX Demo"; options.Description = "My SFX Demo description"; // decryption password string password = "pass123"; // create the self extracting file SfxCreator sfx = new SfxCreator(); sfx.TargetDotNetFramework = SfxCreator.DotNetFramework.SELECT_FROM_EXECUTING_PROGRAM; sfx.EnryptFileToExe(new FileInfo(@"DataFiles\test.txt"), password, new FileInfo("sfx_demo.exe")); } }
Imports System Imports DidiSoft.Sfx Module SfxExeFromFileDemo Sub Main() ' customization options for the result EXE file Dim options As New SfxOptions() options.Copyright = "Copyright (c) My Company Name" options.ProductName = "My SFX Demo" options.Description = "My SFX Demo description" ' decryption password Dim password As String = "pass123" ' create the self extracting file Dim sfx As New SfxCreator() sfx.TargetDotNetFramework = SfxCreator.DotNetFramework.SELECT_FROM_EXECUTING_PROGRAM sfx.EnryptFileToExe("DataFiles\test1.txt", password, "sfx_demo.exe") End Sub End Module