473,811 Members | 2,240 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Security in windows forms apps

I have tried multiple methods of encrypting the connection string. Everyone
has made it sound easy.

I have encrypted the connection string in the app.config file, code behind,
etc.

Basically try this test.

Create a new app and just add a connection string. Add whatever encryption
that you would like to use. Build the app. Go to the app's bin directory and
rename the exe to .txt. So it will now be app.txt. Open up in notepad, go
to the bottom of the file. You will see your connection string in text all
nice an pretty.

Not secure. Same thing works in vb6.
Oct 10 '06 #1
4 3341
The quick solution to this problem is use a Obfusicator. Visual Studio 2003,
2005 come with a lite version.

Now I am going to spend a little time in regards to cracking the Obfuscator
and see if it will work.

--
"T3Logic" wrote:
I have tried multiple methods of encrypting the connection string. Everyone
has made it sound easy.

I have encrypted the connection string in the app.config file, code behind,
etc.

Basically try this test.

Create a new app and just add a connection string. Add whatever encryption
that you would like to use. Build the app. Go to the app's bin directory and
rename the exe to .txt. So it will now be app.txt. Open up in notepad, go
to the bottom of the file. You will see your connection string in text all
nice an pretty.

Not secure. Same thing works in vb6.
Oct 10 '06 #2
T3Logic,

You need to ensure that your not setting these values at design time. If
you have set the connection string at design time in the IDE then those
strings will be in the compiled application.
"T3Logic" <T3*****@discus sions.microsoft .comwrote in message
news:99******** *************** ***********@mic rosoft.com...
The quick solution to this problem is use a Obfusicator. Visual Studio
2003,
2005 come with a lite version.

Now I am going to spend a little time in regards to cracking the
Obfuscator
and see if it will work.

--
"T3Logic" wrote:
>I have tried multiple methods of encrypting the connection string.
Everyone
has made it sound easy.

I have encrypted the connection string in the app.config file, code
behind,
etc.

Basically try this test.

Create a new app and just add a connection string. Add whatever
encryption
that you would like to use. Build the app. Go to the app's bin directory
and
rename the exe to .txt. So it will now be app.txt. Open up in notepad,
go
to the bottom of the file. You will see your connection string in text
all
nice an pretty.

Not secure. Same thing works in vb6.

Oct 10 '06 #3
I did it both ways,
Design and programically.

From the looks of things if you dont use an obfusicator all litteral strings
are printed out in the exe.

SqlConnection con = new
SqlConnection(P roperties.Setti ngs.Default.MyC onnectionString .ToString());

This is how I did it programmically in the app:

SqlConnection con = new SqlConnection(" Data Source=MySQLDat abase;Initial
Catalog=TestDat abase;Persist Security Info=True;User
ID='myTestUser' ;Password=u2IC( ~8xE%>82qP7J#") ;

It printed out my sql connection....

For all I know I might have a setting turned off or not on in vs2005 I will
keep checking but fusicator seems the only thing that encrypts it.

On another note since this is an internal app I am not too worried about it
but if I ever decide to distribute a database app its going to use web
services....

"Noah Sham" wrote:
T3Logic,

You need to ensure that your not setting these values at design time. If
you have set the connection string at design time in the IDE then those
strings will be in the compiled application.
"T3Logic" <T3*****@discus sions.microsoft .comwrote in message
news:99******** *************** ***********@mic rosoft.com...
The quick solution to this problem is use a Obfusicator. Visual Studio
2003,
2005 come with a lite version.

Now I am going to spend a little time in regards to cracking the
Obfuscator
and see if it will work.

--
"T3Logic" wrote:
I have tried multiple methods of encrypting the connection string.
Everyone
has made it sound easy.

I have encrypted the connection string in the app.config file, code
behind,
etc.

Basically try this test.

Create a new app and just add a connection string. Add whatever
encryption
that you would like to use. Build the app. Go to the app's bin directory
and
rename the exe to .txt. So it will now be app.txt. Open up in notepad,
go
to the bottom of the file. You will see your connection string in text
all
nice an pretty.

Not secure. Same thing works in vb6.


Oct 10 '06 #4
On Tue, 10 Oct 2006 06:30:02 -0700, T3Logic
<T3*****@discus sions.microsoft .comwrote:
>I have tried multiple methods of encrypting the connection string. Everyone
has made it sound easy.

I have encrypted the connection string in the app.config file, code behind,
etc.

Basically try this test.

Create a new app and just add a connection string. Add whatever encryption
that you would like to use. Build the app. Go to the app's bin directory and
rename the exe to .txt. So it will now be app.txt. Open up in notepad, go
to the bottom of the file. You will see your connection string in text all
nice an pretty.

Not secure. Same thing works in vb6.
One answer is not to put the plaintext of your connection string into
your source, put an encrypted version into the source, and decrypt it
when you need it at runtime. Because you are only decrypting at
runtime, the decrypted text will not appear in the .exe file.

e.g:

string cypherPasssword = "not this";

string Decrypt(string cyphertext) {
byte[] key = {0x1D, 0x1E, 0x01, 0x49,
0x06, 0x1A, 0x0C, 0x1E };
byte[] bytes = Encoding.UTF8.G etBytes(cyphert ext);
for (int i = 0; i < cyphertext.Leng th; ++i) {
bytes[i] ^= key[i];
}
return Encoding.UTF8.G etString(bytes) ;
}

void Main() {
Console.Writeli ne("The secret password is: {0}",
Decrypt(cypherP assword));
}

Using an XOR encryption, as I have done here, allows you to pick a
deceptive string for the cyphertext if you want to.

Obfuscation will not hide the sourcecode key from anything more than a
casual examination. Depending on how secure you want it to be you
could put the decryption key in a database or in a separate file so it
does not form part of the source code at all. How much security you
want depends on if you are trying to hide things from Aunt Edna or
from Nasty Megacorp Inc, with lots of money and people to throw at it.

rossum
Oct 11 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

116
7596
by: Mike MacSween | last post by:
S**t for brains strikes again! Why did I do that? When I met the clients and at some point they vaguely asked whether eventually would it be possible to have some people who could read the data and some who couldn't but that it wasn't important right now. And I said, 'sure, we can do that later'. So now I've developed an app without any thought to security and am trying to apply it afterwards. Doh!, doh! and triple doh!
8
1658
by: Bf | last post by:
I was creating test projects using c# and was surprised that there seems to be only a form based windows applications available. Is it safe to assume that classic window applications that utilize a parent window with child windows can only be done in c++ and mfc and there's nothing else in .net that is meant to be used like that? It seems to be that c# should be used for either form based windows apps, console apps, and web apps (also...
2
3182
by: Phil Townsend | last post by:
I have been attempting to persuade our systems admin staff to allow us to use integrated security by adding the aspnet user to SQL Server. Currently we are forced to use a connection string that passes user names/passwords on the conncetion string itself. i know that using integrated security is a more secure way of doing this. However, our systems admin is saying that this is not poosible on our current configuration of Win2000 and IIS...
1
5266
by: Adrian | last post by:
hi I'm attempting to build an app then sends a request to a URL and reads the response it works fine on my test site but when I connect to a real system I get the text below, I guess its responding to a request from the remote end if so how do I either tell it to ignore the request and just send the url or set what its looking for?
3
4839
by: dcbud | last post by:
I'm hoping to get a response from developers with experience in both developing applications for Windows and the Web using VS.NET2005. I'm looking for input as to why we would want to develop a web application versus a Windows Application. I know all the standard reasons, Availability, Easier Deployment (although that is really not an issue any more with Windows Apps in .NET), etc, I'm looking for more better reasons why we should develop...
1
1922
by: Jeremy S. | last post by:
..NET's code Access Security enables administrators to restrict the types of things that a .NET application can do on a local computer. For example, a ..NET Windows Forms application can be prevented from writing to the Registry or writing a file to the local disk. My question: Is this feature unique to .NET? Or is it just as easy for enterprise network administrators to prevent COM applications from writing to the Registry and doing...
0
1433
by: Lambuz | last post by:
Hi all, I've got this problem. I've to implemente a solution like the example in http://support.microsoft.com/default.aspx?scid=kb;EN-US;313891, but I can't configure correctly the example. Every time I click on the textBox a System.Security.SecurityException is raised.
10
10057
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to believe that this has to do with unreleased form component events or event handlers. I'm comparatively new to .net and windows forms, in the sense that though I've been using them for over 2 years now, it's been rather sporadic. I work with...
0
2039
by: gxl034000 | last post by:
Hi, I have been trying to use a .net Forms control in my webpage to open up an application(notepad) on the client. The control works fine when embedded in a windows form, but I keep getting a security exception when trying to run it from my webpage on my intranet. I have tried playing with the Code Access Security settings, but I can't get it to work. What do you think? Thanks,
2
2422
by: Budhi Saputra Prasetya | last post by:
Hi, I managed to create a Windows Form Control and put it on my ASP .NET page. I have done the suggestion that is provided by modifying the security settings. From the stack trace, I would assume that the code throws exception when it is trying to retrieve the processes list that has certain name. Below is the code that I use to retrieve the processes. Process processes = Process.GetProcessesByName("xxxx");
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7673
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.