How can I asymmetrically encrypt data using OpenPGP with Ruby?
===

This feels like it should be dead simple, yet I'm not having any luck.

The scenario is this: I have a public *.asc key file. I want to use *this file* (not my personal keyring) to encrypt data on a server, so that I can decrypt it locally with a secret key.

From the command line I can achieve this using `gpg`, but I'd prefer to use a Ruby library that isn't just a wrapper around the CLI (i.e., presumably one that provides bindings to the C library). I've looked at the GPGME and OpenPGP gems and haven't been able to figure out how to use them. The documentation (especially for OpenPGP) is quite sparse.

Here, for example, is something I've tried using GPGME:

    key = GPGME::Data.new(File.open(path_to_file))
    data = GPGME::Data.new("I want to encrypt this string.")
    
    # Raises GPGME::Error::InvalidValue
    GPGME::Ctx.new do |ctx|
        e = ctx.encrypt(key, data)
    end

Has anyone been through this already? Surely this can't be that complicated?