CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2001
    Posts
    49

    User Login and Password

    I am writing an application and I want to add User login and password screen before opening the application.

    Where it's better to save the users and passwords (encrypt
    passwords) data in Database or configuration file ?

    Does anyone have implemention of User login screen in C-sharp?



    Thanks in advance ...

  2. #2
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    my way is to use Database.
    I use encryption to store Passwords in db.
    Read login name and get the encrypted password from DB, then decrypt the password and compare the entered password.
    works well for applications which are client based as well as web based.
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  3. #3
    Join Date
    May 2003
    Location
    Germany
    Posts
    936
    I use the same way like Andy Tacker. But one difference I have. I also store my passwords encrypted in database and after reading the entered password I crypt that and compare it with the password from DB. In my opinion this is very important, because if you decrypt the password from DB for comparing, an attacker can enter a fake password and make a memorydump and will get the correct password. So if you compare encrypted passwords he won't get an important information.

  4. #4
    Join Date
    Sep 1999
    Posts
    67
    What do you use for encrypt and decrypt?

    The System.Security.Cryptography?

    Some start help on this subject would really be appretiated.

    /Anders

  5. #5
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503
    you can refer to this file for some information...
    Attached Files Attached Files
    If you think you CAN, you can, If you think you CAN'T, you are probably right.

    Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.

  6. #6
    Join Date
    Apr 2004
    Posts
    38

    Re: User Login and Password

    Quote Originally Posted by Andy Tacker
    you can refer to this file for some information...
    I tried to use this Class but I have a logical problem:

    the password in the DB should be stored in clear? I think not, but how can I store it encrypted?

    Thanks for your help

  7. #7
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: User Login and Password

    Generaly: never store password itself, neither clear nor encrypted. Store only its hash value computed by a strong alghoritm. In login process, just compare hash of typed in password with stored hash.
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured