Click here to Skip to main content
15,908,834 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a asp.net C# program for create a file with my on extension (ie. like filename.ek), and wright some text data to that file. The important thing is, only my application can read the data inside that file. i.e i need to write the data to the file with digital sign. Please give the c# code...
Posted
Updated 13-Aug-13 16:54pm
v2
Comments
Sergey Alexandrovich Kryukov 31-Jul-13 23:33pm    
"Digital signature" means that one can read the data with a public key (that means, practically anyone can read it), but no one except you (who created the key pair) can modify this file the way it could be faked. Is that what you need?
Now, what should be the role of ASP.NET? What should happen on client and what on server side? what's the direction of delivering this file? Where "your application" should reside? What's the whole scenario? Ultimate goals of this project?
Without answering all these questions, your question wouldn't really make sense.
—SA
Elk Cloner 1-Aug-13 9:50am    
Yes, This is my need. i need C# Code. My current project is in ASP.Net, that is why i say like that. My Requirement is, i have a DataTable of some value i need to flesh that data to a file. but no one can able read that file . Using my Web aplication i need to read that file back. You can give C# Code in Windows application too.

Please see my comment to the question.

In the meanwhile, you can probably figure out it all by yourself. It will be easy enough if you learn the concept of public-key cryptography system and related digital signature:
http://en.wikipedia.org/wiki/Public-key_cryptography[^],
http://en.wikipedia.org/wiki/Digital_signature[^].

There is a whole family of the algorithms used for the public-key cryptography, known under the umbrella term of asymmetric cryptographic algorithms.

See also, in particular:
http://en.wikipedia.org/wiki/RSA_%28algorithm%29[^],
http://en.wikipedia.org/wiki/Digital_Signature_Algorithm[^] ],
http://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm[^].

As to the implementation of required algorithms, everything is already provided in the .NET BCL for you. Please see:
http://msdn.microsoft.com/en-us/library/system.security.cryptography.asymmetricalgorithm.aspx[^].

—SA
 
Share this answer
 
v4
Comments
Dholakiya Ankit 31-Jul-13 23:44pm    
5ed
Sergey Alexandrovich Kryukov 31-Jul-13 23:45pm    
Thank you, Ankit.
—SA
There could be another view of the problem. It seems that you don't want other to see the data present in your file. One solution could be to use encryption in your program. You encrypt the data in the file while you write it and since its encrypted so no one could see it.

For encryption you can use below links

http://social.msdn.microsoft.com/Forums/vstudio/en-US/d6a2836a-d587-4068-8630-94f4fb2a2aeb/encrypt-and-decrypt-a-string-in-c[^]

http://en.wikipedia.org/wiki/Encryption[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900