Results 1 to 14 of 14

Thread: Encrypt data from database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Encrypt data from database

    Hi friends,

    I am using Asp.Net 2.0 application. I have a user information form like username, password,name,lastname etc., I stored this information in a database. In the user information form one view button available. Suppose user click the view button, i show the information of user from database. What my query is that i need to show some fields like encrypted method from database. ie password and mobile no like **** or some encrypted no.Is it possible in .Net that encrypted data from database to our front end.

    Hope Your's reply.
    Failing to plan is Planning to fail

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Encrypt data from database

    Hey,

    Are you using the Membership, Role and Profile Provider that ship with ASP.NET or have you created your own database?

    Gary

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Encrypt data from database

    Hi,
    Thanks for yours reply. I am asking how encrypt data??
    Failing to plan is Planning to fail

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Encrypt data from database

    Hello,

    I am aware of what the question was, the reason that I am asking if becuase the encryption and retrieval of passwords is provided out of the box if you are using the Membership Provider which comes shipped with ASP.NET.

    So again, are you using the Memebership provider, or are you using your own custom code?

    Gary

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Encrypt data from database

    I am using my own custom code. Not use membership.
    Failing to plan is Planning to fail

  6. #6
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Encrypt data from database

    In which case you are going to want to start looking into using the System.Security.Cryptography Namespace which includes methods for encrypting data.

    Gary

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Encrypt data from database

    while user want to view his details at that time i show username and password address,phone no.

    I want to encrypt password and phone no only.
    Failing to plan is Planning to fail

  8. #8
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Encrypt data from database

    I am not quite sure I follow what you are saying but as a brief overview, I would have thought something like this would work for you:

    When the user resgisters with your site you are going to gather their information, i.e. username, password, address, phone etc. Once you have collected these, and before they are sent to the database, encrypt the password and phone number and store them in the database in their encrypted form. When you then display the informtion to the user, you can decrypt them.

    Having said that, it is more normal to hash the password rather than encrypt it. i.e. it is not possible to retrieve the password, but rather reset it to something else.

    Gary

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Thumbs up Re: Encrypt data from database

    ok gary. How will encrypt the data and decrypt again. If it is possible , could you please tell me how?
    Failing to plan is Planning to fail

  10. #10
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Encrypt data from database

    Hello,

    There are various ways that you can do this, and you have to make a decision about what kind of encryption that you want to use, that is why I pointed you at the MSDN reference so that you can read up on the different classes available.

    The only examples that I would have are in C#, which I am not sure would be much help for you.

    If you search through the code banks though, I am sure there are examples there.

    Gary

  11. #11

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jun 2007
    Posts
    241

    Re: Encrypt data from database

    k gary , thanks
    Failing to plan is Planning to fail

  13. #13
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: Encrypt data from database

    Hi!

    May I ask what the purpose is of encrypting the data in the first place? Do you have some dba's that you don't trust? Or do you store information that is strictly confidential like?


    Anyway,
    When it comes to passwords, the best option is to simply hash +salt it. Of course this means there is no way to read the password in plain text again, but I don't see when this case would ever happen.

    Not exactly direct answers to your questions, but perhaps give you some ideas to your solution?

    /henrik

  14. #14
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Encrypt data from database

    I think the answer is simpler. You want your information to appear as ****** on the form for viewing this information. So you simply don't show it or retrieve it from the database. You simply place ****** on the form.

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