Page MenuHome GnuPG

Kleopatra: Possible problem when trying to import UTF-16 encoded files
Closed, ResolvedPublic

Description

This is a spin-off of T2671: "Invalid option" with utf-16 config files (windows) which reports a similar problem for GnuPG's config files.

In T2671 Werner wrote:

It seems that editing a pre-created revocation certificate on Windows with Notepad doesn't let Kleopatra detect this correctly as OpenPGP file and thus refuses to import. Works on the command line but needs more testing.

Event Timeline

ikloecker created this task.
ikloecker moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Dec 5 2022, 5:15 PM
ikloecker changed the task status from Open to Testing.Dec 6 2022, 9:02 AM
ikloecker moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.

Kleopatra is now able to import certificates from UTF-16 (or UTF-32 or UTF-8-with-BOM) encoded text files.

You can use for example KWrite to convert a certificate to UTF-16(LE) by using Save As with Encoding->Unicode->UTF-16.

By the way, I don't know exactly what Werner means with

Works on the command line but needs more testing.

because at least on Linux gpg cannot import UTF-16LE-encoded armored certificates:

$ gpg --show-keys <test1-pub.utf16.asc 
gpg: [don't know]: partial length invalid for packet type 63
gpg: read_block: read error: Invalid packet
gpg: import from '[stdin]' failed: Invalid keyring

It seems that we removed the support for the BOM at some point in the past. Probably because config files are anyway suppossed to be utf-8 encoded.

Regarding armored files: Well the whole point of armoring is that there is only a plain 7-bit ASCII channel.

Regarding armored files: Well the whole point of armoring is that there is only a plain 7-bit ASCII channel.

@werner Well, you wrote that you want to be able to import (armored) revocation certificates after editing them with an editor which saves them as UTF-16.

ebo claimed this task.
ebo moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.
ebo added a subscriber: ebo.

works