0

I have an Excel file that contains sensitive data that needs to be encoded before it's FTPd to it's final location but I'm not sure where to start. What I want to achieve is this:

  1. Open Excel file in C#
  2. Import data into DataSet/Reader
  3. Loop through each 'cell' and encode each value
  4. Create a new CSV file containing my encoded data

Opening the file and importing it into a dataset is easy enough (if having the data in a dataset is the correct way to do this) but I'm not sure how to loop through and encode each piece of information and then create a new file containing this.

Any ideas?

Thanks in advance, Brett

Brett
  • 1,923
  • 3
  • 18
  • 24

3 Answers3

1

I believe you mean encrypting rather than encoding.

Why do you want to encrypt every cell? The consumer of your file will then have to decrypt every cell. Using which process?

It looks like encryting the whole file is an easier/better option.

What's the purpose of this encryption?

If it's to protect it from external eyes during the FTP transfer, then use a secure transfer protocol/tool, such as SCP or SFTP, depending on what is supported by the server.

If it's to protect the file from people who have access to the FTP site, then yes, encrypt the file. And provide a way to your users to decrypt it.

Community
  • 1
  • 1
Serge Wautier
  • 21,494
  • 13
  • 69
  • 110
1

It might be much easier to use an external tool like GnuPG to encrypt your data:

$ echo "hello world" > private_file
$ gpg -c private_file
$ cat private_file.gpg
<binary gibberish>
$ rm private_file
$ gpg private_file.gpg
gpg: CAST5 encrypted data
gpg: encrypted with 1 passphrase
gpg: WARNING: message was not integrity protected
$ cat private_file
hello world
$

I just picked a symmetric key here because it is simple and easy.

If you intend on doing this operation often, it would be better to generate some keys for you and your recipients, so you can easily encrypt data to those specific people.

The Windows version of GnuPG might not be as friendly as you would like; http://www.pgp.com used to offer a really nice Windows program to do this, but I think they decided to set their sights higher and move away from simple easy tools into enterprise contraptions. Maybe their toolset still includes something easy...

sarnold
  • 102,305
  • 22
  • 181
  • 238
0

Is scp an option instead? That way you can leave the excel file as is.

Paul Whelan
  • 16,574
  • 12
  • 50
  • 83