Functii de encodare decodare in baza 64 . Se folosesc in special in protocolul de www/http

Encodare:
string b64Encodeaza(string data)
{
try
{
byte[] encbuff = System.Text.Encoding.UTF8.GetBytes(data);
return Convert.ToBase64String(encbuff);
}
catch (Exception e)
{
throw new Exception("Eroare in functia de encodare64 :rn" + e.Message);
}
}
Decodare:
string b64Decodeaza(string data)
{
try
{
byte[] decbuff = Convert.FromBase64String(data);
return System.Text.Encoding.UTF8.GetString(decbuff);
}
catch (Exception e)
{
throw new Exception("Eroare in functia de decodare64 :rn" + e.Message);
}
}