gpgr is a lightweight wrapper around the GNU Privacy Guard's command line interface. Its primary concern is in quickly encrypting files easily from within Ruby. It also offers very limited key-management functionality
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 4 commits ahead, 10 commits behind pccl:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

gpgr - GNU Privacy Guard Encryption in Ruby

March 2010 - Present, Ryan Stenhouse Originally behalf of Purchasing Card Consultancy Limited.

The current development version of gpgr is released under the MIT license. Previous versions were licensed under the GNU GPL. If you require the use of a GNU GPL version, please use 0.0.4.


gpgr is a lightweight and fast wrapper around the gpg command commonly found on Linux and other Unix-like operating systems.

It is only concerned with quickly and easily encrypting files, to that end aside from some basic key-management support, it will not wrap any other parts of the gpg functionality.

If you need something that will elegantly and quickly encrypt files for you and make managing the keys used within your application for this purpose a snap, use this. If not, use something else.


From Rubygems:

gem install gpgr

From GitHub:

Download or Clone the repoistory or just gpgr.rb and include it where you need it.


gpgr has only really been tested on *nix environments, and indeed the path hard-coded by default for the gpg binary will only be meaningful if you're using a Linux-based or other UNIX-like operating system.

The only requirement (apart, obviously, from Ruby) is that you have gpg installed. On most modern Linux distributions, it should be there by default to verify, open a terminal and key in:

gpg --version

If you see something like:

  ryan@ubuntu:~$ gpg --version
  gpg (GnuPG) 1.4.6
  Copyright (C) 2006 Free Software Foundation, Inc.
  This program comes with ABSOLUTELY NO WARRANTY.
  This is free software, and you are welcome to redistribute it
  under certain conditions. See the file COPYING for details.

  Home: ~/.gnupg
  Supported algorithms:
  Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
  Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
  Compression: Uncompressed, ZIP, ZLIB, BZIP2


For Ubuntu / Debian distros, you can try the following if its not installed by default:

sudo aptitude install seahorse gpg-rsa gpgkeys gpgsm gpgv

As well as installing the command-line tools gpgr expects, seahorse which, is a fantastic graphical tool for managing your keys, will be installed

For Mac OS X, you will first need to install gpg, you can do this through MacPorts or Frink, but the best way is through MacGPG, just download the latest version and install int .pkg file it downloads.

A Note on Testing

Since gpgr really is just firing of to the GPG binary to all of the real work, there is little to test within gpgr itself. I've added the tests I feel are prudent and useful. Feel free to contribute your own if you think a particular area could do with higher coverage.

I do take the view, however, that GPG it's self is a very well established and proven, mature project; and as such - any tests which attempt to test that gpg is functioning correctly will not be accepted - I'm happy to assume that it is.