You've mixed up string encoding/decoding and base64 conversion.
When you encrypt you store the base64 version of the encrypted byte array.
When you decrypt you're supposed to convert that base64 string to a byte array, decrypt the array and then use Encoding.ASCII.GetString to obtain the original string from the decrypted byte array. Your decryption code does exactly the opposite.
And a side note: never use ASCII unless you have specific reasons to do so. Use UTF8 or Unicode encodings instead.
No comments:
Post a Comment