Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

[Bash] Simple gnupg Message Encrypter

Prerequisites:

Debian GNU/Linux
Recent Debian versions come with GnuPG already installed.

Windows
GnuPG's site has an installer called Gpg4win. I'd recommend this because it's the stable version of the software.
You can find the checksum on the website.

Mac
Install via brew:
Code
brew update && brew install gnupg

Source:
Code
#!/bin/bash
echo -n "Enter Email of Recipient: "
    read email
echo -n "Output File Name: "
    read file
    if [[ -e $file.asc ]]; then
        echo "File Exists"
        exit 1
    else
        touch $file.asc
    fi
echo -n "Enter Message: "
    read message
echo $message | gpg -aer $email >> $file.asc

Copy that into a .sh file and you should be good depending on your permissions.

If you have any questions, comments, improvements, just let me know in the comments.

- C
[Image: 0d3aOy6.gif]
Not exactly sure what this is meant to achieve, it's more of an alias than a script.

(Jan 31, 2017 08:56 AM)_thenotsofriendlyghost Wrote:  Debian GNU/Linux
Recent Debian versions come with GnuPG already installed.

Worth noting that GPG is a hard dependency for dpkg, rpm and pacman, and thus should be available on 99,9% of GNU/Linux systems anyway.
(Feb 1, 2017 06:10 AM)Venom Page Wrote:  Not exactly sure what this is meant to achieve, it's more of an alias than a script.


Worth noting that GPG is a hard dependency for dpkg, rpm and pacman, and thus should be available on 99,9% of GNU/Linux systems anyway.

I see what you're talking about, I'm working on trying to make my own encryption algorithm but I have to balance school and work. The goal of this script is just to make a simpler gpg command line tool.

I also didn't know that GPG was a hard dependency, that's actually really cool.

- C
[Image: 0d3aOy6.gif]
(Feb 1, 2017 06:21 AM)_thenotsofriendlyghost Wrote:  I see what you're talking about, I'm working on trying to make my own encryption algorithm but I have to balance school and work. The goal of this script is just to make a simpler gpg command line tool.

I also didn't know that GPG was a hard dependency, that's actually really cool.

- C
  • Never roll your own crypto. It is easy for any programmer to make an algo they can't themselves break (Bruce Schneier, paraphrased). If you want to take a few hints for crypto design, reading RC4's spec is a good starting point. Also read up on why RC4 is considered weak these days.

  • dpkg/rpm/pacman and many other tools use GPG to sign packages.


(Feb 1, 2017 08:11 AM)Venom Page Wrote:  
  • Never roll your own crypto. It is easy for any programmer to make an algo they can't themselves break (Bruce Schneier, paraphrased). If you want to take a few hints for crypto design, reading RC4's spec is a good starting point. Also read up on why RC4 is considered weak these days.

  • dpkg/rpm/pacman and many other tools use GPG to sign packages.



Thanks for the tips. If I could rep you I would.
[Image: 0d3aOy6.gif]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by MiguelSanchezFeb 1, 2022 08:17 AM 0 161 Feb 1, 2022 08:17 AM
Last Post: MiguelSanchez
[Shell] by KaydotxFeb 10, 2020 02:22 PM 1 173 Feb 10, 2020 02:22 PM
Last Post: smelly_poop07
[Shell] by .eXeDec 2, 2019 09:58 PM 1 362 Dec 2, 2019 09:58 PM
Last Post: Thomas Saison