Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
C#
buff    = new byte[1600];//decryption buffer.
                byteKey = GetByteKeys256(strKey);

                outputStream     = new MemoryStream();
                objSymmAlgorithm = new Cryptography.RijndaelManaged();

                decStream = new Cryptography.CryptoStream(outputStream, objSymmAlgorithm.CreateDecryptor(byteKey, VECTOR_IV_256), Cryptography.CryptoStreamMode.Write);
                //do the deryption ...
                inputStream.Position = 0;
                while( (lenRead = inputStream.Read(buff, 0,buff.Length))>0)
                {
                    decStream.Write(buff, 0, lenRead);
                }
                decStream.FlushFinalBlock();                outputStream.Flush();
                return outputStream;


it will give me error as Length of the data to decrypt is invalid while decrypting pdf file only for some file while decrypting for other pdf file it work fine.what to do to avoid this any one have idea?
Posted

1 solution

The problem is obvious: who told you the buffer should be of the length 1600?
To avoid it, read the documentation.
—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900