Neolayout2 Yubikey Keymappings

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

ykpersonalize -y -S 15113309120c1816381c080d0e0f041a9591b389928c9896b89c888d8e8f849a271e1f202122232425261c2b28

The story of how to find the correct codes for a given keyboard layout is a longer one that will be another blog post.