fix info command in case where applet is not installed

This commit is contained in:
Andrea Franz 2019-03-11 13:46:05 +01:00
parent 4e12ddba06
commit 8c159f546a
1 changed files with 5 additions and 0 deletions

View File

@ -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
}