On my Desktop Debian GNU/Linux 9.11 (stretch) the code works but not on a server Ubuntu 16.04.6
The problem occures in the method Function: gpgme_error_t gpgme_op_decrypt (gpgme_ctx_t ctx, gpgme_data_t cipher, gpgme_data_t plain) https://www.gnupg.org/documentation/manuals/gpgme/Decrypt.html
crypto = GPGME::Ctx.new(
pinentry_mode: GPGME::PINENTRY_MODE_LOOPBACK,
passphrase_callback: method(:passfunc)
)
data = crypto.decrypt(encrypted_data)
raises exception GPGME::Error with message 'Not supported'
The error occurs in the GEM shared/bundle/ruby/2.5.0/gems/gpgme-2.0.18/lib/gpgme/ctx.rb:428:in `decrypt'
def decrypt(cipher, plain = Data.new)
err = GPGME::gpgme_op_decrypt(self, cipher, plain)
The exception GPGME::Error with message 'Not supported' is not documented at https://www.rubydoc.info/gems/gpgme/2.0.18/GPGME/Error
On my development PC the exception is not raised!