Re: Help encrypt conn string - no ASP, no server, can't protect keys, can't use Windows Authentication
- From: "Joe Kaplan \(MVP - ADSI\)" <joseph.e.kaplan@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 17 Jul 2006 15:45:17 -0500
That said, per machine DPAPI encryption of the connection string is probably
the way to go. That would allow all users on the machine to read the data
programmatically, while not leaving the data sitting out in plain text. You
would probably want to write a custom action for your installer that does
this.
Of course, the CA will have the plain text data, so then you need to figure
out how to hide the data in the CA. Additionally, a smart user will be able
to get the plain text data as your program can do it. Essentially, you are
only raising the bar.
Joe K.
--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"Dominick Baier" <dbaier@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:4580be6354f38c87806803f5559@xxxxxxxxxxxxxxxxxxxxx
Hi,
you are right, there is no way to accomplish this - at least not with a
mainstream operating system like Windows.
You will always hit the problem that if the application is able to decrypt
the data (running in the users context), the user is able too.
You can try to set up all kinds of obstacles and raise the bar by making
it harder to decrypt the data, but there is no bulletproof solution to
this.
dominick
I've seen several questions posted since October regarding the
encryption of connection strings, but none of them seem to address my
particular need.
I want to deploy a .NET 2.0 Windows Forms application that uses an MS
Access 2003 database. The database has been encoded and password
protected to prevent direct manipulation. The database is used to
store application-related data, and access is controlled by the
application, which reads information from a user table in the
database. The application provides all authentication and
authorization for database activities. The application can't be used
unless the user authenticates with information stored in the user
table in the database.
I need a way to encrypt the connection string, which includes the
password, without hard-coding it in the application.
The application is targeted for Windows XP for use at home, but could
also be used on a machine connected to a network, such as an active
directory domain. This particular app isn't being designed to
interact with AD or a network environment.
The samples I've seen on the Internet use DPAPI and other encryption
schemes that seem to require keys, but, unless I didn't see it or
don't understand it, I don't see a way to generate encryption keys
during design time that can be deployed with any way of protecting the
keys.
I can't use Windows Authentication/Integrated Security because, given
the potential environments this application would be used in, there's
no guarantee that the person booting up and signing on the computer is
the actual intended user.
The example I've seen that uses ProtectedData clearly won't work
because once the connection string is encrypted, it can only be
decrypted on the machine it's being used on.
My understanding is that I can't use hashing because it creates a
1-way encryption, and I need to be able to decrypt it to connect to
the database.
I've been able to "encrypt" the connection string using AsnEncodeData
and put the results in the app.config file, and could probably do the
same thing with CryptoAPITransform, but it occurs to me that someone
that knows how to program in .NET could implement they're own
AsnEncodeData or CryptoAPITransform decoders to read the connection
string.
Is there any way to encrypt the connection string so it can't be
hacked in this situation?
Or do I need to create a second app that runs as a Custom Action
during deployment that encrypts the connection string for that machine
only?
TIA.
Dave
.
- Follow-Ups:
- References:
- Prev by Date: Re: Help encrypt conn string - no ASP, no server, can't protect keys, can't use Windows Authentication
- Next by Date: Re: Help encrypt conn string - no ASP, no server, can't protect keys, can't use Windows Authentication
- Previous by thread: Re: Help encrypt conn string - no ASP, no server, can't protect keys, can't use Windows Authentication
- Next by thread: Re: Help encrypt conn string - no ASP, no server, can't protect keys, can't use Windows Authentication
- Index(es):
Relevant Pages
|
|