Problem with string type, is it a bug? known? .NET 1.1

  • Thread starter Thread starter ThunderMusic
  • Start date Start date
T

ThunderMusic

Hi,
I encrypted a string using the RijndaelManaged class.

When decrypted, it happens that the string is longer then the original, but
the exceeding chars are nothing (string.chars(indexOfExceedingChars) is
nothing)

To correct the problem, I used SomeOtherStringVar = trim(DecryptedString)

The problem is the following: Trim(DecryptedString) returns the string
without the exceeding chars, but SomeOtherStringVar still contains them
after the assignation. Should they not be removed?!?

I dont understand, can someone enlight me please?

Thanks

P.S. When putting the var in the Watch Window I see this value :
"DecryptedStringValue <---No " char at the end of the string
 
I would happy to enlighten me.
However I'm not sure to understand you :S

So I will summarize.
Encryption work on constant size block. To Cypher/Decypher it pad your
string with '\0' to fill the block.
When decrypted there are remaining '\0' which you could remove, with Trim();

I wonder which method you call (as this encryption class works with byte[]
not char[]), but it looks like it's a bug to leave empty char like that.
 
Back
Top