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. Web Development
  3. ASP.NET
  4. Encryption in asp.net c#

Encryption in asp.net c#

Scheduled Pinned Locked Moved ASP.NET
13 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.
  • M Malayil alex

    Hello, Hello friends i need your help.in my project i want to encrypt login details can anybody help me to solve this.... Regards Alex.

    A Offline
    A Offline
    APDevelop
    wrote on last edited by
    #2

    Hello Alex, It is always good to encrypt these login details): You can implement this in different ways. Here is a small code snippet which does exactly the same thing using JavaScript: <!-- Beginning of JavaScript - function encode(text) { Ref="1923786540chikjmonpqstuvrxydahgei" Result="" for (Count=0; Count<text.length; Count++) { Char=text.substring (Count, Count+1); Num=Ref.indexOf (Char); EncodeChar=Ref.substring(Num+1, Num+2) Result += EncodeChar } document.form1.pw.value=Result } // - End of JavaScript - -->

    I have taken a look on this javascript earlier at http://www.webteacher.com/. This is a small example but it should get you started on encrypting these login details. Regards, Amit Pal

    M 1 Reply Last reply
    0
    • A APDevelop

      Hello Alex, It is always good to encrypt these login details): You can implement this in different ways. Here is a small code snippet which does exactly the same thing using JavaScript: <!-- Beginning of JavaScript - function encode(text) { Ref="1923786540chikjmonpqstuvrxydahgei" Result="" for (Count=0; Count<text.length; Count++) { Char=text.substring (Count, Count+1); Num=Ref.indexOf (Char); EncodeChar=Ref.substring(Num+1, Num+2) Result += EncodeChar } document.form1.pw.value=Result } // - End of JavaScript - -->

      I have taken a look on this javascript earlier at http://www.webteacher.com/. This is a small example but it should get you started on encrypting these login details. Regards, Amit Pal

      M Offline
      M Offline
      Malayil alex
      wrote on last edited by
      #3

      Thanks amit, But i need the code for encryption and decryption ,if possible using c# alex.

      S A 2 Replies Last reply
      0
      • M Malayil alex

        Thanks amit, But i need the code for encryption and decryption ,if possible using c# alex.

        S Offline
        S Offline
        Sandeep Akhare
        wrote on last edited by
        #4

        OK you want the code in C# means encryption at server side Why you want to Encrypt the value at the server side do you want to store that value in database something like that Best way is to have own algorithm to encrypt and decrypt the data

        Thanks and Regards Sandeep If you want something you never had, do something you have never done!

        1 Reply Last reply
        0
        • M Malayil alex

          Thanks amit, But i need the code for encryption and decryption ,if possible using c# alex.

          A Offline
          A Offline
          anufabian
          wrote on last edited by
          #5

          Dim d As New EncryptedData d.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES d.Content = "hello" d.SetSecret("23456", CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD) Dim textenc As String = d.Encrypt(CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64) Response.Write(textenc) Dim d1 As New EncryptedData d.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES d.SetSecret("23456", CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD) d.Decrypt(textenc) Dim textdec As String = d.Content() Response.Write(textdec) Try the above , the value given as string in the function SetSecret is the key I am using , u can use anything. Add a reference to Capicom in ur project and then implement the same

          M 1 Reply Last reply
          0
          • A anufabian

            Dim d As New EncryptedData d.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES d.Content = "hello" d.SetSecret("23456", CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD) Dim textenc As String = d.Encrypt(CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64) Response.Write(textenc) Dim d1 As New EncryptedData d.Algorithm.Name = CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES d.SetSecret("23456", CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD) d.Decrypt(textenc) Dim textdec As String = d.Content() Response.Write(textdec) Try the above , the value given as string in the function SetSecret is the key I am using , u can use anything. Add a reference to Capicom in ur project and then implement the same

            M Offline
            M Offline
            Malayil alex
            wrote on last edited by
            #6

            Hi thanks, I couldn't able to implement this in asp.net c# can you help me. alex.

            A 1 Reply Last reply
            0
            • M Malayil alex

              Hi thanks, I couldn't able to implement this in asp.net c# can you help me. alex.

              A Offline
              A Offline
              anufabian
              wrote on last edited by
              #7

              string strencrypteddata=""; EncryptedData encryptdata = new EncryptedDataClass(); encryptdata.Algorithm.Name = CAPICOM.CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES; encryptdata.Algorithm.KeyLength = CAPICOM.CAPICOM_ENCRYPTION_KEY_LENGTH.CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM; encryptdata.SetSecret("dasdsads",CAPICOM.CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD); encryptdata.Content = "hello"; strencrypteddata = encryptdata.Encrypt(CAPICOM.CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64); decryption :::: string strencrypteddata1; EncryptedData encryptdata1 = new EncryptedDataClass(); encryptdata1.Algorithm.Name = CAPICOM.CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES; encryptdata1.Algorithm.KeyLength = CAPICOM.CAPICOM_ENCRYPTION_KEY_LENGTH.CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM; encryptdata1.SetSecret("dasdsads",CAPICOM.CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD); encryptdata1.decrypt(strencrypteddata ); Response.Write(encryptdata1.Content);

              M 1 Reply Last reply
              0
              • A anufabian

                string strencrypteddata=""; EncryptedData encryptdata = new EncryptedDataClass(); encryptdata.Algorithm.Name = CAPICOM.CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES; encryptdata.Algorithm.KeyLength = CAPICOM.CAPICOM_ENCRYPTION_KEY_LENGTH.CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM; encryptdata.SetSecret("dasdsads",CAPICOM.CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD); encryptdata.Content = "hello"; strencrypteddata = encryptdata.Encrypt(CAPICOM.CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64); decryption :::: string strencrypteddata1; EncryptedData encryptdata1 = new EncryptedDataClass(); encryptdata1.Algorithm.Name = CAPICOM.CAPICOM_ENCRYPTION_ALGORITHM.CAPICOM_ENCRYPTION_ALGORITHM_3DES; encryptdata1.Algorithm.KeyLength = CAPICOM.CAPICOM_ENCRYPTION_KEY_LENGTH.CAPICOM_ENCRYPTION_KEY_LENGTH_MAXIMUM; encryptdata1.SetSecret("dasdsads",CAPICOM.CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD); encryptdata1.decrypt(strencrypteddata ); Response.Write(encryptdata1.Content);

                M Offline
                M Offline
                Malayil alex
                wrote on last edited by
                #8

                Hi sorry for the disturbance.. how can i declare this EncryptedData encryptdata = new EncryptedDataClass(); i coudn't able to is there specific name space is needed i added using System.Security.Cryptography; but still problem pls help me alex

                A 1 Reply Last reply
                0
                • M Malayil alex

                  Hi sorry for the disturbance.. how can i declare this EncryptedData encryptdata = new EncryptedDataClass(); i coudn't able to is there specific name space is needed i added using System.Security.Cryptography; but still problem pls help me alex

                  A Offline
                  A Offline
                  anufabian
                  wrote on last edited by
                  #9

                  I had written in the first mail itself to add a reference to Capicom in ur solution and then write using Capicom and then u will b able to use this code

                  M 1 Reply Last reply
                  0
                  • A anufabian

                    I had written in the first mail itself to add a reference to Capicom in ur solution and then write using Capicom and then u will b able to use this code

                    M Offline
                    M Offline
                    Malayil alex
                    wrote on last edited by
                    #10

                    sorry i am confucing, From where i will add reference to my project...i mean Capicom.. alex

                    A 1 Reply Last reply
                    0
                    • M Malayil alex

                      sorry i am confucing, From where i will add reference to my project...i mean Capicom.. alex

                      A Offline
                      A Offline
                      anufabian
                      wrote on last edited by
                      #11

                      I suppose u have ur solution opened in front of u , You will be able to see a references folder , right click , add reference . Click on the COM tab and there look for Capicom. select the same and then it will appear in the references folder in ur solution. Now in ur page add the line using Capicom. Is it ok now

                      M 1 Reply Last reply
                      0
                      • A anufabian

                        I suppose u have ur solution opened in front of u , You will be able to see a references folder , right click , add reference . Click on the COM tab and there look for Capicom. select the same and then it will appear in the references folder in ur solution. Now in ur page add the line using Capicom. Is it ok now

                        M Offline
                        M Offline
                        Malayil alex
                        wrote on last edited by
                        #12

                        Hello I didn't found anything in the com tag named Capicom i am using .net 2.0 ...sorry for the disturbance. alex.

                        A 1 Reply Last reply
                        0
                        • M Malayil alex

                          Hello I didn't found anything in the com tag named Capicom i am using .net 2.0 ...sorry for the disturbance. alex.

                          A Offline
                          A Offline
                          anufabian
                          wrote on last edited by
                          #13

                          Please follow this link and register the Capicom.dll in your system32 . this link gives u a download of the same http://www.microsoft.com/downloads/details.aspx?FamilyID=860ee43a-a843-462f-abb5-ff88ea5896f6&DisplayLang=en[^]

                          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