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. Decrypt but not Encrypt

Decrypt but not Encrypt

Scheduled Pinned Locked Moved C#
csharpdesign
8 Posts 4 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.
  • L Offline
    L Offline
    linal
    wrote on last edited by
    #1

    Hey, Does anyone know of a way in .NET (C#) to use a key that will decrypt a something but not encrypt it. I looked at RSA,DSA, and TripleDES but when getting the private key it includes the public key as well. Does anyone know if this is possible or would I need to rethink my design. Thanks -- John

    N D 2 Replies Last reply
    0
    • L linal

      Hey, Does anyone know of a way in .NET (C#) to use a key that will decrypt a something but not encrypt it. I looked at RSA,DSA, and TripleDES but when getting the private key it includes the public key as well. Does anyone know if this is possible or would I need to rethink my design. Thanks -- John

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

      John, I belive RSA is what your looking for. The basic idea is use the public key to encrypt the private key to decrypt. You can get the RSA class to export the key pair without the private key. Hope this helps ~Nick

      Forever Developing

      1 Reply Last reply
      0
      • L linal

        Hey, Does anyone know of a way in .NET (C#) to use a key that will decrypt a something but not encrypt it. I looked at RSA,DSA, and TripleDES but when getting the private key it includes the public key as well. Does anyone know if this is possible or would I need to rethink my design. Thanks -- John

        D Offline
        D Offline
        dino2094
        wrote on last edited by
        #3

        Look at wiki Mainly, you are concerned about the difference between Symmetric-key cryptography and Public-key cryptography. From your post, it seems like you need Public-key cryptography but there is a catch! Public-key by itself cannot encrypt large messages. Public-key crypto is usually used for setting up a shared key or digital signatures(DSA). In shared key, one encrypts the key using a Public-key crypto(RSA,ECC,...) and sends it to the other party. The other party decrypts the key and then both parties switch to a Symmetric cipher for future transmissions. (There is also diffie-hellman key exchanges as well). In a DSA (roughly), you encrypt the hash of your message. It might help if you explain in more detail what you are trying to do.

        L 1 Reply Last reply
        0
        • D dino2094

          Look at wiki Mainly, you are concerned about the difference between Symmetric-key cryptography and Public-key cryptography. From your post, it seems like you need Public-key cryptography but there is a catch! Public-key by itself cannot encrypt large messages. Public-key crypto is usually used for setting up a shared key or digital signatures(DSA). In shared key, one encrypts the key using a Public-key crypto(RSA,ECC,...) and sends it to the other party. The other party decrypts the key and then both parties switch to a Symmetric cipher for future transmissions. (There is also diffie-hellman key exchanges as well). In a DSA (roughly), you encrypt the hash of your message. It might help if you explain in more detail what you are trying to do.

          L Offline
          L Offline
          linal
          wrote on last edited by
          #4

          I'm looking at encrypting a small XML file which will contain settings. Now I want the file to be unencrypted so it's readable but not the ability to encrypt a new XML file to replace it. Cheers -- John

          D 1 Reply Last reply
          0
          • L linal

            I'm looking at encrypting a small XML file which will contain settings. Now I want the file to be unencrypted so it's readable but not the ability to encrypt a new XML file to replace it. Cheers -- John

            D Offline
            D Offline
            dino2094
            wrote on last edited by
            #5

            Does the XML file need both confidentially and authentication? Or just authentication?

            L 1 Reply Last reply
            0
            • D dino2094

              Does the XML file need both confidentially and authentication? Or just authentication?

              L Offline
              L Offline
              linal
              wrote on last edited by
              #6

              Just authentication, do you know of a better solution to my problem? Thanks. -- John

              D M 2 Replies Last reply
              0
              • L linal

                Just authentication, do you know of a better solution to my problem? Thanks. -- John

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

                Ah, you need a digital signature. http://en.wikipedia.org/wiki/Digital_signature Google has alot under c# digital signature

                1 Reply Last reply
                0
                • L linal

                  Just authentication, do you know of a better solution to my problem? Thanks. -- John

                  M Offline
                  M Offline
                  mav northwind
                  wrote on last edited by
                  #8

                  Hi! You could sign a hash value of your data (private key required for that) and verify the integrity of the hash using just the public key. For this you only have to include the public key into your app and keep the private key safe.

                  Regards, mav -- Black holes are the places where God divided by 0...

                  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