473,729 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I somehow password-protect pre-import CSV files?

I wrote a simple VB.NET application that imports and edits CSV files.

Now I’d like to “lock” the raw (pre-import) CSV files so these cannot be
opened separately. It is not high-sensitive data, I just don’t want folks to
peek in the files.

So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally opens
the imported CSV file would be perfect, but I can’t get it done. In fact it
seems difficult to password-protect a CSV file in any way.

The pre-import CSV’s are delivered as ZIP’s, so I thought about
password-protecting the ZIP files and importing and unzipping these within my
program, but this would seem much more challenging (if at all possible)
especially for an inexperienced programmer like me.

Any tips, pointers, ideas are highly appreciated. Thanks!
Feb 24 '07 #1
12 11088
one easy solution is to save as excel file, password protect it, delete csv
file. When you need the csv file, open the excel file and save as csv file.
"jonigr" <jo****@discuss ions.microsoft. comwrote in message
news:FB******** *************** ***********@mic rosoft.com...
>I wrote a simple VB.NET application that imports and edits CSV files.

Now I'd like to "lock" the raw (pre-import) CSV files so these cannot be
opened separately. It is not high-sensitive data, I just don't want folks
to
peek in the files.

So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally
opens
the imported CSV file would be perfect, but I can't get it done. In fact
it
seems difficult to password-protect a CSV file in any way.

The pre-import CSV's are delivered as ZIP's, so I thought about
password-protecting the ZIP files and importing and unzipping these within
my
program, but this would seem much more challenging (if at all possible)
especially for an inexperienced programmer like me.

Any tips, pointers, ideas are highly appreciated. Thanks!

Feb 25 '07 #2
Bill, that seemed a great idea but I just saved a 295 kB CSV file as a 1451
kB XLS file: it appears the filesize increases almost 5X. That's a serious
price to pay.

Appreciate your suggestion, but still open to others that may keep the
filesize in check. Thanks.

-joni

"Bill Voorhees" wrote:
one easy solution is to save as excel file, password protect it, delete csv
file. When you need the csv file, open the excel file and save as csv file.
"jonigr" <jo****@discuss ions.microsoft. comwrote in message
news:FB******** *************** ***********@mic rosoft.com...
I wrote a simple VB.NET application that imports and edits CSV files.

Now I'd like to "lock" the raw (pre-import) CSV files so these cannot be
opened separately. It is not high-sensitive data, I just don't want folks
to
peek in the files.

So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally
opens
the imported CSV file would be perfect, but I can't get it done. In fact
it
seems difficult to password-protect a CSV file in any way.

The pre-import CSV's are delivered as ZIP's, so I thought about
password-protecting the ZIP files and importing and unzipping these within
my
program, but this would seem much more challenging (if at all possible)
especially for an inexperienced programmer like me.

Any tips, pointers, ideas are highly appreciated. Thanks!


Feb 25 '07 #3
The reason that you cannot password protect a CSV file is because by
definition there is no place to store the password. It's a file of
"comma-separated values" for that to be recognized by any program one can't
arbitrarily declare a password is inside it somewhere.

You have two standard solutions. One is to create your own file format
which consists of a password field "plus" a csv file. Your app would know
where the password is and can check it and it would know the offset where
the CSV begins. Keep in mind that while this may stop the novice it
wouldn't stop anybody with relatively ordinary skills who might open the
file with say Notepad and notice a perfectly good CSV file a few bytes to
the right of something that looks like a password.

The other solution (as you mentioned) is to encrypt the file which would
stop most people as your app would the only one that could decrypt it. It
doesn't have to be time-consuming but obviously it would take some time.
Perhaps not much longer than it would to prompt the user for a password and
of course the users wouldn't stick the password on a post-it (tm) note on
their monitor.

"jonigr" <jo****@discuss ions.microsoft. comwrote in message
news:FB******** *************** ***********@mic rosoft.com...
>I wrote a simple VB.NET application that imports and edits CSV files.

Now I'd like to "lock" the raw (pre-import) CSV files so these cannot be
opened separately. It is not high-sensitive data, I just don't want folks
to
peek in the files.

So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally
opens
the imported CSV file would be perfect, but I can't get it done. In fact
it
seems difficult to password-protect a CSV file in any way.

The pre-import CSV's are delivered as ZIP's, so I thought about
password-protecting the ZIP files and importing and unzipping these within
my
program, but this would seem much more challenging (if at all possible)
especially for an inexperienced programmer like me.

Any tips, pointers, ideas are highly appreciated. Thanks!

Feb 25 '07 #4
Much obliged Tom, very clear advice.

The csv + password method is just below minimum indeed.

Any encryption method perhaps you could point me to that would fit the bill?:

- CSV files
- speed over (extreme) security
- decrypt in VB.NET
- not (much) filesize increase

Thanks very much!

-joni

"Tom Leylan" wrote:
The reason that you cannot password protect a CSV file is because by
definition there is no place to store the password. It's a file of
"comma-separated values" for that to be recognized by any program one can't
arbitrarily declare a password is inside it somewhere.

You have two standard solutions. One is to create your own file format
which consists of a password field "plus" a csv file. Your app would know
where the password is and can check it and it would know the offset where
the CSV begins. Keep in mind that while this may stop the novice it
wouldn't stop anybody with relatively ordinary skills who might open the
file with say Notepad and notice a perfectly good CSV file a few bytes to
the right of something that looks like a password.

The other solution (as you mentioned) is to encrypt the file which would
stop most people as your app would the only one that could decrypt it. It
doesn't have to be time-consuming but obviously it would take some time.
Perhaps not much longer than it would to prompt the user for a password and
of course the users wouldn't stick the password on a post-it (tm) note on
their monitor.

"jonigr" <jo****@discuss ions.microsoft. comwrote in message
news:FB******** *************** ***********@mic rosoft.com...
I wrote a simple VB.NET application that imports and edits CSV files.

Now I'd like to "lock" the raw (pre-import) CSV files so these cannot be
opened separately. It is not high-sensitive data, I just don't want folks
to
peek in the files.

So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally
opens
the imported CSV file would be perfect, but I can't get it done. In fact
it
seems difficult to password-protect a CSV file in any way.

The pre-import CSV's are delivered as ZIP's, so I thought about
password-protecting the ZIP files and importing and unzipping these within
my
program, but this would seem much more challenging (if at all possible)
especially for an inexperienced programmer like me.

Any tips, pointers, ideas are highly appreciated. Thanks!


Feb 25 '07 #5
I'm not an expert on this stuff but you can check the
System.Security .Cryptography Namespace. You may prefer a symmetric
algorithm so you can encrypt/decrypt without a lot of fuss.

That said you can also just obscure the data by encoding it in Base64.
There are methods in the Convert Class you can use. It should be fast and
while somebody might recognize it as Base64 encoding the average user
probably wouldn't. I tried it out and successfully read a CSV, converted to
Base64 and wrote it out to a new file then read that file back in and wrote
out a standard CSV again. Whichever method you choose you would do well to
search the Internet as there are dozens of examples and a few complete
implementations that you could just download and use.

Personally I wouldn't get too concerned over the speed until it is
demonstrated to actually take too long. That might happen but if the
slowest encryption method (with the highest security) isn't noticeable on
the file sizes you have then any of the faster algorithms would obviously be
fine.

Hope this helps.

"jonigr" <jo****@discuss ions.microsoft. comwrote in message
news:65******** *************** ***********@mic rosoft.com...
Much obliged Tom, very clear advice.

The csv + password method is just below minimum indeed.

Any encryption method perhaps you could point me to that would fit the
bill?:

- CSV files
- speed over (extreme) security
- decrypt in VB.NET
- not (much) filesize increase

Thanks very much!

-joni

"Tom Leylan" wrote:
>The reason that you cannot password protect a CSV file is because by
definition there is no place to store the password. It's a file of
"comma-separated values" for that to be recognized by any program one
can't
arbitrarily declare a password is inside it somewhere.

You have two standard solutions. One is to create your own file format
which consists of a password field "plus" a csv file. Your app would
know
where the password is and can check it and it would know the offset where
the CSV begins. Keep in mind that while this may stop the novice it
wouldn't stop anybody with relatively ordinary skills who might open the
file with say Notepad and notice a perfectly good CSV file a few bytes to
the right of something that looks like a password.

The other solution (as you mentioned) is to encrypt the file which would
stop most people as your app would the only one that could decrypt it.
It
doesn't have to be time-consuming but obviously it would take some time.
Perhaps not much longer than it would to prompt the user for a password
and
of course the users wouldn't stick the password on a post-it (tm) note on
their monitor.

"jonigr" <jo****@discuss ions.microsoft. comwrote in message
news:FB******* *************** ************@mi crosoft.com...
>I wrote a simple VB.NET application that imports and edits CSV files.

Now I'd like to "lock" the raw (pre-import) CSV files so these cannot
be
opened separately. It is not high-sensitive data, I just don't want
folks
to
peek in the files.

So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally
opens
the imported CSV file would be perfect, but I can't get it done. In
fact
it
seems difficult to password-protect a CSV file in any way.

The pre-import CSV's are delivered as ZIP's, so I thought about
password-protecting the ZIP files and importing and unzipping these
within
my
program, but this would seem much more challenging (if at all possible)
especially for an inexperienced programmer like me.

Any tips, pointers, ideas are highly appreciated. Thanks!



Feb 25 '07 #6
Hello jonigr,
Now I’d like to “lock” the raw (pre-import) CSV files so these cannot be
opened separately. It is not high-sensitive data, I just don’t want folks to
peek in the files.
You could ZIP them. ZIP archives also support password protection.
The pre-import CSV’s are delivered as ZIP’s, so I thought about
password-protecting the ZIP files and importing and unzipping these within my
program, but this would seem much more challenging (if at all possible)
especially for an inexperienced programmer like me.
The easy solution would be to call a DOS ZIP archiver (via Shell
function) and provide the required data (File name, archive name, password).

Best regards,

Martin
Feb 25 '07 #7
jonigr,
The pre-import CSV’s are delivered as ZIP’s, so I thought about
password-protecting the ZIP files and importing and unzipping these within
my
Have you considered a .NET 3.0 "Package"? Aka an Office 2007 .xlsx file?

http://msdn.microsoft.com/msdnmag/is...s/default.aspx

http://msdn2.microsoft.com/en-us/lib...packaging.aspx

http://www.microsoft.com/downloads/d...displaylang=en
..NET 3.0 & Office 2007 are adopting the "Package" as a standard file format.
What is a "Package" you ask? Its little more then a specifically formatted
Zip file. In other words its a zip file that contains a specific structure &
some specific files. Office 2007 files are packages (zip files) that contain
XML documents.

What is .NET 3.0 you ask? .NET 3.0 is a full superset of .NET 2.0 that is
included with Windows Vista. .NET 2.0 programs run unaffected as .NET 3.0
adds new namespaces & types to existing .NET 2.0 installations.
I was under the impression, but have not verified it, that you can use the
System.IO.Packa ging namespace to open a plain ZIP file. Something that I
will try this morning & report back on. If System.IO.Packa ging cannot read
plain zip files, you should be able to use this converter to save the xls as
an xlsx file:

http://www.microsoft.com/downloads/d...displaylang=en
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"jonigr" <jo****@discuss ions.microsoft. comwrote in message
news:FB******** *************** ***********@mic rosoft.com...
>I wrote a simple VB.NET application that imports and edits CSV files.

Now I’d like to “lock” the raw (pre-import) CSV files so these cannot be
opened separately. It is not high-sensitive data, I just don’t want folks
to
peek in the files.

So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally
opens
the imported CSV file would be perfect, but I can’t get it done. In fact
it
seems difficult to password-protect a CSV file in any way.

The pre-import CSV’s are delivered as ZIP’s, so I thought about
password-protecting the ZIP files and importing and unzipping these within
my
program, but this would seem much more challenging (if at all possible)
especially for an inexperienced programmer like me.

Any tips, pointers, ideas are highly appreciated. Thanks!
Feb 25 '07 #8
=?Utf-8?B?am9uaWdy?= <jo****@discuss ions.microsoft. comwrote in
news:FB******** *************** ***********@mic rosoft.com:
So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally
opens the imported CSV file would be perfect, but I can Tt get it
done. In fact it seems difficult to password-protect a CSV file in any
way.
CSVs have no password protection so you'll need to implement some sort of
security layer.

How about zipping the file with a password. Unzip to read?

You can use something like SharpZipLib to compress (very easy to use).
Feb 25 '07 #9
Allow me to address all great advice in this one post.

In following the various leads I found KB article 301070 using
System.Security .Cryptography Namespace that Tom mentioned and has code ready.
I honestly didn't go in-depth but the fast encrypted file looks like absolute
total garbage. Great! More than enough to scare the hell out of my average
user, never mind the pro hackers.

I will look into the ZIP possibilities suggested, this could be an
alternative.

Jay, thanks for mentioning the "Package" format, totally new to me.

Thank y'all, this is a very helpful group. I mark this one as solved.

-joni

"Spam Catcher" wrote:
=?Utf-8?B?am9uaWdy?= <jo****@discuss ions.microsoft. comwrote in
news:FB******** *************** ***********@mic rosoft.com:
So time-consuming encryption is not necessary, just a simple
password-to-open that I can program in my application so it internally
opens the imported CSV file would be perfect, but I canƒ Tt get it
done. In fact it seems difficult to password-protect a CSV file in any
way.

CSVs have no password protection so you'll need to implement some sort of
security layer.

How about zipping the file with a password. Unzip to read?

You can use something like SharpZipLib to compress (very easy to use).
Feb 25 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3709
by: John Victor | last post by:
In my mysql database, I've stored all the passwords using the PASSWORD() function. Now I'm running a test and need to compare the password in my php document to that saved in the database. I used the string "Select name From users Where password = PASSWORD('$testPass')" and ran mysql_query() using the string. But nothing was returned. So I decided to run a test and try to change a password from my php page using the string
5
4309
by: MLH | last post by:
I'm supposed to set a password for the MySQL root user. The output of mysql_install_db instructed me to run the following commands... /usr/bin/mysqladmin -u root -h appserver password mynwewpasswd I did. It did not work. Here's the error: /usr/bin/mysqladmin: connect to server at 'appserver' failed error: 'Host 'appserver.crci.com' is not allowed to connect to this MySQL server' Another command I'm supposed to run also resulted in an...
1
2180
by: PerryC | last post by:
All, This should be very simple for you VB programmers, I am just a beginner and am stuck! It should be very simple... what am I not doing right? Dim PW As String PW = Me.Password If PasswordVerify <> Password Or IsNull(PasswordVerify = True)
4
18962
by: Neil Ginsberg | last post by:
I have ODBC linked tables to a SQL 7 database in an A2K database. The linked tables do not have the password stored in them, so the first time the user accesses them, they need to enter the SQL password. I am developing a process that will automatically run at night which will access those tables. I need to be able to give Access the password, as the user currently does, so that the process can run without a password prompt appearing....
2
6009
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database, and the linked tables are successfully created. I use the data from these linked tables in several forms. All works great until I close the Access frontend and open it again. When I try to use the forms, I get an error message: "Could not...
10
9883
by: Fabrizio | last post by:
(Sorry for the crosspost, but I really don't know which is the right newsgroup!) Hi all, I try to change the password to a user that as to change the password at first logon: try {
5
16926
by: scorpion53061 | last post by:
is it possible to set the database password that you can set in access for a database from a vb.net application?
8
3312
by: Katash | last post by:
Hello, I am new to PHP and am working on a login system for my site, currently supplied passwords are passed to MySQL and stored as md5 hashes, my question is :- seeing as md5 is 1 way only what would be the best way to implement a 'Forgotten Password' system whereby the user supplies an e-mail address and the password is mailed to the user? The process does not require military level security but I would like to keep stored passwords...
3
11371
by: julianmoors | last post by:
Hey, Currently I'm writing a VB.NET/1.1 app and I need to mask the input for the password field. Does anyone know how to do this in VB? I've seen a C# example, but wouldn't know how to convert it myself. Here's the URL: http://www.codeproject.com/dotnet/ConsolePasswordInput.asp
2
3202
by: DarthPeePee | last post by:
Hello everyone. I am working on a Password Strength Meter and I am running into 1 problem that I would like to fix. When pressing the "Clear Password & Try Again" button, the password clears out of the text box, but the meter will stay at its current position until text is entered back into the textbox. Once text is re-entered, the meter will display the results again. I would like everything to reset when the button is pushed, but I...
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8761
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9281
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.