Here is the error that I get:
C:/app/Ruby22-x64/lib/ruby/gems/2.2.0/gems/gpgme-2.0.10/lib/gpgme/ctx.rb:385:in `import_keys': Unsupported protocol (GPGME::Error)
The code I used:
This code works fine on mac but as mention throwing an error on windows (win7x64 and also Win 10), GnuPg for windows is installed and the %PATH% is configured.
I tried to set this
GPGME::Engine.set_info(GPGME::PROTOCOL_OpenPGP, nil, nil)
But then the error is:
C:/app/Ruby22-x64/lib/ruby/gems/2.2.0/gems/gpgme-2.0.10/lib/gpgme/engine.rb:60:in `set_info': Invalid crypto engine (GPGME::Error::InvalidEngine)
What is the problem?
Thanks!
Here is the error that I get: C:/app/Ruby22-x64/lib/ruby/gems/2.2.0/gems/gpgme-2.0.10/lib/gpgme/ctx.rb:385:in `import_keys': Unsupported protocol (GPGME::Error) The code I used:
require 'rubygems' require 'gpgme' def passfunc(obj, uid_hint, passphrase_info, prev_was_bad, fd) io = IO.for_fd(fd, 'w') io.puts "hello" io.flush end encrypted_data = GPGME::Data.new(File.open("C:/app/pgp/src/test/encryptedText.txt")) key = GPGME::Data.new(File.open("C:/app/pgp/src/test/privateKey.skr")) ctx = GPGME::Ctx.new :passphrase_callback => method(:passfunc) ctx.import_keys key decrypted = ctx.decrypt encrypted_data decrypted.seek(0) puts decrypted.read
This code works fine on mac but as mention throwing an error on windows (win7x64 and also Win 10), GnuPg for windows is installed and the %PATH% is configured.
I tried to set this GPGME::Engine.set_info(GPGME::PROTOCOL_OpenPGP, nil, nil) But then the error is: C:/app/Ruby22-x64/lib/ruby/gems/2.2.0/gems/gpgme-2.0.10/lib/gpgme/engine.rb:60:in `set_info': Invalid crypto engine (GPGME::Error::InvalidEngine) What is the problem? Thanks!