Tar and Password Protect in ubuntu core

Is there any possible way to Zip and encrypt a file , I am creating a snap which take source file name as input and compress the file with password protection and save to a particular location. Any help ?

I tried Tar |openssl , Its not working.
I treid gpg , but i am not able to figure out that why gpg-agent is not found.

ship ccrypt in your snap via stage-packages:, then you should be able to use something like:

tar cjvf - /dir/you/want/to/compress | ccrypt -k $SNAP_DATA/passkey > encrypted.tar.bz2.cpt

to encrypt it with the passkey you stored in /var/snap/<snapname>/current/passkey

1 Like

Maybe use zip encryption (if there’s any implementation available)?