Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Encryption Decryption , +
I have been trying to make a program in c# to password protect a file so nobody can open the file if it has been encrypted by password. User will encrypt the file with password.
 
Lets take an example, user encrypted an excel file with password as 123456 using C#. My requirement is when the user open the excel it will popup for the password if user enters the correct password, it will decrypt and show the excel data.
 
My questions is how the file
 
What I want to do is that after password protecting the file(excel, pdf,txt etc..), whenever somebody click to open the file, it will ask him for the password. After entering correct password decrypt the files.
 

Note: I am able to do encryption and decryption in c#, but in this case decryption has to happen at file.
Posted 24-Feb-13 21:31pm
Comments
Shubh Agrahari at 25-Feb-13 3:02am
   
something you worked on this...??
Member 7911797 at 25-Feb-13 3:51am
   
In the above links decryption is also happening in c# code. My requirement is encrypt file with password and send it to user.User don'h have any windows or web application, we are sending output files through mail or shared folder. When user opens the file(eg. excel) it will prompt for password, when he enter correct password it ha to decrypt and show the file. Here decryption has to happen at file level.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

there is some links that may help for your this task....
 

Encrypt/Decrypt File or String[^]
 
Encrypt and Decrypt Data with C#[^]
 
Simple encrypting and decrypting data in C#[^]
 
how to create password encrypt decrypt in c#[^]
 
hope will get any idea by these....
 

happy to help...
  Permalink  
Comments
Member 7911797 at 25-Feb-13 3:45am
   
In the above links decryption is also happening in c# code. My requirement is encrypt file with password and send it to user.User don'h have any windows or web application, we are sending output files through mail or shared folder. When user opens the file(eg. excel) it will prompt for password, when he enter correct password it ha to decrypt and show the file. Here decryption has to happen at file level.
Shubh Agrahari at 25-Feb-13 3:50am
   
dude this is possible with a specific programming platform without any platform how we integrate that requirement with file......why you are not using file security tools that could help you better.....
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Are you talking about putting a password into Excel/Word type of file? Then you might need to use Macro for that purposes. Currently I'm working on something similar but I stuck at certain point & perhaps someone from here can help me on that...refer here :
Disable Save functionality in Excel with VBA through C#[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 504
1 Maciej Los 349
2 Kornfeld Eliyahu Peter 325
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 14 May 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100