add unblockPIN implementation

This commit is contained in:
Andrea Franz 2021-10-22 11:53:20 +02:00
parent 736adcccad
commit a7c15e6c91
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D

View File

@ -2,7 +2,6 @@ package statuskeycardgo
import (
"crypto/sha512"
"errors"
"fmt"
"github.com/ebfe/scard"
@ -224,8 +223,19 @@ func (kc *keycardContext) verifyPin(pin string) error {
return nil
}
func (kc *keycardContext) unblockPIN(puk string, newPin string) error {
return errors.New("not implemented yet")
func (kc *keycardContext) unblockPIN(puk string, newPIN string) error {
<-kc.connected
if kc.runErr != nil {
return kc.runErr
}
err := kc.cmdSet.UnblockPIN(puk, newPIN)
if err != nil {
l("unblockPIN failed %+v", err)
return err
}
return nil
}
func (kc *keycardContext) generateKey() ([]byte, error) {