Hi all,
I have a configuration file that is storing sensative data, like db
passwords etc. I want to encrypt the file so that people can not see the
contents. What are the standard practices for storing the encryption key. I
definitely don't want to hard code it in my code otherwise someone looking at
the IL can easily see the key.
Where should this key be stored and how can an app access it without
someone else being able to do the same?
Thanks
Mark. 4 7975
Hi Mark,
Normally one does not store a password in a file, but rather the (salted)
hash of this password. In the main app, when one enters the password, the
hash of this password can be compared with the hash of the password you
calculated and stored in some file. If the hashes are the same, the password
is valid. use SHA256 or better to create the hash.
Hope this helps,
Daniel
Hi Daniel,
thanks for your reply, I definitiely agree with you, however if I need to
store a username and password in my configuration file for a connection
string to the database then I cannot modify that in any way otherwise the
dataabse will not know these values. I need someway to encrypt the
configuration file, but be able to decrypt it to get the connection details
but I am not sure where to store the key which will be used to decrypt the
config file. Do I have to encrypt the encryption key :-) and so on...
Thanks
Mark.
"Daniel" wrote: Hi Mark,
Normally one does not store a password in a file, but rather the (salted) hash of this password. In the main app, when one enters the password, the hash of this password can be compared with the hash of the password you calculated and stored in some file. If the hashes are the same, the password is valid. use SHA256 or better to create the hash.
Hope this helps,
Daniel
In my point of view:
1. Put the password's hash into the file;
2. Encrypt rest of contents using the password.
3. When the App starts, first of all compare stored hash and hash of the
entered password, if they are identical - decrypt rest of contents.
Vit Hi Daniel, thanks for your reply, I definitiely agree with you, however if I need to store a username and password in my configuration file for a connection string to the database then I cannot modify that in any way otherwise the dataabse will not know these values. I need someway to encrypt the configuration file, but be able to decrypt it to get the connection details but I am not sure where to store the key which will be used to decrypt the config file. Do I have to encrypt the encryption key :-) and so on...
Thanks Mark.
"Vitaly Zayko" <vitaly_at_zayk o_dot_net> wrote in message
news:Om******** *****@TK2MSFTNG P10.phx.gbl... In my point of view: 1. Put the password's hash into the file; 2. Encrypt rest of contents using the password. 3. When the App starts, first of all compare stored hash and hash of the entered password, if they are identical - decrypt rest of contents. Vit
I think his point here is that there is no "entered" password - there is
only what exists in the config file. AKA - he wants his program to know
what the username/password for the database is, but noone else should be
able to figure it out from the config file. I understand that right? (I
don't know the proper answer to the question - just trying to clarify).
--
Adam Clauss This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mark Buch |
last post by:
Hi, is it possible to protect the python sourcecode?
I have a nice little script and i dont want to show everbody the source.
Im using python on a windows pc.
Thank you - Mark
|
by: faktujaa |
last post by:
Hi,
Currently im storing the connection info. in XML file on the C drive. the
only problem with this is that anybody can open and check the database name.
I know encryption can solve this problem but still im concerned whether this
is the right place to store connection info as in earlier project that was in
C++, we use to store the connection info. in registry but the problem with
this approach is that your application becomes windows...
|
by: joshsackett |
last post by:
I am starting an encryption project for my database and I'm performing
some tests on decryption speed. A lot of my application queries use a
LIKE parameter in the WHERE clause. To keep from changing my
application I am performing all the work on the back-end; creating
views, triggers and UDFs to encrypt/decrypt the data. A problem has
arisen around the LIKE parameter, though.
Currently:
SELECT SSN, FNAME, LNAME FROM USERS WHERE LNAME...
|
by: pinocchio |
last post by:
Hello,
I want to hide cursor in textRichBox. Default the cursor blink if you
click on richTextBox and I want to disable this feature.
I need to make something like Adobe Reader, so textRichBox as readonly
but the text can be selected, etc.
Any idea?
|
by: Sharon |
last post by:
I’m sending mail form my C#/.NET assembly, and for that I’m doing
authentication like that:
MailMessage MyMail = new MailMessage()
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "UserName")
MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", " password");
And by using tools like...
| |
by: Dica |
last post by:
i've got an app that needs to connect to sql server and login with a
useName/password. currently, my app saves this info in an XML file in plain
text (i.e. no encryption). everytime the app is opened, the XML file is read
and the userName/password used to establish the sql connection. is this the
normal way of doing things, or is it smarter to save these set tings
elsewhere, like the registry? if saving to XML is deemed appropriate, should...
|
by: David |
last post by:
One thing that's always puzzled me about implementing encryption on
remote asp.net apps is where to store the keys. The demo code indicate
that you include them in a configuration file, but this would seem to
defeat the purpose. If someone obtained the configuration file and
they knew the encryption method, then they could decrypt your data.
Storing them hard-coded in the app is just as bad, since it can be
disassembled. Obfuscation...
|
by: Igor |
last post by:
1. Are stored procedures WITH ENCRYPTION slower than the ones without
encryption?
2. Should i put most restrictive conditions first or last in WHERE? In
which order does MSSQL execute conditions? Or MSSQL determents what
would be best and does not bother with the way i sorted conditions?
for example:
SELECT *
FROM
|
by: cefrancke |
last post by:
I have a few tables with sensitive user information (passwords, etc.)
and I would like to prevent someone from opening a blank database and
importing those tables.
Is there a way to "hide" or protect these tables from being linked or
imported?
TIA
|
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...
|
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,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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,...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |