Jump to content

Creating a password protected Zip file to store data files


Recommended Posts

Does any one have an idea on how to password encrypt an Excel file (or csv) in LabVIEW or zip up the excel file/csv and add a password to it that way? I need to be able to add a simple encryption to confidential patient data files after they are created and be able open them to read later by the same program.
 
I've tried using OpenG to add a password protection to a Zip file but when I try to add a string variable to the password connector it says password (none) so it makes me feel like I'm doing this wrong. 
 
I couldn't really find any similar documentation or tutorials on creating a csv or excel file then zipping up the file and adding a password to the zip with OpenG though I read about the function on the Labview forums.
 
A few other things over I've tried recently:
 
I think a solution would be to use some sort of property/ invoke node with ActiveX like I've attempted to do in the picture below but I can't find anything that explains exactly how property and invoke nodes work with ActiveX to achieve what I wanted, and I was hoping someone would have a tutorial that a LabVIEW beginner like me could use. 
Inline image 1
 
Something else that I looked at was adding a "blowfish" encryption to encrypt the data but seemed extremely complicated and all I need is a simple password encryption.
 
Finally I tried using an add on called AES crypto but I felt that the encryption methods that were featured in the add on were limiting. For patient names they would be at different lengths and in the example programs it showed that if a string was shorter than 128 bits then it would't be able to encrypt the string. Which is an issue if the patient has even a regular length name.
 
If you have any thoughts or find anything useful let me know.
 
Thanks, 
From a beginner
usmanf
Link to comment

4 hours ago, usmanf said:
Does any one have an idea on how to password encrypt an Excel file (or csv) in LabVIEW or zip up the excel file/csv and add a password to it that way? I need to be able to add a simple encryption to confidential patient data files after they are created and be able open them to read later by the same program.
 
I've tried using OpenG to add a password protection to a Zip file but when I try to add a string variable to the password connector it says password (none) so it makes me feel like I'm doing this wrong. 
 
....
Finally I tried using an add on called AES crypto but I felt that the encryption methods that were featured in the add on were limiting. For patient names they would be at different lengths and in the example programs it showed that if a string was shorter than 128 bits then it would't be able to encrypt the string. Which is an issue if the patient has even a regular length name.

Presumably there is an inverse of this function: https://forums.ni.com/t5/LabVIEW/Excel-ActiveX-password-encryption/td-p/3599665

 

I can't speak to the openG library specifically, but a typical pattern for labview front panel items is to indicate the default in parenthesis (hence the "error in (no error)" you see on most VIs). I would say in general that you should only follow this pattern if the default is unexpected, so a default of no password would not require an indication.

 

For the AES, you could pad the result although I dont know how that effects the strength https://en.wikipedia.org/wiki/Padding_(cryptography)

 

Link to comment

The (none) in parenthesis means simply that if you leave this input unconnected, that there will be no password applied. Theoretically you could also apply an empty password, which would result in an encrypted file but with a very week password key. In the OpenG library there is no difference in wiring nothing to the input and wiring an empty string to it. LabVIEW doesn't give the ability to distinguish between the two for subVIs with the normally available possibilities. Still I feel it is useful to indicate in the control label what the default value of a control does mean, especially since there is this possible ambiguity between using an empty password or none.

Simply wire your password to that input and then the specific file should be encrypted with this password and stored in the archive. Theoretically you can even use different passwords for each file but that will be problematic with most other ZIP archive viewers as they typically don't allow to enter different passwords for different files inside an archive.

Testing this would have cost you not more time than writing your post here. Simply connect a password to that input string and then try to open the ZIP file in some other ZIP utility (Windows explorer extension, WinZIP or my favorite 7-ZIP).

Edited by rolfk
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.