Dr. Stefan Pfeiffer/Neolayout2 Yubikey Keymappings

Created Sun, 05 Nov 2023 15:22:37 +0000 Modified Sat, 11 Nov 2023 23:52:12 +0000
195 Words

Neolayout2 is a rather esoteric ergonomic keyboard layout optimized for the German language. Except for the numbers, nearly all keys are mapped in a non-standard way not even remotely similar to qwerty or qwertz keyboard layouts.

Luckily, Linux supports this keyboard layout out of the box. But this poses problems when generating OTP passwords from a Yubikey, which emulates an USB keyboard. The key presses the Yubikey sends to the host PC are mapped to different characters by the keyboard layout, which the Yubikey knows nothing about. This leads to OTP passwords starting with ääääää instead of cccccc as it should be.

The Yubikey tries to circumvent the problem of variable keyboard layouts on the host PC by using only keys that are the same on qwerty, qwertz and Dvorak layouts, but this approach fails on more esoteric layouts. But using the ykpersonalize tool, one can set a custom mapping for the 45 keys used by the Yubikey NEO or newer, so that after mapping through the host PC keyboard layout, the expected characters end up in the OTP password.

The command to make a Yubikey emit correct keypresses for the neolayout2 keyboard layout is