A co-worker has been unable to generate RSA4096 keys on their Yubikey 4 Nano on their OSX Sierra laptop with gnupg 2.2.5.
Key generation fails after the first of 3 subkey generation steps with:
gpg: key generation failed: End of file Key generation failed: End of file
"gpg --card-status" reveals a single subkey on the card and no public key for the chain at this point.
Proceeding with cycles of factory-reset and generating RSA2048 keychains works every time, but RSA4096 fails identically every time.
~/.gnupg was removed between runs and gpg-agent processes killed. One run was attempted with 'use-standard-socket' with no luck.
Also verified gpg-agent and gnupg are both 2.2.5 freshly installed via brew.
To rule out a hardware issue with the key, RSA4096 I inserted this key into an Arch Linux system running gnupg 2.2.5 as well and had no problem repeatedly generating RSA4096 keys.
I had the user add the following to their ~/.gnupg/gpg-agent.conf to obtain the attached log of another identical failure.
default-cache-ttl 300 max-cache-ttl 300 log-file /tmp/gpg-agent.log debug 1024 verbose