mirror of
https://github.com/status-im/keycard-go.git
synced 2025-01-22 17:59:35 +00:00
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)
|
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) {
|
func (cs *CommandSet) GenerateKey() ([]byte, error) {
|
||||||
cmd := NewCommandGenerateKey()
|
cmd := NewCommandGenerateKey()
|
||||||
resp, err := cs.sc.Send(cmd)
|
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) {
|
func NewCommandDeriveKey(pathStr string) (*apdu.Command, error) {
|
||||||
startingPoint, path, err := derivationpath.Decode(pathStr)
|
startingPoint, path, err := derivationpath.Decode(pathStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user