|
sir i want to encrypt both the XML structure and the data that i'll pass in to it.
please give me a sample application, so that i can understand the encryption and decryption,
i've gone throwgh the msdn link, even then i request u for a better sample.
i new to this xml encryption and decryption method, Please help me...
thnx in advance,
prashanth
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
|
Why do you need the data encrypted? Unless you are storing sensitive data, you shouldn't need to encrypt the file.
If you are trying to make sure that no one has changed anything in the file, you can use Signed XML instead. Take a look at http://msdn2.microsoft.com/en-us/library/system.security.cryptography.xml.signedxml(VS.80).aspx[^] for more information.
The big disadvantage to encryption is that it becomes a real pain to debug.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hi, Mr.
thnx first,
i'll explain u why i need to Encrypt.
its just becoz in my widows application , where the backend db is XML..(which is tourchering me alot),
i've to Encrypt the XML File,(i've to ENCRYPT THE FILE AS SUCH) and decrypt at recieving end..
so, please help me with a C#, sample how to ENCRYPT AND DECRYPT A XMLFILE.
thnx and regards,
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
If you are using the XML as a backend database, you are going to run in to a lot of problems. You should really look at using an actual database engine for this. If you need something that is embedded in your application, look at SQL Server 2005 Compact Edition[^], which will give you an embedded database engine.
If you absolutely must use XML and encrypt the entire file, the easiest way will be to treat the XML as a string. You can then use any of the built-in encryption classes in the System.Security.Cryptography namespace.
Essentially, you would want to read the encrypted file from disk and decrypt it into a string, then use that string in the LoadXml method of an XmlDocument . Decrypting would be similar, but you would use the OuterXml property on the XmlDocument to get the XML as a string, encrypt that string and then write it to a file on disk.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
hi
I need the C# code for the following:
I am using windows OS.
1)How to get the details of a machine, if we know the machine name or IP address
Details include : BIOS version, boot time, name of user who has logged in, hard disk drive(size of each partition), model of the machine, CPU(processor details), OS Version, network cards, etc.
2)How to detect the softwares installed and their version. This means where the keys are added in the registry and how to get it back?
3)How to detect the various hardwares installed or plugged into a machine?
I know all these are related to Registry.
Please give a detailed reply, ASAP.
Thanks,
SYAMLAL
|
|
|
|
|
Hi,
1- For machine details U can get what ever information u need using WMI (Windows Management Instrumentation). For example if u want all information about the CPU here is the code :
string cpuInfo = String.Empty;
ManagementClass mc = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mc.GetInstances();
foreach (ManagementObject mo in moc)
{
if (cpuInfo == String.Empty)
{// only return cpuInfo from first CPU
IEnumerator enumer = mo.Properties.GetEnumerator();
while (enumer.MoveNext())
PropName = ((PropertyData)enumer.Current).Name;
PropValue =((PropertyData)enumer.Current).Value;
}
}
Of course u must add a reference to System.Management namespace in ure project.
Fore more information about WMI visit this link : http://aspalliance.com/629[^]
2/ To retieve installed software here some code :
public static void GetInstalledSofts()<br />
{<br />
string uninstallKey = @"Software\Microsoft\Windows\CurrentVersion\Uninstall";<br />
RegistryKey key = Registry.LocalMachine.OpenSubKey(uninstallKey);<br />
if (key == null)<br />
{<br />
System.Console.WriteLine("Unable to open registry key {0}.", uninstallKey);<br />
return;<br />
}<br />
<br />
ArrayList list = new ArrayList();<br />
string[] subkeyNames = key.GetSubKeyNames();<br />
foreach(string subkey in subkeyNames)<br />
{<br />
RegistryKey sk = key.OpenSubKey(subkey);<br />
string prodName;<br />
string uninstallString = (string)sk.GetValue("UninstallString");<br />
string displayVersion = (string)sk.GetValue("DisplayVersion");<br />
string productCode = string.Empty;<br />
<br />
if (subkey[0] == '{')<br />
{<br />
productCode = subkey;<br />
prodName = (string)sk.GetValue("DisplayName");<br />
if (prodName == null) prodName = string.Empty;<br />
}<br />
else <br />
{<br />
prodName = subkey;<br />
}<br />
<br />
}
3- Use WMI to list hardware
HTH
|
|
|
|
|
hi Hayder Marzouk,
Thanks for the help.
Let me check the details that u have given,
I will send mails in case any more help is needed,,
Once again , thanks
SYAMLAL
|
|
|
|
|
Dear All,
How to make sure that controls on the form do not change their location when Form scroll event occurs ? I am having a form and I drag and drop a textbox in it. I enable the scroll event of the form. Now when ever I scroll up/down the textbox control is changing its location i,e. its co-ordinates X and Y.
I am writing the following code snippet in the scroll event,
private void Form1_Scroll(object sender, ScrollEventArgs e)
{
textBox1.Text = textBox1.Location.ToString();
textBox2.Text = textBox2.Location.ToString();
textBox3.Text = textBox3.Location.ToString();
}
Please help me in solving this problem.
Thanx
|
|
|
|
|
Mr Perfect wrote: textBox1.Text = textBox1.Location.ToString();
textBox2.Text = textBox2.Location.ToString();
textBox3.Text = textBox3.Location.ToString();
Here you are not changing the position of the text box. You are just assigning the location to the text property. If you want that the text box should not move even when the scroll bar is scrolled, try to change the location of the text box in the same event. Please check the ScrollEventArgs for the new value of the scroll bar, using which you can change the location of the text boxes.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
I want the location of the textbox to remain same(fixed), whenever the scroll event occurs.
|
|
|
|
|
Hi,
I got your point already. You dont want the text boxes to be scrolled out of the screen. correct ? Thats why you will need to change the location of the text boxes according to the new values of the scroll bar. In this way your text boxes will appear as if "Fixed"
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hi,
Is it possible to change the priority of the message that is already exists in the Message Queue. Direct APIs are provided to set the priority while posting in to the MSMQ, But I couldn't find out the way to change the priority of the message that already exists in the queue.
Please help me out regarding this.
thanks,
Sree
|
|
|
|
|
Hello all,
I am using a vertical scroll bar. During the runtime, I want the form to be scrolled according to the scroll bar.
Thanks in advance.
Keshav Kamat
India
|
|
|
|
|
You might want to take a look at the AutoScroll property of the form itself as this provides the functionality you're looking for.
|
|
|
|
|
well thanks. i got it.
Keshav Kamat
India
|
|
|
|
|
i need a function like it sholud delete all special characters and spaces in the given name ony a to z and numbers 0 to 9 has to come plz help me out
suresh
Suresh.R
|
|
|
|
|
Hi,
Use the ToCharArray method of the string and check whether each of the characters is numeric, special character or something else... as simple as it sound to be.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Use a regular expression -- [a-z][0-9]
only two letters away from being an asset
|
|
|
|
|
Hello,
I'm trying to write a binary file stored in Access DB (an exe) and when I'm writing it I'm getting something like "binary binary binary..." before the real file content and therefore I'm having the file corrupted.
Please help.
|
|
|
|
|
Hi,
I think somewhere in ure code u are writing ToString() with the variable containing the binary data.
Post ure code to see what's wrong.
HTH.
|
|
|
|
|
Hi,
I am using VS 2003 and create a multi file assemble dll using csc /t:library /out:mydll /addmodule:M1.netmodule,M2.netmodule
the application works fine but I can not use in my IDE namespace.classname.memberfunction
to show what libaries and memeberfunctions(arguments) I can use in the dll like in a sigle file assembly. Anyway to get around with it?
Thanks
|
|
|
|
|
Hi,
Is there any possible way to format the column headings of Dataset in C#? Formatting in the sense, making the column headings as bold or setting the column width etc? Any help in this regard is greatly appreciated.
Thanks in advance.
Meeram395
|
|
|
|
|
raja_raman wrote: column headings as bold
I think you can set datagrid properties to do this
|
|
|
|
|
Hi Rajaraman
DataSet is a class, instance of DataSet just can hold values which is different from how you are going to display.
Massaging of look and feel is purely depends on the application type (Web, Windows or others)
In web application you can use styles and in win forms either by properties or overriding paint method of the controls.
M.Sendilkumar,Thomson,Bangalore,India
|
|
|
|