scd: Implement auto-switching between Yubikey apps.
* scd/app.c (apptype_from_keyref): New. (maybe_switch_app): Add arg 'keyref' and use this also for switching. Change all callers to pass a keyref if needed.
A drawback of this auto-switching is that the PIN cache of the cards
are cleared. That could be mitigated by having our own cache but we
always tried to avoid that.
- Signed-off-by: Werner Koch <wk@gnupg.org>