import key failure, apparent bug
Andrew Gallagher
andrewg at andrewg.com
Fri May 29 13:45:51 CEST 2026
On 28/05/2026 18:55, Joshua Hudson via Gnupg-users wrote:
> I have here a private key that gpg won't import.
>
> ~/keystest$ gpg --homedir home --import private2.gpg
> gpg: WARNING: unsafe permissions on homedir '/home/DEXTER2/jhudson/
> keystest/home'
> gpg: read_block: read error: Invalid packet
> gpg: import from 'private2.gpg' failed: Invalid keyring
> gpg: Total number processed: 0
>
> The problem with the error message is it's wrong. I have hand verified
> the packet structure
> is correct. The file can be imported by https://github.com/mattosaurus/
> pgpcore (which isn't
> where it came from) and the resulting imported key is a working key.
The first MPI length in the secret key packet (rsa public n) is
incorrect. It is 0x07ff, but the high bit of the next byte (0xa7) is set
- which implies the length *should* have been 0x8000.
This is particularly unusual considering that it is using SOSes (i.e.
with untrimmed leading zero bits) for at least some of the other MPIs (I
haven't checked them all).
What did you use to generate this?
A
More information about the Gnupg-users
mailing list