Closed Dimcha closed 6 years ago
What was your resolution here?
Here is the solution I did.
require 'gpgme'
module GPG
GPGME::Engine.set_info(GPGME::PROTOCOL_OpenPGP, "/usr/bin/gpg", nil)
@gpg = GPGME::Crypto.new
class << self
def decrypt(text, options = {})
GPGME::Key.import(File.open(File.join(Rails.root, 'config', 'pgp_keys.asc')))
options = { password: Rails.application.secrets.gpg_password }.merge(options)
@gpg.decrypt(text, options)
end
end
end
result = GPG.decrypt(text).read
Having trouble making decryption work by passing the passphrase but no matter what I do it does not work, and cannot find any explanation why, maybe someone here could help me.
And here I get GPGME::Error::DecryptFailed. To be more specific I get:
I tried
but no help as well.
More info:
If I do it without pinentry_mode it prompts a field to enter a passphrase, and everything works good, but I need to do it to work by itself. Any ideas?