public string GetEncryptedSetting(string name, byte[] optionalEntropy) { string base64 = (string) GetSettingFromRegistry(name); byte[] protectedBytes = Convert.FromBase64String(base64); byte[] valueBytes = ProtectedData.Unprotect(protectedBytes, optionalEntropy, DataProtectionScope.LocalMachine); return UnicodeEncoding.Default.GetString(valueBytes); }