Reputation: 1733
I'm actually trying to obfuscate a ClickOnce application.
My Obfuscator is ConfuserEx. Il followed these steps :
- Click the Publish Wizard..\Publish Now button on your project properties. This will automatically build your project on Debug/Release folder. I use it since it also creates the files used in ClickOnce. We will use those files later.
- Open Confuser and Drag-Drop files On the Debug/Release folder that you want confuser to work on.
- This will create a Confused folder (using the default output directory settings) with the obfuscated assemblies.
- Copy all dependencies/files (if any) required by your project to run to the just create "Confused" folder.
- You project should now work with the obfuscated assemblies. I ran the program just to make sure. :D
- Copy the .manifest file from your Debug/Release folder to the Confused folder and Edit it using MageUI.
- On the "Files" section of MageUI, locate the Confused folder(may already be selected) and check the option to put .deploy on your files and click "Populate".
- Your project files would be renamed to *.deploy
- Save the .manifest file and sign it with the *TemporaryKey.pfx created when you published your project (This should be on your project folder).
- Copy the .application file from your Debug/Release folder to the Confused folder and Edit it using MageUI.
- On the "Application Reference" section of MageUI Click "Select Manifest.." and select the .manifest file you saved on step 6.
- Save the .application file and sign it with the *TemporaryKey.pfx.
- Lastly, this maybe optional, just copy the setup.exe and the publish.html files on publish folder to the Confused folder.
Regarding this topic :
https://confuser.codeplex.com/discussions/428378
Unfortunately, I get the following error when I try to install the ClickOnce app afterwards :
Cannot handle redirect from HTTP/HTTPS protocols to other dissimilar ones.
The stacktrace is as following :
System.Net.HttpWebRequest.GetResponse() System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
The URL I'm trying to download is in https, is that the problem ? Should I put all in http ?
Upvotes: 2
Views: 6248
Reputation: 81
Following Thordax instruction @ step 3,
Once your code is sufficiently obfuscated (you can check your obfuscation with tools like ILSpy), sign your executable and/or your DLL with a code signing certificate, or with a temporary PFX (usually created when you first published your clickonce application). I'm currently using signtool.exe to do so.
you need to use the sign tool like this: cd C:\Program Files (x86)\Microsoft SDKs\ClickOnce\SignTool
Then sign the exe like so
signtool.exe sign /td sha256 /fd sha256 /f pathtoyourcert.pfx /p password pathtoyourconfusedexe
Upvotes: 1
Reputation: 18031
This is pretty old now, but I would like to mention there is an extension in Visual Studio to use ConfuserEx, and it works with ClickOnce:
ConfuserEx Tools for Visual Studio
ConfuserEx for Visual Studio integrates the free and open source ConfuserEx protector into Visual Studio for easy automatic obfuscation of release builds and ClickOnce applications.
Upvotes: 1
Reputation: 1733
Once your code is sufficiently obfuscated (you can check your obfuscation with tools like ILSpy), sign your executable and/or your DLL with a code signing certificate, or with a temporary PFX (usually created when you first published your clickonce application). I'm currently using signtool.exe to do so.
Still in your "Confused" folder, rename the obfuscated and signed files from .exe to .exe.deploy and from .dll to .dll.deploy
Go to your published folder (in my case, it's a network folder, like this :
\\network_disk\ClickOnceApp
\\network_disk\ClickOnceApp\Application Files\ClickOnceApp_x_x_x_x
\\network_disk\ClickOnceApp\Application Files\ClickOnceApp_1_0_0_42\ClickOnceApp.exe.manifest
FYI, MageUI can be found here :
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mageui.exe
Click on "Save" to sign the manifest (use Code Signing certificate or your temporary PFX as before), it will automatically see the change of the .exe.deploy and .dll.deploy files and recalculate the right file hash.
\\network_disk\ClickOnceApp\Application Files\ClickOnceApp_1_0_0_42\ClickOnceApp.application
On the Application References menu, click 'Select a manifest' and choose the recently modified manifest. Sign your .application file by saving it (as in step 7)
\\network_disk\ClickOnceApp\ClickOnceApp.application
Now your ClickOnce application contains obfuscated code, and can be downloaded using ClickOnce process.
Notes :
Upvotes: 7