Signing and verifying files using GnuPG

I’m convinced almost nobody actually uses this functionality of GnuPG, because it is somewhat awkward and confusing for myself, having been a student of the OpenPGP protocol for many years. I thought this would make a good post to explain what to do with those PGP signature files you often see alongside the download links of free/open source software.

The vast majority of signatures use the RSA algorithm. GnuPGP/commercial PGP give you two choices, and they are both probably fine, but it makes the whole thing more confusing. The RSA algorithm can be used for encrypting and signing whereas the alternative ElGamal algorithm uses the official sounding DSA, Digital Signature Algorithm. I don’t even bother implementing ElGamal due to the amount of time it would take to implement and the nonexistent payoff. Since RSA is the de facto standard for even mainstream cryptography, combined with the fact that it can be used for both signing and encryption, I never though it worth my while to develop, debug, test, and all that comes with this labor of love (of the Fourth Amendment).

Ironically, for GnuPG 1.4.20, which is the easiest open source PGP distribution to build, the signing key is already expired. This is only a problem if somehow the private RSA key came into the possession of a malicious part. Before you do anything, you must import the signing certificates from the offical GnuPG website.

Importing GnuPG all release signing into our self compiled GnuPG 1.4.20

If there’s not enough evidence to support the waste of time that is implementing testing, regression testing, and supporting DSA, even the official GnuPG releases are signed with RSA.

Verifying a file using GnuPG and an attached signature is a simple command line argument that should only take a few tries to get right.

About as good of a verification as we are going to get that the gnupg-1.4.20.tar.bz2 hasn’t been tampered with…

Again, this is the problem I see with GnuPG… we’re getting conflicting messages. First the good news: it appears that two parties have signed the tar ball with their private keys so unless both of those keys have been compromised the by malicious entities, the tar ball is intact. The first warning is that “there is no indication the signature belongs to the owner”. So apparently, importing the keys from GnuPG’s very own website 10 minutes ago which is secured by SSL/TLS is not enough assurance the key is valid. I wonder why they even bother to post them. The other is that the key is expired…

This would make sense since 1.4.20 is quite an old release, I’m just using that version since the compilation is so much more straightforward. Newer versions of GnuPG have a modularized codebase but the actual encryption code is line for line the same as 1.4.20 — and obviously showing it’s age since it’s based on streams which made a lot more sense in 1999 when memory was much more limited on the average enthusiast computer. Streaming is more memory efficient at the cost of code complexity. (i.e. bugs)

Thus a new Privacy Guard is needed. And open source is not a panacea, perhaps including a sane file verification function in the (long overdue) next update of NouveauPG.

Compiling and Installing GnuPG Classic v1.4.20 on Mac OS X

Compiling from source code is a straightforward way to ensure that you have a genuine copy of GnuPG on your machine. Since GnuPG may be used to verify other software packages, it is important that your copy is not tampered with.

This post will outline the steps for compiling GnuPG classic v1.4.20 from source for Mac OS X rather than the latest version of GnuPG (v2.0.x) because it is much simpler to compile. Compiling GnuPG from source is certainly not any more difficult that using GnuPG, which is a command line program.

1.) Install command line developer tools for Mac OS X. This is dead simple on recent versions of Mac OS X 10.9 and up, simply open the Terminal and type “xcode-select –install”. The dialog below will appear and allow you to install the command line tools.xcode-select

For older versions of Mac OS X, the procedure outlined here may work.

2.) Download the source code archive for GnuPG v1.4.20 here and the signature here. The signature is a text file that we will use to verify the source code archive.

3.) Decompress and extract the source code archive.

bzip2 -d gnupg-1.4.20.tar.bz2
tar -xvf gnupg-1.4.20.tar

4.) From the source code directory, run the configure script to make sure your command line tools are installed.

cd gnupg-1.4.20
./configure

5.) Assuming there are no errors, from the same directory run make to compile gnupg.

makeScreen Shot 2015-12-30 at 11.24.05 PM

At this point, if everything went correctly, you should find the gpg executable in the g10 subfolder.

gnupg

6.) If you wish to install GnuPG 1.4.20 as your default gpg:

sudo make install

You must uninstall other versions of gpg (including those installed by other software packages) before installing.

Anonymous activation finally arrives

I finally have the Bitcoin activation system up and running. Now if you want to purchase NouveauPG, you don’t need to go through the Mac App Store. The first time NouveauPG is run on a Mac, it generates a random UUID. When you provide a valid UUID to the activation page, you will be assigned a Bitcoin deposit address. When you deposit enough Bitcoin, a signature will be generated that can be copied and pasted into NouveauPG to unlock it. No network access is necessary.

NouveauPG for iOS removed from App Store

A few years ago, I swore to myself that I would not publish apps that I didn’t use myself. NouveauPG for iOS has some issues I don’t have the time to fix in the near future. I hope to have it back and better than ever in 2016, but I will not publish it until it is in good enough shape that I have it on my phone.

I use NouveauPG for OS X on a regular basis, so I want to concentrate on that for the time being.

GPG Suite security even worse than imagined

Apparently there are security issues with GPGSuite beyond keeping track of users' IP addresses with an auto-updater.
Apparently there are security issues with GPGSuite beyond keeping track of users’ IP addresses with an auto-updater.

The leading OpenPGP client for Mac OS X has recently pushed a security update due to a bug that allows a local user to execute shell commands with root privileges.

As if it weren’t enough, by default, GPG Suite regularly contacts gpgtools.org to check for updates. So not only does gpgtools.org keep tabs on the IP addresses you use without explicitly getting permission, a carrier or state level entity could easily compile a list of GPG Suite users by monitoring requests to the gpgtools.org upgrade server (here and here). It doesn’t matter they are using SSL/TLS because the private information is your IP address.

Think about it, after a few months, your upstream carrier (or whomever has access to their logs) could compile a list of every IP users of GPG Suite use. My opinion of GPG Suite users notwithstanding, I am sure they have more interesting data stored on their computers than the average person.

NouveauPG is sandboxed, so it is entitled only to access files selected by the user using the system open and save dialog box. Absolutely no network access allowed. (The only autoupdate mechanism is through the App Store version, which is the same one used for OS X autoupdate. There is no way for a third-party other than Apple to know exactly what is being updated, and tracking IP’s to the Apple update servers will only give you a list of Macintosh users.)

Activity monitor showing all the unsandboxed processes from a GPG Suite installation.
Activity monitor showing all the unsandboxed processes from a GPG Suite installation.
Activity monitor showing the single sandboxed process for NouveauPG
Activity monitor showing the single sandboxed process for NouveauPG.

Quickstart Guide to NouveauPG for OS X

To encrypt a message for some party, you must first import their certificate into NouveauPG.

You can import public key certificates from either the clipboard or a file.
You can import public key certificates from either the clipboard or a file.

Before using a certificate, be sure it’s valid. NouveauPG will warn before performing encryption with an invalid certificate.

User ID validation Click on Compose Message to write a new message for the recipient.

Compose Screenshot

You can either type a message or choose a file to encrypt. At this time, NouveauPG will only encrypt plain text files. (UTF-8 supported)

Compose Screenshot

You can export your encrypted message by copying to the clipboard, or save as a text file.

Compose Screenshot 3

 

If you wish to receive encrypted messages from another party, you must first create a new identity. Press the add button on the lower left hand corner of the window.

Create Identity

An identity looks a lot like the public key certificate but you have two more options: Decrypt Message and Private Keystore

My New Identity screenshot

 

The two new options are protected by the password you chose while creating the account.

enter_passwordTo decrypt a message, either paste the encrypted message in the space provided or load an encrypted message from a file.

Decrypt ScreenshotYou should use the Private Keystore feature to backup your identity. Make sure your keystore is saved on an encrypted volume. To restore an identity, or move it to a new computer, simply import the private key block.

Export Identity Keystore

 

NouveauPG for OS X waiting for review

new icon
The New Icon

After taking into account feedback from the beta last year, and taking a “break” to develop NouveauPG for iOS, I am now pleased to announce the first GA release of NouveauPG for OS X.

Functionally, not much has changed from the beta, however many bugs have been removed and the interface is polished to the degree expected in the Apple App Stores.

Screen Shot 2015-03-01 at 1.02.07 PM
Screenshot

Getting Started with NouveauPG for iPhone

NouveauPG allows you to securely message others using iPhone apps you already have. You use the clipboard to efficiently shuffle encrypted messages into and out of your favorite messaging and e-mail apps.

Before you can receive (and decrypt) any encrypted messages, you must first generate an identity. An identity is sometimes referred to as a key pair or public/private key pair. Your identity has a public part that can and should be distributed to anyone that might want to send you an encrypted message. The private part of your identity is used to decrypt messages that were encrypted using the public part of the identity.

Generate user The private portion of the identity is further protected by a password. Even if you have the password for an identity, you can’t decrypt a message without the private key. The password is just another line of defense against unauthorized access to the private key.

It will take a few moments to generate a new identity, depending on how recent your iPhone is.

Identity menu

Clicking on your newly created identity will bring up a short menu. You can export a public key certificate for this identity, which others will use to encrypt messages for the identity.

Export OpenPGP public key certificate

From this screen you can either e-mail this public key certificate someone that may want to send you an encrypted message or copy and paste into another app.

Compose a message to self

You can also add this public key certificate to your Recipients list and be able to encrypt messages to yourself.  This may help you understand the OpenPGP process better by examining from end to end.

Export encrypted OpenPGP message

As usual, you can easily send the encrypted message to the e-mail address specified in the public key certificate. But since you’re sending the message to yourself, simply save it to your Messages. (The Save button on the toolbar)

Messages

The messages is where encrypted messages are stored waiting to be decrypted. The add icon on the upper left will add an empty message. You can paste an encrypted OpenPGP message into this empty message and NouveauPG will automatically recognize if it is encrypted for the public key of an Identity.

If NouveauPG recognizes the Identity the message was encrypted for, it’s identicon will appear on the left side of the cell. Otherwise, a preview of the message’s content will show instead.

Decrypt message

Once you select an encrypted message, you have the option of attempting to decrypt the message.

Identity locked

First you must unlock the private part of identity with the password you selected.Identity menu

This is known as “unlocking the keystore.” The key store is always protected by a password as a line of defense against unauthorized access to the key.

Unlocked menu

Once you unlock an identity, the menu has a couple more options. Exporting the private keystore will allow you to use import this identity into NouveauPG on another device or NouveauPG for Mac OS. If you intend on using a key for a period of time, you would be well advised to export and backup a private keystore for the identity. You will be prompted for a password to protect the keystore with.Decrypted message

Now that you have unlocked the identity, you are able to freely decrypt the OpenPGP messages encrypted for that identity.