From 8c159f546a70a76eb404b7b8e4d9fe79714a809d Mon Sep 17 00:00:00 2001 From: Andrea Franz Date: Mon, 11 Mar 2019 13:46:05 +0100 Subject: [PATCH] fix info command in case where applet is not installed --- initializer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/initializer.go b/initializer.go index a1cceaf..fe647cf 100644 --- a/initializer.go +++ b/initializer.go @@ -70,7 +70,12 @@ func (i *Initializer) Init() (*keycard.Secrets, error) { // Info returns a types.ApplicationInfo struct with info about the card. func (i *Initializer) Info() (types.ApplicationInfo, error) { cmdSet := keycard.NewCommandSet(i.c) + logger.Info("select keycard applet") err := cmdSet.Select() + if e, ok := err.(*apdu.ErrBadResponse); ok && e.Sw == globalplatform.SwFileNotFound { + err = nil + } + return cmdSet.ApplicationInfo, err }