Problems when importing previously exported private keys on new linux system.

Vladislav Alekseev Alekseevvladislav2hy at outlook.com
Mon Aug 8 15:06:59 CEST 2022


Hi there.

I am switching my linux release.
Before I reinstall the system, I use commands below to export my gpg keys.

vvvvvvvvvvvvvvvv
gpg --export-private-keys $key_id > private.key
gpg --armor --export $key_id > public.key
^^^^^^^^^^^^^^^

As expected, a window prompt requesting passwords to decrypt my private key, and both public key and private key file appeared in the explorer.
Then I move keys to my portable drive and reinstall system.

After the installation finished, I started to import keys exported minutes before.
The public key, as expected, imported successfully.
But problems occured when I was trying to import my private key.

vvvvvvvvvvvvvvvv
> gpg --import private.key
gpg: [don't know]: partial length invalid for packet type 63
gpg: read_block: read error: Invalid packet
gpg: import from 'private.key' failed: Invalid keyring
gpg: Total number processed: 0
> file private.key
private.key: data
^^^^^^^^^^^^^^^

So, here is the problem.
Is there any method to restore my private key or revoke it?
Why gpg program can't identify my key file? Is the root cause of it that I didn't add "--armor" parameter when exporting my private key?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20220808/7944a42f/attachment-0001.html>


More information about the Gnupg-users mailing list