Can I zip a file using strong passphrase (AES 256 Encryption) using Mule 4? - mule

I have a requirement for zipping an xml file using Strong passphrase with AES 256 Encryption so that outside world can not be able to decrypt that file.
I have seen some java api component is there to achive this .
But my Question is using Mule 4 is there any way to achieve this?
I am unable to find any mule 4 component does this same thing.
Input will be -- xml file
output will be -- zip file ( with password protected, AES 256 Encryption)

MuleSoft provides a Compression Module that can create zip files but it doesn't seem to support encrypting files.
A solution is to implement it in Java code using some library. I recommend to create a Mule Module for easier reusing in Mule applications.

Related

How can we read files from samba server in mule?

I want to read some files from samba server, it looks like smb protocol is not one of the supported protocols by mule components like ftp, sftp etc.. So can anyone share some ideas including example implementation for doing this? Let us assume we want to read a csv file and save it to payload so that it can be used to pass to weave transform component.
Typically, you would mount the share via the operating system and then start the Mule Runtime process in the context of a user/grp that has the proper permissions to rw.

Using Mule, how to create a password-protected .csv file that can be opened with a standard tool?

I have been asked to create a password-protected .csv file. This would be similar to password protecting in Excel or Word.
An option I suppose would be to create a password-protected .zip of the .csv file. On the recipient's end, they need to open the file using a standard tool like zip/7zip/Excel/etc., where they supply a password.
Is there a straightforward way to do this in Mule?
One option would be to use Apache POI to output the encrypted Excel file from a custom Mule component (either a Java, Scripted or MEL component).
See: Encryption in Apache POI

Export file from NetSuite's FileCabinet to FTP

File resides in the NetSuite file cabinet and needs to be placed on an FTP server each day.
I'm not sure how to handle this via Suitelet/RESTlet, or if it's possible - but would prefer to not use an external source/application.
My current and hopefully temporary workaround is a local scheduled task to run a script to pull files from NetSuite & upload to the FTP.
In SuiteScript 2.0, although unsecured FTP is still not support, but SS2.0 has the capability to do SFTP. See http://www.upilioconsulting.com/blog/netsuite-2016-2-sftp-suitescript-2-0/
In SuiteScript 1.0, it's not supported. The workaround is that you'll need to write a middleware code (i.e. in PHP) and let the middleware do the FTP transfer.
Netsuite doesn't interact with FTP.
You need a bridge server of some sort that runs a web app (full blown Apache or nginx running PHP or just a simple Node service)
Just get a server and install some web server/web service and POST your files to it (nlapiRequestURL with a Scheduled script). Have the web app on the bridge server send the files to the FTP server. If you are using Netsuite you can afford the cost of the bridge server.
One possible solution is to create a saved search on the Documents to list out all the files in Netsuite filtering by createdate or lastmodifieddate. Create a scheduler to fetch only the new files and save them locally where you want.
Note all the files will be in base64 encoded string format, you need to decode again to obtain the file.
As bknights said NetSuite doesn't support FTP. You need a web server(any server side language can do for that matter, I have written one in Node.js), to receive the files.
The file content for text file will be in Text format, so, no decode logic required for text files. However, binary/pdf/image and other would be in base64 format, as NetSuite's JS has no way of handling binary data. So, make sure you decode it before you create the file on your FTP Server.

How to encrypt files in RTC source control

I have files which I want to encrypt and store in RTC source control. Do the files need to be encrypted using an external program or does RTC / RTC source control support encrypting files within the stream ?
This thread summarizes the current situation regarding file encryption in RTC:
You would need to raise an enhancement request if you wanted this handled by RTC.
There are some other options that might help.
The underlying database should have security mechanisms to encrypt data - it is worth looking at that.
Next, you could also encrypt the disk the data is stored on (for example, I have worked with a customer that used BitLocker - part of Windows Server - to encrypt the disk RTC and the database runs on).
It is worth asking more questions about the request. For example - who are they trying to conceal the source code from?
So using an external program for file encryption would still be required with the current versions of RTC (4.x).

Best way to encrypt a file, and keep it handy

I am using dozens of different web services, and I keep a password file in a remote Linux machine. The file contains my usernames, passwords and answers for security question.
This server happens to be offline to often, and I'm looking for a way to keep the password file on my own computer, or on a service like DropBox. Obviously, I want to keep the file encrypted, but handy - I want to be able to print its contents using one shell (or cygwin) command, perhaps using a passphrase.
Any good ideas how to do it?
You can use GPG's symmetric option to encrypt files with pass-phrases.
gpg --symmetric filename
That will result in an encrypted file named filename.gpg. To redirect the output to STDOUT instead of a .gpg file:
gpg --symmetric -o - filename
You can later decrypt the file with:
gpg --decrypt filename.gpg
I use PasswordSafe encrypted files in exactly this configuration. GUIs are available for Windows/Mac/Unix/Java. cliPSafe gives it a command line interface.
THe original code was written by Bruce Schneier, well known in the security world, but I've never used cliPSafe.
As already noted GPG solves the problem. Using the gpg command directly for encrypting text files may be a bit cumbersome though, especially as you would often decrypt the file to a seperate file, add some text (passwords in this case) and the reencrypt it (which will possibly expose your unencrypted data).
Vim has a very good plugin called gnupg for trasparently handling encrypted files using GPG. Using this plugin the unencrypted data will never be written to disc and you can just treat it as any other file (except for the passphrase question popping up of course).