bash script to encrypt data using a users ssh public key https://sshenc.sh
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.3KB

2 years ago
8 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # ![sshenc.sh](logo.png)
  2. **bash script to encrypt data using a users ssh public key**
  3. 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:
  4. ```
  5. bash <(curl -s https://sshenc.sh/sshenc.sh) -s ~/.ssh/id_rsa < file-containing-the-encrypted-text.txt
  6. ```
  7. sshenc.sh uses openssl under the hood, so you need to have that installed in your path to make it work.
  8. ## Install
  9. ```
  10. curl -O https://sshenc.sh/sshenc.sh
  11. chmod +x sshenc.sh
  12. ```
  13. ## Examples
  14. ### encrypt a file using your own ssh public key
  15. ```
  16. sshenc.sh -p ~/.ssh/id_rsa.pub < plain-text-file.txt > encrypted.txt
  17. ```
  18. ### encrypt a file using multiple recipients (broadcast encryption)
  19. ```
  20. sshenc.sh -p ~/.ssh/id_rsa.pub -p id_rsa-alice.pub -p id_rsa-bob.pub < plain-text-file.txt > encrypted.txt
  21. ```
  22. ### encrypt a file using the public key of a github user
  23. ```
  24. sshenc.sh -p <(curl -sf "https://github.com/S2-.keys" | grep ssh-rsa | tail -n1) < plain-text-file.txt
  25. ```
  26. this line fetches the first public key for the github user S2- and encrypts the file plain-text-file.txt using this key.
  27. ### decrypt a file
  28. ```
  29. sshenc.sh -s ~/.ssh/id_rsa < encrypted.txt
  30. ```
  31. ## License
  32. [MIT](https://opensource.org/licenses/MIT)