Page MenuHome GnuPG

Odd "gpg: KEYTOCARD failed: Invalid time" error when using `--pinentry-mode=loopback`
Testing, NormalPublic

Description

When using --pinentry-mode=loopback for a keytocard action we're getting an odd error: "gpg: KEYTOCARD failed: Invalid time"

We're experiencing this on both MacOS and Ubuntu (5 different users so far).
I hit this myself using gpg (GnuPG) 2.4.5

It seems something "recent" (past 1~2yrs) as the script we've been using to setup our YubiKey has been untouched and working fine for ~2yrs, but in the past year more people starting hitting this issue.
I've been digging through gpg commits, but struggling to understand the code at times, I can't pinpoint anything that could be the cause...

it works fine without --pinentry-mode=loopback (but then we need to manually enter the pin a bunch of times)

There's more people hitting this (see external link to a reddit post)

Related Objects

Event Timeline

y38k problems with some frontends are known for some 32 bit platforms.

Please write a proper bug report and don't expect us to read a reddit thread.

gniibe triaged this task as Normal priority.
gniibe added a subscriber: gniibe.

I can replicate the problem.

The cause of this is that when it's comes with loopback mode, gpg-agent inquires back to the frontend and the buffer overwritten, which results parsing the line wrong.
I'm going to fix.

y38k problems with some frontends are known for some 32 bit platforms.

Please write a proper bug report and don't expect us to read a reddit thread.

I'm sorry, definitely not on 32bit and the reddit link was just for reference to indicate multiple people are experiencing this.

and I'm sorry, not sure what else to provide

I can replicate the problem.

The cause of this is that when it's comes with loopback mode, gpg-agent inquires back to the frontend and the buffer overwritten, which results parsing the line wrong.
I'm going to fix.

awesome, let me know if you need another person to test.

gniibe changed the task status from Open to Testing.Wed, Sep 4, 1:34 AM