Steve Chapman
Steve Chapman

Reputation: 1317

Encrypting contents of a file when uploading

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.

Upvotes: 0

Views: 2373

Answers (4)

Ely
Ely

Reputation: 3240

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.

Upvotes: 3

Sadegh
Sadegh

Reputation: 6854

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

Upvotes: 0

Johan Öbrink
Johan Öbrink

Reputation: 1291

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.

Upvotes: 0

Francis
Francis

Reputation: 12008

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.

Upvotes: 0

Related Questions