Allow selection of a key by id.

Fixed #29.
Backport of #30