24553

how to bypass pinentry (passphrase screen) while decrypting a file using gpgme

I am trying to decrypt a file from the server where I have the required public key of that server. The keyring has a password protection and so when I try to decrypt a file, it asks me for a passphrase.

Is there a way to bypass that passphrase by passing the password when we try to decrypt the file.

I am using gpg-agent where the passphrase is cached for 600sec default time and for some reason I am unable to set the max-cache-ttl (It didn't work for me, I don't know y) and is availble only for that session.

Now I want to cache the passphrase for which I am using gpg-preset-passphrase. I set it in .gnupg/gpg-agent.conf as gpg-preset-passphrase --preset hex. I don't know what I am missing in this.

Can someone please let me know what I am missing in this

Thanks

Answer1:

I am unable to bypass the passphrase or pinentry screen, but I used gpg-agent options like default-cache-ttl to set the cache time. So that from the second attempt, the pinentry is going to retrieve the cached passphrase and will reset the timer on defaul-cache-ttl.

There is one more called max-cache-ttl option, even after the successfull retrieval of cached passphrase and reset of default-cache-ttl, this option doesn't change its timer and expires the cached passphrase after the set timeout.

For ex: If I set both of them for 10hrs (i.e., 36000sec), if I call the decrypt after 5hrs, default is going to reset its timer and now we have 10more hours. But the max is going to expire after the initial 10hours and thus removes the cached passphrase after 10hours.

One more problem I found is, session issue with gpg-agent. i.e., if I open a new session and try to decrypt, it doesn't happen and errors out that gpg-agent is not available for this session. I wrote some shell script and put it on bashrc so that it starts as soon as a new session is started

Recommend

  • What do returned values of PHP gnupg signature verification mean?
  • Create and use custom prototype table cells in xamarin ios using storyboard
  • Getting Respond Time from Ping Command
  • Spring RabbitTemplate is not creating dead letter queue with TTL
  • Fiware Cygnus: no data have been persisted in CKAN
  • Calculate the depth of subclass in the OWL ontology
  • Configuration class - Get configuration array from the function string argument
  • Warning: ldap_start_tls() [function.ldap-start-tls]: Unable to start TLS: Server is unavailable
  • Node can't scrape certain pages
  • Version in docker-compose is unsupported
  • how to bypass pinentry (passphrase screen) while decrypting a file using gpgme
  • Iterate twice through a DataReader
  • HttpClient: disabling chunked encoding
  • Clear fused location provider's location for testing
  • Trying to get the char code of ENTER key
  • python script hangs on input method when running spark
  • Using Sax parsing to edit and write XML in VB6
  • android.support.v7.widget.Toolbar VectorDrawableCompat IllegalStateException when using support lib
  • RxJava debounce by arbitrary value
  • D3 get axis values on zoom event
  • Unable to install Git-core+svn by MacPorts
  • Unable to decode certificate at client new X509Certificate2()
  • C: Incompatible pointer type initializing
  • Debug.DrawLine not showing in the GameView
  • Yii2: Config params vs. const/define
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • Launch Runnable Jar from Web Start
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Modifying destination and filename of gulp-svg-sprite
  • How to get next/previous record number?
  • GridView Sorting works once only
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Qt: Run a script BEFORE make
  • How can I remove ASP.NET Designer.cs files?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • reshape alternating columns in less time and using less memory