Skip to content

Zenika/encdec

Repository files navigation

encdec

Encrypt and Decrypt strings

___ (while technically different, I have a loose use of terms like encrypt-encode; I'm not pedantic, and aware that they are different; bear with me, please :-) )

Overview

How does it work

In its default mode, this tool will encrypt and decrypt any string you will pass as an argument.
With the `-f` parameter, you pass a source and destination filename, and it will AES-256 encode/decode the file.

String mode

Simple: `encdec {encode|decode} $STRING`
Where $STRING is the string to encode or decode. Note that the decoded string will be output to stdout.

File mode (requires the -f flag)

Also simple: `encdec {encode|decode} $FILENAME` You need to provide the full source pathname.

Private key

AES-256 needs a private key to encrypt and decrypt a file or string. There is a built-in key in the software that you can easily find browsing the source code.
I left it there for testing purposes, but for obvious security reasons, you should avoid using it.

If you want to use your own, the `-p` flag will prompt you eventually to provide your own key. You will need to safe-keep it somewhere, as there are no mechanisms to retreive it if lost. Also, note that the key _needs to be exactly 32bytes long_.

Build, Install

You can either build from source, or use the provided binary packages (Alpine, RedHat, Debian)

Source install

Once you've cloned the repo, go into the `src/` directory, and run `./upgrade_pkgs.sh` (about this, please note that package upgrades have not been tested beyond current versions, for obvious reasons).

After this step, you can run ./build.sh (providing an optional -o param with a target dir is available). This will build and copy the binary into /opt/bin

You might wish to strip the produced binary, as it still contains debugging code.

Binary packages

For now, I provide all the necessary scripts and files to build the RPM, DEB and APK packages, but all of these depend on my own build containers, which, for now, I do not provide. Maybe some other time, but not now as they depend way too heavily on my home architecture.

So, as an alternative, you can find the binary packages at https://github.com/jeanfrancoisgratton/encdec/releases