ISecureDataConverter Interface
Encrypts and decrypts any critical string data.
Namespace: DevExpress.DataAccess
Assembly: DevExpress.Data.v24.2.dll
NuGet Package: DevExpress.Data
#Declaration
#Remarks
The ISecureDataConverter
service is designed to keep any string data that’s serialized and passed between the client and server in DevExpress Reporting and Dashboard applications safe and secure.
Note
To ensure security when a Reporting or Dashboard application retrieves data from a data source that does not match any DevExpress data source type or its descendants, implement IData
#Example
The following code example implements the ISecureDataConverter
service to store connections in an XML file.
using evExpress.DataAccess;
using System;
using System.Linq;
using System.Xml.Linq;
// ...
public class CustomSecureDataConverter : ISecureDataConverter {
const string URI = @"E:\Temp\Connections.xml";
const string XML_CONNECTION = "Connection";
const string XML_ID = "Id";
static XDocument document;
static object lockObj = new object();
static CustomSecureDataConverter() {
document = XDocument.Load(URI);
}
public string Protect(string entity) {
var id = Guid.NewGuid().ToString();
lock (lockObj)
document.Root.Add(new XElement(XML_CONNECTION, new XAttribute(XML_ID, id), entity));
return id;
}
public string Unprotect(string protectedEntity) {
return document.Root.Elements(XML_CONNECTION)
.First(x => x.Attribute(XML_ID).Value == protectedEntity)
.Value;
}
}
Register a custom Data Converter implementation at application startup. ASP.NET Web Forms or MVC applications allow you to use the DefaultReportDesignerContainer.RegisterSecureDataConverter<T> method.