add change PUK and Pairing Secret commands
This commit is contained in:
parent
d773b76890
commit
1f5f2a9eeb
|
@ -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)
|
||||
|
|
20
commands.go
20
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 {
|
||||
|
|
Loading…
Reference in New Issue