Well, I’m trying to run a client-server application with encryption using AES on VS 2010. However, on receipt of a big, serialized and encrypted file, the program throws the exception: Cryptographic Exception: Padding is Invalid and Cannot be Removed.
I looked around SOF and in other areas, the exception is appearing in web services and in cryptographic applications. I also tried all the solutions mentioned, such as changing the padding modes, disposal of encryptors and decryptors and using the same keys, unfortunately, none has worked, so I was wondering if any of you guys had an idea.
Problem turned out in the TCP connection, it was flushing data before the client wrote the entire stream onto the networkstream, a little while loop solved the problem