Invalid character in a Base-64 string.

  • Thread starter Thread starter Heron
  • Start date Start date
H

Heron

Hi,

Could someone help me out..?
I'm trying to encrypt a serialized object but i get an error "Invalid
character in a Base-64 string." :/

string tmp = rn.Encrypt(Serializer.Serialize(user))



public string Encrypt(string str)

{

byte[] tmp = Convert.FromBase64String(str); <--- error here

return this.Encrypt(tmp);

}
 
I'm not sure that the Serializer.Serialize() method return a Base64String...

So I think you should use :

byte[] tmp = Convert.ToBase64String(str);

NOT byte[] tmp = Convert.FromBase64String(str);

Steph.
 
Back
Top