[Gpg4win-users-en] --export incompatible with --import

Chris Jacobs ctjacobs at drschrisjacobs.nl
Tue Apr 2 12:49:57 CEST 2024


Using Gpg4win-4.3.1 on command line Windows 11

PS C:\Users\chris> gpg --generate-key
gpg (GnuPG) 2.4.5; Copyright (C) 2024 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Note: Use "gpg --full-generate-key" for a full featured key generation 
dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: test
Email address:
You selected this USER-ID:
     "test"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: revocation certificate stored as 
'C:\\Users\\chris\\AppData\\Roaming\\gnupg\\openpgp-revocs.d\\8CC337D194DFD38DA8A97CE9D77005F819FE367A.rev'
public and secret key created and signed.

pub   ed25519 2024-04-02 [SC] [expires: 2027-04-02]
       8CC337D194DFD38DA8A97CE9D77005F819FE367A
uid                      test
sub   cv25519 2024-04-02 [E] [expires: 2027-04-02]

PS C:\Users\chris> gpg -a --export test > test
PS C:\Users\chris> gpg --delete-secret-key test
gpg (GnuPG) 2.4.5; Copyright (C) 2024 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


sec  ed25519/D77005F819FE367A 2024-04-02 test

Delete this key from the keyring? (y/N) y
This is a secret key! - really delete? (y/N) y
PS C:\Users\chris> gpg --delete-key test
gpg (GnuPG) 2.4.5; Copyright (C) 2024 g10 Code GmbH
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


pub  ed25519/D77005F819FE367A 2024-04-02 test

Delete this key from the keyring? (y/N) y
PS C:\Users\chris> gpg --import test
gpg: [don't know]: partial length invalid for packet type 63
gpg: read_block: read error: Ongeldig pakket
gpg: import from 'test' failed: Ongeldige sleutelring
gpg: Total number processed: 0
PS C:\Users\chris>

Looking for the cause I found that gpg --export creates an utf-16 LE 
file and gpg --import expects ascii or utf-8 without bom but not utf-16 LE

The same test file imports good in Kleopatra.

Chris



More information about the Gpg4win-users-en mailing list