title: GPGME Passphrase prompt issue (Ruby)
body: <p>In the example below, I have tried password and passphrase. Neither seem to allow me to run my code without a openpgp box prompting for the passphrase, the following message:</p>
  
  <p>Pinentry Mac
  "Please enter the passphrase to unlock the secret key for the OpenPGP certificate"</p>
  
  <p>What do I need to change to allow my code to run without the prompt? I know my password is correct in the code.</p>
  
  <p>I have tried :</p>
  
  <pre><code>ctx = GPGME::Ctx.new :password=&gt; 'password'
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>ctx = GPGME::Ctx.new :passphrase_callback =&gt; method(:passfunc)
  </code></pre>
  
  <p>But both do not seem to work. Any advice is appreciated.</p>
  
  <pre><code>  def self.passfunc(obj, uid_hint, passphrase_info, prev_was_bad, fd)
      io = IO.for_fd(fd, 'w')
      io.puts 'password'
      io.flush
    end
  
    def self.decrypt_file(local_file, decrypted_file = nil)
      # Set decrypted file path if one is not provided
      decrypted_file = local_file.chomp(File.extname(local_file)) + ".csv" if decrypted_file == nil
      encrypted_data = GPGME::Data.new(File.open(local_file))
  
      # Set the password and GPG Key to decryption
      ctx = GPGME::Ctx.new :password=&gt; 'password'
  
      # I have tried the passphrase call back
      #ctx = GPGME::Ctx.new :passphrase_callback =&gt; method(:passfunc)
  
      #KEY= GPGME::Data.new(File.open("key.gpg"))
      ctx.import_keys Rebal::Config::KEY
  
      # Decrypt the data
      decrypted = ctx.decrypt encrypted_data
      decrypted.seek(0)
  
      #Write the data to a file
      File.write(decrypted_file, decrypted.read)
  
      #return path
      decrypted_file
    end
  </code></pre>
  
  <p>The following link did not seem to help...
  <a href="https://stackoverflow.com/questions/1867757/using-passphrase-callback-in-ruby-gpgme">Using passphrase callback in ruby gpgme</a>
  and I'm not sure what this link is referring to or how it addresses my specific issue, but it might be the soltuion...
  <a href="https://stackoverflow.com/questions/8671099/how-to-bypass-pinentry-passphrase-screen-while-decrypting-a-file-using-gpgme">how to bypass pinentry (passphrase screen) while decrypting a file using gpgme</a>  If someone can explain to me what changes to my code would help, I'm listening.</p>
  
  <p>SOLUTION: I found out that the pinentry prompt is because of GPG2 vs GPG1.4. I downgraded to GPG1.4 and now it seems to work.</p>
  
  <p>If someone knows how to get GPG2 to work, please comment</p>
  
  <p>thank you</p>