Hi, I have been working a project to SQL CE, we had the necessity to encrypt the password and apply the following solution, I hope this approach work for you:
var strConnectionString = ConfigurationManager.ConnectionStrings["EntitiesTest"].ConnectionString;
string[] staConnectionString = strConnectionString.Split('=');
var strDecrypted = WrapperClass.Utilities.Decrypt(staConnectionString[5].Replace("\"",""));
var strConnectionString2 = string.Format("{0}={1}={2}", staConnectionString[3].Replace("\"", ""), staConnectionString[4], staConnectionString[5].Replace("\"", ""));
Database.Connection.ConnectionString = strConnectionString2;