Search code examples
ruby-on-railsrubyruby-on-rails-3gpgme

Ruby GPGME::Error> Inappropriate ioctl for device


I'm unable to import a key file. I'm using ruby 1.9.3 and ruby-gpgme https://github.com/ueno/ruby-gpgme

require "gpgme"

begin
  key = GPGME::Key.import(File.open("private.key"), {:password => "redacted"})

rescue GPGME::Error => g
  puts g.inspect
  puts g.message
  puts g.code
  puts g.source
end

Output

Inappropriate ioctl for device

More info: /usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/gpgme-2.0.2/lib/gpgme/ctx.rb:43:in new': Inappropriate ioctl for device (GPGME::Error) from /usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/gpgme-2.0.2/lib/gpgme/key.rb:120:inimport' from gpgme.rb:17:in `'

Here is the ctx.rb file, but I don't get what could be causing the issue... https://github.com/ueno/ruby-gpgme/blob/master/lib/gpgme/ctx.rb


Solution

  • The error was a result of some issue with gpgme. So I reinstalled gpgme. I used "brew gpgme". now it seems to be working.