Secure Web Service with C# DataSource
-
Hi, I have a webservice serving a dataset with several tables. Every table has two main webmethods that allows then to interact with the databound controls in the client. The general form of these methods are (please, its just a sample code to give the idea of the process):
[WebMethod] public MyDataSet.MyTableDataTable MyTableGetAll() { MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter(); return vTa.GetAll(); } [WebMethod] public int MyTableUpdate(MyDataSet.MyTableDataTable pDt) { MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter(); return vTa.Update(pDt); }
They work just perfect and I can use any databound control as if the dataset was local. But how can I add encryptation to this solution without losing the bahavior of the conection. I know how to send encrypt data via RSA keys thru a webservice but only with basic datatypes (as string or itegers) and even encrypt a content of a XML message. But how can I encrypt the data and the metadata structure (cause it would be terrible to encypt the data and give up the table structure in the resulting XML) and retrieve the DataTable object funcionality at the client side and vice-versa? The following solution works?// Server side [WebMethod] public {XML or String} MyTableGetAll() { MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter(); return **SomeEncryptFunction**(vTa.GetAll()); } // Client side public localhost.MyDataSet.MyTableDataTable GetMyTableData() { localhost.WebService vSvc = new localhost.WebService(); return **SomeDecryptFunction**(vSvc.MyTableGetAll()); } // Some Other place in the Client Side ... oDataBoundObject.DataSource = GetMyTableData(); ...
If It does what would be the code for SomeEncryptFunction and SomeDecryptFunction (the second one is the most important 'cause it has to retreive the DataTable object properly) ? Thanks in advance for any help about this. Sir Gallahad P.S. I've been reading about implementint security and cryptograpy to web services with WSE SOAP headers. But the articles I've read does not explain well how to code in the client and server side to make the handshake between them. If that is the solution, can someone help me explaining how to do that. Please any clue. Any code. Any link. Please. :confused: