Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Dotnetnuke Password Encryption

Reply
Thread Tools

Dotnetnuke Password Encryption

 
 
sanchita
Guest
Posts: n/a
 
      04-05-2007
Hi all,

I wasn't sure where to post this. Let me know if you know where exactly to
post it. I'm using DNN 2.4 and till now I wasnt encrypting my passwords but
now I want to so I just changed the value of the "Encryption Key" column in
the "HostSettings" table to RSA. But how do I modify my code such that I can
send in encrypted passwords to my SQL server. I tried an algo for RSA which
went like this -

static byte[] Encrypt (RSA rsa, byte[] input)
{
// by default this will create a 128 bits AES (Rijndael) object
SymmetricAlgorithm sa = SymmetricAlgorithm.Create ();
ICryptoTransform ct = sa.CreateEncryptor ();
byte[] encrypt = ct.TransformFinalBlock (input, 0, input.Length);

RSAPKCS1KeyExchangeFormatter fmt = new RSAPKCS1KeyExchangeFormatter
(rsa);
byte[] keyex = fmt.CreateKeyExchange (sa.Key);

// return the key exchange, the IV (public) and encrypted data
byte[] result = new byte [keyex.Length + sa.IV.Length +
encrypt.Length];
Buffer.BlockCopy (keyex, 0, result, 0, keyex.Length);
Buffer.BlockCopy (sa.IV, 0, result, keyex.Length, sa.IV.Length);
Buffer.BlockCopy (encrypt, 0, result, keyex.Length + sa.IV.Length,
encrypt.Length);
return result;
}

static byte[] Decrypt (RSA rsa, byte[] input)
{
// by default this will create a 128 bits AES (Rijndael) object
SymmetricAlgorithm sa = SymmetricAlgorithm.Create ();

byte[] keyex = new byte [rsa.KeySize >> 3];
Buffer.BlockCopy (input, 0, keyex, 0, keyex.Length);

RSAPKCS1KeyExchangeDeformatter def = new RSAPKCS1KeyExchangeDeformatter
(rsa);
byte[] key = def.DecryptKeyExchange (keyex);

byte[] iv = new byte [sa.IV.Length];
Buffer.BlockCopy (input, keyex.Length, iv, 0, iv.Length);

ICryptoTransform ct = sa.CreateDecryptor (key, iv);
byte[] decrypt = ct.TransformFinalBlock (input, keyex.Length +
iv.Length, input.Length - (keyex.Length + iv.Length));
return decrypt;
}

Please guide me regarding this. Any other 2 -way encryption also welcome..

Thanks,
Sanchita


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change a users password without knowing the old password nor the answer to the password question AAaron123 ASP .Net 1 01-16-2009 02:56 PM
Changing a users password without knowing the old password nor the answer to the password question AAaron123 ASP .Net 2 01-16-2009 02:08 PM
Which hard drive encryption program has the strongest tested encryption & security? =?iso-8859-1?Q?-=3D|__=28=BAL=BA=29__|=3D-____o=3D=5B:::::::::::::::=BB?= Computer Security 6 02-20-2008 01:35 PM
Skins for DotNetNuke available D_G ASP .Net 2 11-08-2006 11:59 AM
New Modules or New starters Kits (To integrate in DotnetNuke) or to create =?Utf-8?B?QmVuamFtaW4=?= ASP .Net 0 02-12-2004 04:36 PM



Advertisments