diff --git a/command_set.go b/command_set.go index cf322f4..70ab302 100644 --- a/command_set.go +++ b/command_set.go @@ -195,6 +195,21 @@ func (cs *CommandSet) ChangePIN(pin string) error { return cs.checkOK(resp, err) } +func (cs *CommandSet) ChangePUK(puk string) error { + cmd := NewCommandChangePUK(puk) + resp, err := cs.sc.Send(cmd) + + return cs.checkOK(resp, err) +} + +func (cs *CommandSet) ChangePairingSecret(password string) error { + secret := generatePairingToken(password) + cmd := NewCommandChangePairingSecret(secret) + resp, err := cs.sc.Send(cmd) + + return cs.checkOK(resp, err) +} + func (cs *CommandSet) GenerateKey() ([]byte, error) { cmd := NewCommandGenerateKey() resp, err := cs.sc.Send(cmd) diff --git a/commands.go b/commands.go index b47435e..7118000 100644 --- a/commands.go +++ b/commands.go @@ -149,6 +149,26 @@ func NewCommandChangePIN(pin string) *apdu.Command { ) } +func NewCommandChangePUK(puk string) *apdu.Command { + return apdu.NewCommand( + globalplatform.ClaGp, + InsChangePIN, + P1ChangePinPUK, + uint8(0), + []byte(puk), + ) +} + +func NewCommandChangePairingSecret(secret []byte) *apdu.Command { + return apdu.NewCommand( + globalplatform.ClaGp, + InsChangePIN, + P1ChangePinPairingSecret, + uint8(0), + secret, + ) +} + func NewCommandDeriveKey(pathStr string) (*apdu.Command, error) { startingPoint, path, err := derivationpath.Decode(pathStr) if err != nil {