Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Where to put the password?

Where to put the password?

Scheduled Pinned Locked Moved C#
databasesecurityhelpquestiondiscussion
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nader Elshehabi
    wrote on last edited by
    #1

    Hello guys. I'm stuck in one of the silliest problems anyone would ever imagine. Alright, my application is a password protected database application. I know!! I've already put the passwords of my application, and the database in an external file -not the main config. I got my reasons though-. Now I want to encrypt that external file to protect my passwords, and not to hardcode them in my program. The funny thing is that I need a key, wich has to be the same in the Encrypting/Decrypting process. I don't want to hardcode that key -I know it's not the best practice-. Also I don't want to use the File.Encrypt() method, as it's easily broken -using the Decrypt ethod BTW-, and assumes that the user has NTFS. I figured out an inconvenient way of maing the user's password, or my Assembly's GUID as that key.This is my last resort, but I'd really like to hear fresh ideas, as I'm out of!! PS. Currently I'm reading MSDN security section. Can you imagine how desperate I am now?

    Regards:rose:

    M D 2 Replies Last reply
    0
    • N Nader Elshehabi

      Hello guys. I'm stuck in one of the silliest problems anyone would ever imagine. Alright, my application is a password protected database application. I know!! I've already put the passwords of my application, and the database in an external file -not the main config. I got my reasons though-. Now I want to encrypt that external file to protect my passwords, and not to hardcode them in my program. The funny thing is that I need a key, wich has to be the same in the Encrypting/Decrypting process. I don't want to hardcode that key -I know it's not the best practice-. Also I don't want to use the File.Encrypt() method, as it's easily broken -using the Decrypt ethod BTW-, and assumes that the user has NTFS. I figured out an inconvenient way of maing the user's password, or my Assembly's GUID as that key.This is my last resort, but I'd really like to hear fresh ideas, as I'm out of!! PS. Currently I'm reading MSDN security section. Can you imagine how desperate I am now?

      Regards:rose:

      M Offline
      M Offline
      Muammar
      wrote on last edited by
      #2

      Poor thing!! but dont worry, im even stuck in a more stupid problem:) i cannt update the database im connected to!!

      All generalizations are wrong, including this one!

      1 Reply Last reply
      0
      • N Nader Elshehabi

        Hello guys. I'm stuck in one of the silliest problems anyone would ever imagine. Alright, my application is a password protected database application. I know!! I've already put the passwords of my application, and the database in an external file -not the main config. I got my reasons though-. Now I want to encrypt that external file to protect my passwords, and not to hardcode them in my program. The funny thing is that I need a key, wich has to be the same in the Encrypting/Decrypting process. I don't want to hardcode that key -I know it's not the best practice-. Also I don't want to use the File.Encrypt() method, as it's easily broken -using the Decrypt ethod BTW-, and assumes that the user has NTFS. I figured out an inconvenient way of maing the user's password, or my Assembly's GUID as that key.This is my last resort, but I'd really like to hear fresh ideas, as I'm out of!! PS. Currently I'm reading MSDN security section. Can you imagine how desperate I am now?

        Regards:rose:

        D Offline
        D Offline
        Dario Solera
        wrote on last edited by
        #3

        The most used solution in cases like this is to store the Hash value of the password instead of the password itself. When a user tries to login, the program will compute the Hash code of the password provided by the user and compare it to the stored value. This is very secure, especially if you use strong hashing algorithm like SHA1. The .NET Framework provides exhaustive support for hashing. The only problem is that you no longer have the clear-text password. It might be a problem if the user forgets his password.

        ________________________________________________ Personal Blog [ITA] - Tech Blog [ENG] Developing ScrewTurn Wiki 2.0 (2.0 Alpha is out)

        N 1 Reply Last reply
        0
        • D Dario Solera

          The most used solution in cases like this is to store the Hash value of the password instead of the password itself. When a user tries to login, the program will compute the Hash code of the password provided by the user and compare it to the stored value. This is very secure, especially if you use strong hashing algorithm like SHA1. The .NET Framework provides exhaustive support for hashing. The only problem is that you no longer have the clear-text password. It might be a problem if the user forgets his password.

          ________________________________________________ Personal Blog [ITA] - Tech Blog [ENG] Developing ScrewTurn Wiki 2.0 (2.0 Alpha is out)

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          First, thank you for your reply. I already applied that solution in the login password of the user. I now have some other sensitive data that I must encrypt in an external file. Where would I put the encryption key? That was my question -sorry if it wasn't clear the first time-.

          Regards:rose:

          D 1 Reply Last reply
          0
          • N Nader Elshehabi

            First, thank you for your reply. I already applied that solution in the login password of the user. I now have some other sensitive data that I must encrypt in an external file. Where would I put the encryption key? That was my question -sorry if it wasn't clear the first time-.

            Regards:rose:

            D Offline
            D Offline
            Dario Solera
            wrote on last edited by
            #5

            I ran across the same problem. Since the application wasn't meant to be particularly secure, I just hard-coded the encryption key in the application, "hiding" it so that it doesn't seem a key but just an error message. In other words, there is a fictitious error message, and I use that string to generate the key using a method with a name like PerformOperations, so that it does not seem encryption-related. It's not very secure, but in my case it was enough.

            ________________________________________________ Personal Blog [ITA] - Tech Blog [ENG] Developing ScrewTurn Wiki 2.0 (2.0 Alpha is out)

            N 1 Reply Last reply
            0
            • D Dario Solera

              I ran across the same problem. Since the application wasn't meant to be particularly secure, I just hard-coded the encryption key in the application, "hiding" it so that it doesn't seem a key but just an error message. In other words, there is a fictitious error message, and I use that string to generate the key using a method with a name like PerformOperations, so that it does not seem encryption-related. It's not very secure, but in my case it was enough.

              ________________________________________________ Personal Blog [ITA] - Tech Blog [ENG] Developing ScrewTurn Wiki 2.0 (2.0 Alpha is out)

              N Offline
              N Offline
              Nader Elshehabi
              wrote on last edited by
              #6

              Well. I guess I'd go for that if my time is cut short. Thanks for your time Dario.

              Regards:rose:

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups