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 97eeba53f8
commit b4f62deb1f
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D

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
}