views:

369

answers:

4

Hi,

Am using asp.net's FileUpload control to upload a word file to the server. I want to encrypt the contents of this file (using our custom encryption API) and then save it in the server. How do i achieve this?what should be my approach?

Thanks.

A: 

if you have your own custom encryption API, you should use it to encrypt in a temporary file and then upload the temporary encrypted result, and delete it after upload complete.

Francis
A: 

The FileUpload control gives you a handle to the file. Read the data from the file stream, encrypt it and write it to a FileStream. If the encryption process is CPU intensive and/or takes a lot of time, save the file in a temp directory and start a new thread that reads the file, encrypts its contents, saves it to a new file and deletes the temp file.

Johan Öbrink
A: 

maybe u should write your own encryptor as an app and then decrypt that file on the server this article could help u : file encrypt / decrypt

Adinochestva
+3  A: 

Whatever you do on the server side, do realize that while the data is transfering over the wire, it will not be encrypted with your custom api. You will need to upload the file using an ssl connection in order ensure the data transfer is secure.

Ely