Gpg4win 5.00-beta357 raises error when Kyber1024 encryption used

Hello,

I’ve been trying to encrypt data with “Kyber-1024 Brainpool-384” key I’ve created recently.
But gpg is raising an ERROR about incorrect length!
Error comes only when using ky1024_bp384 key.
When I use Kyber-768 (ky768_bp256) key everything goes OK.

Here’s what I have:

N:\>gpg --version
gpg (GnuPG) 2.5.11
libgcrypt 1.11.1
...
N:\>gpg --list-keys
[keyboxd]
---------
pub   brainpoolP384r1 2025-08-02 [SC]
uid           [ultimate] key_1024
sub   ky1024_bp384 2025-08-02 [E]

pub   brainpoolP256r1 2025-08-02 [SC]
uid           [ultimate] key_768
sub   ky768_bp256 2025-08-02 [E]

Problem comes here:

N:\>echo 12345678 | gpg -vv -e -r key_1024
gpg: enabled compatibility flags
gpg: using subkey ^^^^^^^^^^^^^^ instead of primary key ^^^^^^^^^^^^^^
gpg: using pgp trust model
gpg: key ^^^^^^^^^^^^^^: accepted as trusted key
gpg: key ^^^^^^^^^^^^^^: accepted as trusted key
gpg: This key belongs to us
gpg: reading from '[stdin]'
gpg: writing to stdout
gpg: do_encrypt_kem: kdf for ECC failed
gpg: pubkey_encrypt failed: Invalid length
gpg: [stdin]: encryption failed: Invalid length

And again, when I use Kyber768 key, it works perfectly.

There must be a bug in a code that is either responsible for KEM exchange or public key length parsing.

PS.
I’ve checked it also with “Kyber 1024 X448” key and it raises same error.
So it is definitely something wrong with Kyber 1024 code.

we were already able to find the bug and fix it. expect a new beta release soon.

thank you for reporting this!

1 Like

A new beta version is now available: https://files.gpg4win.org/Beta/gpg4win-5.0.0-beta369/gpg4win-5.0.0-beta369.exe.