add install, delete, and status commands to main executable

This commit is contained in:
Andrea Franz 2018-10-04 17:02:10 +02:00
parent 010ab44d06
commit cb0a7d3cc4
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
1 changed files with 20 additions and 2 deletions

View File

@ -35,7 +35,7 @@ func (i *Installer) Install(capFile *os.File, overwriteApplet bool) (*Secrets, e
return nil, err
}
installed, err := i.IsAppletInstalled()
installed, err := i.isAppletInstalled()
if err != nil {
return nil, err
}
@ -57,7 +57,25 @@ func (i *Installer) Install(capFile *os.File, overwriteApplet bool) (*Secrets, e
return secrets, nil
}
func (i *Installer) IsAppletInstalled() (bool, error) {
func (i *Installer) Info() (bool, error) {
err := i.initSecureChannel(cardManagerAID)
if err != nil {
return false, err
}
return i.isAppletInstalled()
}
func (i *Installer) Delete() error {
err := i.initSecureChannel(cardManagerAID)
if err != nil {
return err
}
return i.deleteAID(statusAppletAID, statusPkgAID)
}
func (i *Installer) isAppletInstalled() (bool, error) {
cmd := globalplatform.NewCommandGetStatus(statusAppletAID, globalplatform.P1GetStatusApplications)
resp, err := i.send("get status", cmd, globalplatform.SwOK, globalplatform.SwReferencedDataNotFound)
if err != nil {