Click here to Skip to main content
5,788,212 members and growing! (19,603 online)
Email Password   helpLost your password?
General Programming » Cryptography & Security » Security     Intermediate

Securing Web Accounts

By Vasudevan Deepak Kumar

Here we would briefly see how to keep accounts (signups) in online websites in a more secure way.
C#, VB.NET 1.0, .NET 1.1, Win2K, WinXP, Win2003, Windows, .NET, ASP, ASP.NET, Visual Studio, Dev

Posted: 5 Oct 2003
Updated: 5 Oct 2003
Views: 31,899
Bookmarked: 18 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
20 votes for this Article.
Popularity: 3.29 Rating: 2.53 out of 5
12 votes, 60.0%
1
1 vote, 5.0%
2
3 votes, 15.0%
3
2 votes, 10.0%
4
2 votes, 10.0%
5

Introduction

Most of us developing web applications normally use username and password combinations to authenticate and authorize users before they use the services of the applications. The passwords by default get stored in a database. Normally we use some string scrambling to store passwords to protect from prying eyes. But an intruder with a deterministic aspiration to get hold of member accounts can still use some brute force algorithm to get those passwords.

This article does not attempt to cover coding level requirements but attempts to convey the need of strong passwords and stronger security arrangements that are needed to keep our web applications safe from prying eyes.

Perhaps with this intention, I hope to cover this "Passwords and Strong Security Measures" step-by-step for benefit of readers, from the experiences I have gained, while developing Application Security Services for an application.

Message Digest 5 (MD5) Algorithm

In MD5 algorithm, we normally use the MD5CryptoServiceProvider to calculate the hash string of the value to be encrypted and store the hashed value into the database. Next time, when the password is required to be computed, we take the input string, use the same algorithm to compute the hash and compare the hash strings. By this way, the current password is retained safe and secure at least to a reasonable level.

Now, we need to discuss the issues like how does one confront issues like lost passwords. Passwords that are forgotten and if they are stored in MD5 algorithm cannot be reset as is. The only way is to regenerate a new password set, hash it and store it in the database. Perhaps this new regenerated password can be supplied to the user and the user can be forced to select a new password next time he logs in so that the generated and the spread password vulnerability can be offset.

Of course, it all depends upon the significance and criticality of the application to be secured. There are websites like Zend.com, which give only 2 hours for the new password generation request URL to be active, after which the request expires and a new password request has to be submitted later.

Generating a MD5 Hash

  1. Programming languages like PHP have built in support for MD5 generation.
  2. In C# (.NET Framework Language), we use the following simple code framework to generate MD5 Cryptographic Hash. Perhaps a simple code snippet from here.
        // First we need to convert the string into bytes, which
    
        // means using a text encoder.
    
        Encoder enc = System.Text.Encoding.Unicode.GetEncoder();
    
        // Create a buffer large enough to hold the string
    
        byte[] unicodeText = new byte[str.Length * 2];
        enc.GetBytes(str.ToCharArray(), 0, str.Length, unicodeText, 0, true);
    
        // Now that we have a byte array we can ask the CSP to hash it
    
        MD5 md5 = new MD5CryptoServiceProvider();
        byte[] result = md5.ComputeHash(unicodeText);
    
        // Build the final string by converting each byte
    
        // into hex and appending it to a StringBuilder
    
        StringBuilder sb = new StringBuilder();
        for (int i=0;i<RESULT.LENGTH;I++) pre < sb.ToString(); 
          return it And } sb.Append(result[i].ToString(?X2?)); {>
  3. Even with ASP, there are a couple of MD5 functions available to hash the strings and store and compare hashed values instead of encryptions and decryptions.

Summarizing...

I hope the above would be a starter information on Message Digest 5 Authentication. Perhaps in a later article, we would see about "Strong Passwords and Tools" to ensure that the passwords that are accepted and used by the application are not vulnerable to worms, viruses or for prying eyes.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Vasudevan Deepak Kumar


Vasudevan Deepak Kumar is from Chennai, India who has been in the programming career since 1994, when he was 15 years old. He has his Bachelors of Engineering (in Computer Science and Engineering) from Vellore Engineering College (now VIT University). He also has a MBA in Systems from Alagappa University, Karaikudi, India.


He started his programming career with GWBasic and then in his college was involved in developing programs in Fortran, Cobol, C++. He has been developing in Microsoft technologies like ASP, SQLServer 2000. For sometime, he has also been with PHP and MySQL based development in one of his previous organizations. Now currently his focus is on Microsoft .NET World (ASP.NET, C# and Whidbey)


In his past-time, he listens to polite Carnatic Music.

Web Presence



Homepage

http://www.lavanyadeepak.tk/

Blogs



Technical




Gossips




Spiritual







Occupation: Web Developer
Location: India India

Other popular Cryptography & Security articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 4 of 4 (Total in Forum: 4) (Refresh)FirstPrevNext
GeneralBut how to compare?sussAnonymous21:24 15 Jun '04  
GeneralRe: But how to compare?sussAnonymous19:24 16 Jun '04  
GeneralRe: But how to compare?sussAnonymous19:24 16 Jun '04  
GeneralSuggested CorrectionmemberAndre Velloso1:56 3 Jun '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 5 Oct 2003
Editor: Smitha Vijayan
Copyright 2003 by Vasudevan Deepak Kumar
Everything else Copyright © CodeProject, 1999-2009
Web16 | Advertise on the Code Project