FlushFinalBlock() method was called twice on a CryptoStream

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anil Gupte/iCinema.com

    FlushFinalBlock() method was called twice on a CryptoStream

    I am getting the following message and no, it is not even going to that
    statement twice. Why is this happening?


    System.NotSuppo rtedException was caught
    Message="FlushF inalBlock() method was called twice on a CryptoStream. It
    can only be called once."
    Source="mscorli b"
    StackTrace:
    at System.Security .Cryptography.C ryptoStream.Flu shFinalBlock()
    at TempCrypt.Crypt .DecryptString1 28Bit(String
    vstrStringToBeD ecrypted, String vstrDecryptionK ey) in
    D:\Projects\VB\ TempCrypt\TempC rypt\Crypt.vb:l ine 132

    TIA,
    --
    Anil Gupte
    Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

    iCinema.com is a 7-character domain name that evokes a sense of entertainment, imagination, and fun. It combines the concepts of “i” (for information and interaction) with “cinema” to create an idea of an interactive cinema experien




  • Tom Shelton

    #2
    Re: FlushFinalBlock () method was called twice on a CryptoStream

    On 2008-06-24, Anil Gupte/iCinema.com <anil-list@icinema.co mwrote:
    I am getting the following message and no, it is not even going to that
    statement twice. Why is this happening?
    >
    >
    System.NotSuppo rtedException was caught
    Message="FlushF inalBlock() method was called twice on a CryptoStream. It
    can only be called once."
    Source="mscorli b"
    StackTrace:
    at System.Security .Cryptography.C ryptoStream.Flu shFinalBlock()
    at TempCrypt.Crypt .DecryptString1 28Bit(String
    vstrStringToBeD ecrypted, String vstrDecryptionK ey) in
    D:\Projects\VB\ TempCrypt\TempC rypt\Crypt.vb:l ine 132
    >
    TIA,
    Well, we would need to see the snippit of code that generates the error to be
    sure.

    --
    Tom Shelton

    Comment

    • Anil Gupte/iCinema.com

      #3
      Re: FlushFinalBlock () method was called twice on a CryptoStream

      Sorry, I meant to add this, here is the code that generates the error.

      bytDataToBeDecr ypted = Convert.FromBas e64String(vstrS tringToBeDecryp ted)
      bytDecryptionKe y = Encoding.ASCII. GetBytes(vstrDe cryptionKey.ToC harArray)
      ReDim bytTemp(bytData ToBeDecrypted.L ength)
      objMemoryStream = New MemoryStream(by tDataToBeDecryp ted)
      objCryptoStream = New CryptoStream(ob jMemoryStream,
      objRijndaelMana ged.CreateDecry ptor(bytDecrypt ionKey, bytIV),
      CryptoStreamMod e.Read)
      objCryptoStream .Read(bytTemp, 0, bytTemp.Length)
      Try
      objCryptoStream .FlushFinalBloc k() <-- It goes to the Catch statement from
      here
      objMemoryStream .Close()
      objCryptoStream .Close()
      Catch ex As Exception
      MsgBox("Decrypt String: " & ex.ToString)
      End Try

      Thanx,
      --
      Anil Gupte

      "Anil Gupte/iCinema.com" <anil-list@icinema.co mwrote in message
      news:ew$u%233e1 IHA.3968@TK2MSF TNGP04.phx.gbl. ..
      >I am getting the following message and no, it is not even going to that
      >statement twice. Why is this happening?
      >
      >
      System.NotSuppo rtedException was caught
      Message="FlushF inalBlock() method was called twice on a CryptoStream. It
      can only be called once."
      Source="mscorli b"
      StackTrace:
      at System.Security .Cryptography.C ryptoStream.Flu shFinalBlock()
      at TempCrypt.Crypt .DecryptString1 28Bit(String
      vstrStringToBeD ecrypted, String vstrDecryptionK ey) in
      D:\Projects\VB\ TempCrypt\TempC rypt\Crypt.vb:l ine 132
      >
      TIA,
      --
      Anil Gupte
      Innovate with UsLeading the Way in Advanced Technology Solutions Discover state-of-the-art services in logistics, databases, and AI designed for evolving

      iCinema.com is a 7-character domain name that evokes a sense of entertainment, imagination, and fun. It combines the concepts of “i” (for information and interaction) with “cinema” to create an idea of an interactive cinema experien


      >

      Comment

      Working...