Giter Site home page Giter Site logo

Comments (8)

ueno avatar ueno commented on August 27, 2024

Indeed. The native interface has not updated for a while. Pushed a fix: 84b4934

from ruby-gpgme.

stepanstipl avatar stepanstipl commented on August 27, 2024

Wow, cool, that was fast, thanks a lot!

from ruby-gpgme.

stepanstipl avatar stepanstipl commented on August 27, 2024

Unfortunately when trying to use it, I always end up with gpgme_op_decrypt_result': NULL pointer given (ArgumentError). The code works fine without the GPGME::gpgme_op_decrypt_result(ctx) call.

Here's what I'm trying to use:

  options = {}
  plain_data   = GPGME::Data.new(options[:output])
  cipher_data  = GPGME::Data.new(encrypted)

  rctx = []
  err = GPGME::gpgme_new(rctx)
  exc = GPGME::error_to_exception(err)
  raise exc if exc
  ctx = rctx[0]

  err = GPGME::gpgme_op_decrypt_verify(ctx, cipher_data, plain_data)
  exc = GPGME::error_to_exception(err)
  raise exc if exc

  GPGME::gpgme_op_decrypt_result(ctx)

  GPGME::gpgme_release(ctx)

  plain_data.seek(0)
  decrypted_val = plain_data.read

from ruby-gpgme.

ueno avatar ueno commented on August 27, 2024

Well, the code works here. Could you provide the complete error message? By the way, a simpler test case can be something like:

require 'gpgme'

ctx = GPGME::Ctx.new
cipher = GPGME::Data.new(ARGF)
ctx.decrypt(cipher)
p ctx.decrypt_result

and you will get:

$ ruby decrypt.rb test.txt.gpg
#<GPGME::DecryptResult:0x0000000186bbd0 @wrong_key_usage=0, @recipients=[#<GPGME::Recipient:0x0000000186bb58 @pubkey_algo=1, @keyid="50AD4600C8C530D6", @status=0>], @file_name="test.txt">

from ruby-gpgme.

stepanstipl avatar stepanstipl commented on August 27, 2024

I've tried on different machine, and very same code seems to work fine (both machines are OS X Mavericks, with ruby 2.0.0p247, used same way to create & install gem). I'll try to find out more what's the issue when I'll get back home to the other machine.

from ruby-gpgme.

ueno avatar ueno commented on August 27, 2024

hey, I've added tests for this (and missing attr_readers):
https://github.com/ueno/ruby-gpgme/blob/master/test/ctx_test.rb#L44
and they seems to be ok on travis:
https://travis-ci.org/ueno/ruby-gpgme

Closing this for now. If you find anything more, please reopen.

from ruby-gpgme.

stepanstipl avatar stepanstipl commented on August 27, 2024

Thanks, I wasn't able to reliably reproduce this. It's somehow related to the version of compiler used to build the native extension, but as ruby & gcc weren't consistent across my machines, I've simply fixed this by rebuilding the gem using gcc48 provided by homebrew and I wasn't able to reproduce same error again since.

from ruby-gpgme.

davout avatar davout commented on August 27, 2024

Hello

I can reliably reproduce this on OSX, Ubuntu, Debian, and Travis I've added a failing test on my fork to demonstrate the behaviour.

See : https://travis-ci.org/davout/ruby-gpgme/jobs/45167445

from ruby-gpgme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.