Re: Data decryption issue
- From: "Tom Andrecht" <tom.andrecht@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 4 Aug 2008 12:37:41 -0700
Ok, I have the UTF8Encoding class in place, and it seems to be working fine.
Now I am trying to run the decrypt, and am getting an error that I can't
figure out. The Decrypt function is similar to the posted one, but with the
encoding changes. To use it, I'm running a SQL statement against the
function as "SELECT dbo.Decrypt(Name1) FROM Customers." Now I'm getting an
error as follows from MS SQL Server:
Msg 6522, Level 16, State 2, Line 1
A .NET Framework error occurred during execution of user defined routine or
aggregate 'Decrypt':
System.Security.Cryptography.CryptographicException: Padding is invalid and
cannot be removed.
System.Security.Cryptography.CryptographicException:
at
System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[]
inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer,
Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
at
System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[]
inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
at System.Security.Cryptography.CryptoStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at SQLEncryption.Encryption.Decrypt(Char[] InputString)
..
So, I have extra padding in place, but I don't know if the padding mode
matters. I've tried using PKCS7, ISO10126, and no padding modes. On the
PKCS7 and ISO10126, I can encrypt just fine, but the decrypt function
returns the above error, but the encrypt does not work when padding is
specified to be none.
"Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx> wrote in message
news:op.ufdeqrhw8jd0ej@xxxxxxxxxxxxxxxxxxxxxxx
On Mon, 04 Aug 2008 09:15:45 -0700, Tom Andrecht
<tom.andrecht@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Peter,
I do appreciate the advice. I did try the Convert routines again, and am
still running into trouble. Specifically, I have tried the
Convert.FromBase64CharArray and Convert.ToBase64CharArray functions
I recommended the Encoding class, not the Convert class.
.
- Follow-Ups:
- Re: Data decryption issue
- From: Peter Duniho
- Re: Data decryption issue
- References:
- Data decryption issue
- From: Tom Andrecht
- Re: Data decryption issue
- From: Peter Duniho
- Re: Data decryption issue
- From: Tom Andrecht
- Re: Data decryption issue
- From: Peter Duniho
- Re: Data decryption issue
- From: Tom Andrecht
- Re: Data decryption issue
- From: Peter Duniho
- Data decryption issue
- Prev by Date: Re: xml and character codes such as É
- Next by Date: Menu item loop
- Previous by thread: Re: Data decryption issue
- Next by thread: Re: Data decryption issue
- Index(es):
Relevant Pages
|