file encryption

I have this workflow that’s extracting and processing some data, which is then exported to xls that should be sent over email. The process contains a loop, so it generates hundreds of files and they need to be separately sent to different receivers. This I got covered.

Problem is I should be encrypting this data that I’m sending with a password. Is there any way of doing that so that I don’t have to involve xls macros into the equation?

Hello @lucian.cristian -

I’m not aware of a KNIME node that will do this neatly - although I am happy to be shown otherwise! It may be possible to do it using the External Tool node. Here I’m thinking you could call another program, like 7zip, in which you would compress your files, encrypt them, and add a password using a single command. (Example: How to encrypt txt files with AES256 via Windows 7z command line? - Super User)

Here’s an example workflow I modified to use the External Tool node to perform some image processing using a third-party program. I had to wrap the External Tool inside some Try/Catch nodes for it to work properly. You can see how this was done inside the “Call ImageMagick” metanode.

Maybe this will help? I know it’s not straightforward, but if you’ve already got a working loop built to send emails, maybe this won’t be too much trouble to implement.

2 Likes

Hi @lucian.cristian,

I use KNIME for a similar use case. I encrypt files with GnuPG from within KNIME via the Bash node (Community Extension NGS). In the Bash command you need

gpg.exe --output "C:\yourfile.xlsx" -d "C:\yourfile.xlsx.gpg",

whereas the execution directory points to the bin folder of your GnuPG installation.

If you are new to pgp-encryption, please make sure to read https://en.wikipedia.org/wiki/Pretty_Good_Privacy, because it doesn’t work like encrypting a zip-file with a password.

Kind regards
agaunt

4 Likes

that’s awesome, but somehow i can’t get it to work. I checked the commandline in cmd and it works, but when I try to run it in knime I get image .

Here’s how what I did inside the node. Can you figure out what I’m doing wrong?

It’s hard to know, since the External Tool node is definitely finicky. That said…

In your Commandline Arguments, where you list 7z a -tzip bla4.zip bla.txt, I don’t think that first 7z should be there (that is, 7z is not a valid argument when invoking 7z.exe).

If you’re still having trouble, I would definitely try @agaunt 's suggestion about the Bash node, since it will probably be more straightforward.

Yup. I used the cmdwinput node and it worked like a charm!

Thanks! @ScottF and @agaunt

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.