Query regarding cryptography. I'm using .net cryptography to encrypt and decrypt files stored on disk on an asp.net website using .Net 2.0 framework. The code (copied below) works fine to encrypt and decrypt pdf, tif, jpg, etc. However when it comes to MS Word documents with embedded images and/or tables I get a "Bad data" error when decrypting. The same document saved to rtf format is encrypted and decrypted without error. Also simple formatted text documents in Word format (Office 2003) do not throw an error when being decrypted.
Would someone care to point out where I'm going wrong?
Thanks, code below
Public Sub Encrypt(ByVal Userid As Integer, ByVal FilePath As String) 'Encrypt the file Try Dim EncryptedFilePath As String = FilePath & "enc" Dim clsNetEnCrypt As New NetEncrypt(User) clsNetEnCrypt.Encrypt(FilePath, EncryptedFilePath) 'Remove the Unencrypted file
View Complete Post