Invalid character in a Base-64 string.

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);

}
 
T

TheSteph

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top