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 / C++ / MFC
  4. Which encryption method to use?

Which encryption method to use?

Scheduled Pinned Locked Moved C / C++ / MFC
c++securitywindows-adminquestion
7 Posts 6 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.
  • S Offline
    S Offline
    StoneRaven
    wrote on last edited by
    #1

    I have a simple C++6.0/MFC SDI application that has some username/passwords associated with it. Up to now I have stored these items in the registry since there was no real security needs. However, there are now a few users who are requesting some increased security so I would like to encrypt/decrypt the username and passwords. I have searched for and found many encryption downloads but was wondering if there is any consensus on a preferred one. I just need to encrypt/decrypt a string as simply as possible, with moderate security. Thanks for your time and any assistance. StoneRaven

    N K T C D 5 Replies Last reply
    0
    • S StoneRaven

      I have a simple C++6.0/MFC SDI application that has some username/passwords associated with it. Up to now I have stored these items in the registry since there was no real security needs. However, there are now a few users who are requesting some increased security so I would like to encrypt/decrypt the username and passwords. I have searched for and found many encryption downloads but was wondering if there is any consensus on a preferred one. I just need to encrypt/decrypt a string as simply as possible, with moderate security. Thanks for your time and any assistance. StoneRaven

      N Offline
      N Offline
      Nicholas Cardi
      wrote on last edited by
      #2

      You could use a simple xor on the password. I think the standard way is to use a MD5 hash or SHA hash. You hash the user password and store the hash in the registry. After you get the plain text password from the user you then hash the password and then compare the hash value to the hash value stored in the registry. This way even if the registry is compromised the password is not stored in the clear. Forever Developing

      1 Reply Last reply
      0
      • S StoneRaven

        I have a simple C++6.0/MFC SDI application that has some username/passwords associated with it. Up to now I have stored these items in the registry since there was no real security needs. However, there are now a few users who are requesting some increased security so I would like to encrypt/decrypt the username and passwords. I have searched for and found many encryption downloads but was wondering if there is any consensus on a preferred one. I just need to encrypt/decrypt a string as simply as possible, with moderate security. Thanks for your time and any assistance. StoneRaven

        K Offline
        K Offline
        Kharfax
        wrote on last edited by
        #3

        I don't know what is you application for, but if you need increased security you need to change the way you store user/password. You could encrypt the passwords with any algoritm you want, but if someone modifies the registry and sets the password to null, all you security is f****d up. If you still want to store the info in the registry, and want the users to think that they have improved security, just add 100 or some random number to the string, and is the same.

        1 Reply Last reply
        0
        • S StoneRaven

          I have a simple C++6.0/MFC SDI application that has some username/passwords associated with it. Up to now I have stored these items in the registry since there was no real security needs. However, there are now a few users who are requesting some increased security so I would like to encrypt/decrypt the username and passwords. I have searched for and found many encryption downloads but was wondering if there is any consensus on a preferred one. I just need to encrypt/decrypt a string as simply as possible, with moderate security. Thanks for your time and any assistance. StoneRaven

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          StoneRaven wrote:

          so I would like to encrypt/decrypt the username and passwords

          RC4[^] is well suited for you need

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta VC Forum Q&A :- I/ IV

          1 Reply Last reply
          0
          • S StoneRaven

            I have a simple C++6.0/MFC SDI application that has some username/passwords associated with it. Up to now I have stored these items in the registry since there was no real security needs. However, there are now a few users who are requesting some increased security so I would like to encrypt/decrypt the username and passwords. I have searched for and found many encryption downloads but was wondering if there is any consensus on a preferred one. I just need to encrypt/decrypt a string as simply as possible, with moderate security. Thanks for your time and any assistance. StoneRaven

            C Offline
            C Offline
            cmk
            wrote on last edited by
            #5

            If you want to use Win encryption as simply as possible then use CryptProtectData()/CryptUnprotectData() to encrypt/decrypt the secret data before/after writing/reading the registry. These will allow you to use either the machine key (any user on machine can decrypt the data), or the current user key (only that user can decrypt the data). ...cmk Save the whales - collect the whole set

            S 1 Reply Last reply
            0
            • C cmk

              If you want to use Win encryption as simply as possible then use CryptProtectData()/CryptUnprotectData() to encrypt/decrypt the secret data before/after writing/reading the registry. These will allow you to use either the machine key (any user on machine can decrypt the data), or the current user key (only that user can decrypt the data). ...cmk Save the whales - collect the whole set

              S Offline
              S Offline
              StoneRaven
              wrote on last edited by
              #6

              How do I go about getting a storable value from the encrypted DATA_BLOB that can be stored/recovered from the registry and re-inserted in a new DATA_BLOB struct for decryption later on? Thanks...

              1 Reply Last reply
              0
              • S StoneRaven

                I have a simple C++6.0/MFC SDI application that has some username/passwords associated with it. Up to now I have stored these items in the registry since there was no real security needs. However, there are now a few users who are requesting some increased security so I would like to encrypt/decrypt the username and passwords. I have searched for and found many encryption downloads but was wondering if there is any consensus on a preferred one. I just need to encrypt/decrypt a string as simply as possible, with moderate security. Thanks for your time and any assistance. StoneRaven

                D Offline
                D Offline
                depotdog
                wrote on last edited by
                #7

                if you are putting the app into the public domain, then I suggest that you use at least des56. The hackers out there WILL try to break your encryption and if you use xor or bit flipping, they will break it and post the findings on a hundred hacker bulletin boards. MS has some simple envelope and password encrypt functions in their csp that make it easy or there are many examples out there. I bury a long password in code somewhere and use it as the password to encrypt/decrypt the envelope. Be sure to obfuscate your code or that part where the password is hidden to thwart decompliers. http://msdn.microsoft.com/msdnmag/issues/03/11/NETCodeObfuscation

                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