473,378 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 3323
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*****@discussions.microsoft.comwrote in message
news:99**********************************@microsof t.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(Properties.Settings.Default.MyConnec tionString.ToString());

This is how I did it programmically in the app:

SqlConnection con = new SqlConnection("Data Source=MySQLDatabase;Initial
Catalog=TestDatabase;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*****@discussions.microsoft.comwrote in message
news:99**********************************@microsof t.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*****@discussions.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.GetBytes(cyphertext);
for (int i = 0; i < cyphertext.Length; ++i) {
bytes[i] ^= key[i];
}
return Encoding.UTF8.GetString(bytes);
}

void Main() {
Console.Writeline("The secret password is: {0}",
Decrypt(cypherPassword));
}

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
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...
8
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...
2
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...
1
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...
3
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...
1
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...
0
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. ...
10
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...
0
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...
2
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.