Dimitar Nestorov
Dimitar Nestorov

Reputation: 2604

How to make an application trusted?

Or in another way of understanding how to bypass the firewall of Windows in VB.NET?

Upvotes: 1

Views: 3964

Answers (1)

Bradley Uffner
Bradley Uffner

Reputation: 16991

I found this guide to accessing the Windows Firewall API via managed code. This will allow you to open and close ports automatically from withing your program, is that what you are looking for?

http://blogs.msdn.com/b/securitytools/archive/2009/08/21/automating-windows-firewall-settings-with-c.aspx

It specifically gives this example to adding a program to the trusted programs list.

INetFwAuthorizedApplications applications; 
INetFwAuthorizedApplication application;
application.Name = “Internet Explorer”;/*set the name of the application */
application.ProcessImageFileName = "C:\\Program Files\\Internet Explorer\\iexplore.exe" /* set this property to the location of the executable file of the application*/
application.Enabled =  true; //enable it
/*now add this application to AuthorizedApplications collection */
Type NetFwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr", false); 
INetFwMgr mgr = (INetFwMgr)Activator.CreateInstance(NetFwMgrType); 
applications = (INetFwAuthorizedApplications)mgr.LocalPolicy.CurrentProfile.AuthorizedApplications;
applications.Add(application);

Edit Based on Comments Based on comments it looks like what you really want to look at is Code Signing. http://en.wikipedia.org/wiki/Code_signing

This usually means buying a certificate (kind of like SSL) and applying it to your compiled application. This is not the same as .NET's signing that is part of giving an assembly a strong name, it's something different.

Upvotes: 1

Related Questions