bash script to encrypt data using a users ssh public key https://sshenc.sh
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
s2 c3ebbbfa06 add sshenc-pre1.1.1.sh to tests hace 2 semanas
tests add sshenc-pre1.1.1.sh to tests hace 2 semanas
README.md openssl 1.1.1 - this introduces not backward compatible changes :( hace 2 semanas
index.html don't use `fetch`, so google maybe can render the page hace 10 meses
logo.png resize logo hace 9 meses
main.css add readme hace 11 meses
sshenc-pre1.1.1.sh openssl 1.1.1 - this introduces not backward compatible changes :( hace 2 semanas
sshenc.sh use pbkdf2 since it is available in new versions of openssl hace 2 semanas

README.md

sshenc.sh

bash script to encrypt data using a users ssh public key

If you received a message from someone that was encrypted with this script, you can decrypt it with your ssh private key using the following command without installing anything:

bash <(curl -s https://sshenc.sh/sshenc.sh) -s ~/.ssh/id_rsa < file-containing-the-encrypted-text.txt

sshenc.sh uses openssl under the hood, so you need to have that installed in your path to make it work.

Install

curl -O https://sshenc.sh/sshenc.sh
chmod +x sshenc.sh

Examples

encrypt a file using your own ssh public key

sshenc.sh -p ~/.ssh/id_rsa.pub < plain-text-file.txt > encrypted.txt

encrypt a file using multiple recipients (broadcast encryption)

sshenc.sh -p ~/.ssh/id_rsa.pub -p id_rsa-alice.pub -p id_rsa-bob.pub < plain-text-file.txt > encrypted.txt

encrypt a file using the public key of a github user

sshenc.sh -p <(curl -sf "https://github.com/S2-.keys" | grep ssh-rsa | tail -n1) < plain-text-file.txt

this line fetches the first public key for the github user S2- and encrypts the file plain-text-file.txt using this key.

decrypt a file

sshenc.sh -s ~/.ssh/id_rsa < encrypted.txt

Notes

OpenSSL 1.1.1 introduced a not backwards compatible change: the default digest to create a key from the passphrase changed from md5 to sha-256.
Also, a new -iter parameter to explicitly specify a given number of iterations on the password in deriving the encryption key was added.
Before OpenSSL 1.1.1 this option was not available.
Since the new parameters are more secure, sshenc.sh changed to adopt them, so since 2019-11-26, files encrypted with a previous version of sshenc.sh will not decrypt.
To do so, use the prevous sshenc.sh script, located at https://sshenc.sh/sshenc-pre1.1.1.sh.

License

MIT