Re: Help encrypt conn string - no ASP, no server, can't protect keys, can't use Windows Authentication



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





.



Relevant Pages

  • Re: Help encrypt conn string - no ASP, no server, cant protect keys, cant use Windows Authentica
    ... I want to deploy a .NET 2.0 Windows Forms application that uses an MS ... The database has been encoded and password ... I need a way to encrypt the connection string, ... The samples I've seen on the Internet use DPAPI and other encryption ...
    (microsoft.public.dotnet.security)
  • Re: Help Encrypting Connection String
    ... I have simply 'overridden' the LocalSqlServer connection string to point to my SQL Server DB. ... to encrypt the section and places it into web.config - the config file then refers to the reg key. ... I don't like to hardcode anything, in general, but I'd rather do that with an encryption key than the underlying data itself. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Help encrypt conn string - no ASP, no server, cant protect keys, cant use Windows Authentication
    ... The database has been encoded and password protected to ... I need a way to encrypt the connection string, which includes the password, ... 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 ...
    (microsoft.public.dotnet.security)
  • Re: Use Dpapi with Shared Asp.Net Web Host?
    ... You could then store your public key and the encrypted ... connection string and connect to the database, the user connects using SSL, ... You could also use DPAPI as you suggested, but you should not use a console ... After the encryption ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: How do I make my database secure?
    ... Even with encryption, the system has to have a key, and in a shared hosting environment, it is going to be extremely difficult to come up with a way to protect that key ... You should encrypt the data itself before place it into database. ... Is there some way to encrypt the connection string? ... could the creditcard fields be encrypted in the database? ...
    (microsoft.public.dotnet.framework.aspnet)