473,493 Members | 4,347 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PasswordEncryption

1 New Member
Hi,

This is Nagamani. I have to encrypt the password in the connection string while connecting to SQL Server 2005 Database.And later I have to decrypt. I am using C#.net with Visual Studio 2008.


Please help me on this.
Nov 14 '08 #1
9 969
PRR
750 Recognized Expert Contributor
You should look into System.Security.Cryptography namespace...


Expand|Select|Wrap|Line Numbers
  1. using System.Web.Configuration;
  2. Configuration config = WebConfigurationManager.
  3.         OpenWebConfiguration("~");
  4.  
  5.         // Get the connectionStrings section.
  6.         ConnectionStringsSection constr =
  7.             config.GetSection("connectionStrings")
  8.             as ConnectionStringsSection;
  9.  
  10.         if (constr != null)
  11.         {
  12.             if (constr.SectionInformation.IsProtected)
  13.             {
  14.                 constr.SectionInformation.UnprotectSection();
  15.             }
  16.             Label1.Text = string.Empty+ constr.ConnectionStrings[0].ToString();
  17.  
  18.             string ss = constr.ConnectionStrings[0].ToString();
  19.  
  20.  
  21.         }
  22.  
  23.  
  24.         {
  25.  
  26.             constr.SectionInformation.ProtectSection(
  27.                 "DataProtectionConfigurationProvider");
  28. //RsaProtectedConfigurationProvider
  29.  
  30.             constr.SectionInformation.ForceSave = true;
  31.  
  32.             config.Save(ConfigurationSaveMode.Full);
  33.  
  34.         }
  35.  
Nov 14 '08 #2
r035198x
13,262 MVP
1) Web application or desktop application?
2.) Where does the password come from?
3.) For a simple DES check out the System.Security.Cryptography name space. You can find examples of how to use it all over internet.

Edit: Looks like DeepBlue's keyboard is faster than mine.
Nov 14 '08 #3
PRR
750 Recognized Expert Contributor
Take a look at this RsaProtectedConfigurationProvider

r035198x,
"Edit: Looks like DeepBlue's keyboard is faster than mine."
lol.. well not exactly ...
Nov 14 '08 #4
r035198x
13,262 MVP
@DeepBlue, do you by any chance know any chess?
Nov 14 '08 #5
PRR
750 Recognized Expert Contributor
@DeepBlue, do you by any chance know any chess?
i used to play... becoz of my name? "deepblue"? too horrible player though ...
Nov 21 '08 #6
r035198x
13,262 MVP
i used to play... becoz of my name? "deepblue"? too horrible player though ...
You are therefore are not worth challenging to a game.
I only play against very good players.

r035198x <------- Almost a grand master.
Nov 21 '08 #7
PRR
750 Recognized Expert Contributor
You are therefore are not worth challenging to a game.
I only play against very good players.

r035198x <------- Almost a grand master.
hmm perhaps i could learn from you....
Nov 21 '08 #8
r035198x
13,262 MVP
Most of my opponents ended up on their knees begging for mercy.

http://bytes.com/forum/thread578342-chess.html
Nov 21 '08 #9
PRR
750 Recognized Expert Contributor
Most of my opponents ended up on their knees begging for mercy.

http://bytes.com/forum/thread578342-chess.html
you are too ... way too good for me ....
Nov 21 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1611
by: Karunakararao | last post by:
Hi All I'm using sybase database, I have a binary datatype column in a table, when I'm trying to store the char(128) value into that, I'm getting syntax violation error. If I take "w" as the...
3
1237
Bob Ross
by: Bob Ross | last post by:
I am trying to ecrypt passwords to store them in a DB but I want to store them in String(nvarchar) format. So I have written this class Public Class PasswordEncryption Private IV As...
0
6980
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...
0
7157
Oralloy
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,...
0
7192
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4579
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...
0
3087
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...
0
1397
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 ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.