Problem with decryption

Discussion in 'ASP .Net' started by Showjumper, Jan 26, 2006.

  1. Showjumper

    Showjumper Guest

    I solved my previous problem. The new one is that the password is not being
    decrypted but rather is still in the enrypted format. I am using Rijndael
    emcryption. Below is the decryption code.
    And here is th eline to return the decrypted password. Any help is
    appreciated Thanks Ashok
    Return s.DecryptToString(encryptedData,
    CType(HttpContext.Current.Application("Key"), Rijndael))

    Public Shared Function DecryptToString(ByVal dataToDecrypt As Byte(), ByVal
    crypt As SymmetricAlgorithm) As String
    ' Create a cryptographic stream for decryption.
    Dim ms As MemoryStream = New MemoryStream
    Dim cs As CryptoStream = New CryptoStream(ms, crypt.CreateDecryptor(),
    CryptoStreamMode.Write)
    ' Write the binary data to the memory stream.
    cs.Write(dataToDecrypt, 0, dataToDecrypt.Length)
    cs.FlushFinalBlock()
    ' Read the unencrypted data from the stream into a string,
    ' with the help of the BinaryReader.
    Dim r As BinaryReader = New BinaryReader(ms)
    ms.Position = 0
    Dim decryptedData As String = r.ReadString()
    r.Close()
    Return decryptedData
    End Function
     
    Showjumper, Jan 26, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Showjumper

    Problem with decryption

    Showjumper, Jan 23, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    403
    Showjumper
    Jan 23, 2006
  2. Showjumper

    Problem with decryption

    Showjumper, Jan 25, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    498
    Showjumper
    Jan 27, 2006
  3. Rodrigo m. Ferreira

    FormsAuthentication.Decryption problem

    Rodrigo m. Ferreira, Aug 29, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    722
    Rodrigo m. Ferreira
    Aug 29, 2008
  4. Roland Schmitt

    OpenSSL decryption problem

    Roland Schmitt, Oct 18, 2004, in forum: Ruby
    Replies:
    1
    Views:
    640
    Jamis Buck
    Oct 18, 2004
  5. Chad
    Replies:
    5
    Views:
    507
Loading...

Share This Page