forked from cerc-io/plugeth
fix wallet status update
This is a temporary fix, better checks need to be performed once the whole process has been validated.
This commit is contained in:
parent
42c76a2ba1
commit
7ec6fa03d3
@ -81,23 +81,26 @@ const (
|
|||||||
sw1GetResponse = 0x61
|
sw1GetResponse = 0x61
|
||||||
sw1Ok = 0x90
|
sw1Ok = 0x90
|
||||||
|
|
||||||
insVerifyPin = 0x20
|
insVerifyPin = 0x20
|
||||||
insUnblockPin = 0x22
|
insUnblockPin = 0x22
|
||||||
insExportKey = 0xC2
|
insExportKey = 0xC2
|
||||||
insSign = 0xC0
|
insSign = 0xC0
|
||||||
insLoadKey = 0xD0
|
insLoadKey = 0xD0
|
||||||
insDeriveKey = 0xD1
|
insDeriveKey = 0xD1
|
||||||
insStatus = 0xF2
|
insStatus = 0xF2
|
||||||
deriveP1Assisted = uint8(0x01)
|
P1DeriveKeyFromMaster = uint8(0x00)
|
||||||
deriveP1Append = uint8(0x80)
|
P1DeriveKeyFromParent = uint8(0x01)
|
||||||
deriveP2KeyPath = uint8(0x00)
|
P1DeriveKeyFromCurrent = uint8(0x10)
|
||||||
deriveP2PublicKey = uint8(0x01)
|
deriveP1Assisted = uint8(0x01)
|
||||||
statusP1WalletStatus = uint8(0x00)
|
deriveP1Append = uint8(0x80)
|
||||||
statusP1Path = uint8(0x01)
|
deriveP2KeyPath = uint8(0x00)
|
||||||
signP1PrecomputedHash = uint8(0x01)
|
deriveP2PublicKey = uint8(0x01)
|
||||||
signP2OnlyBlock = uint8(0x81)
|
statusP1WalletStatus = uint8(0x00)
|
||||||
exportP1Any = uint8(0x00)
|
statusP1Path = uint8(0x01)
|
||||||
exportP2Pubkey = uint8(0x01)
|
signP1PrecomputedHash = uint8(0x01)
|
||||||
|
signP2OnlyBlock = uint8(0x81)
|
||||||
|
exportP1Any = uint8(0x00)
|
||||||
|
exportP2Pubkey = uint8(0x01)
|
||||||
|
|
||||||
// Minimum time to wait between self derivation attempts, even it the user is
|
// Minimum time to wait between self derivation attempts, even it the user is
|
||||||
// requesting accounts like crazy.
|
// requesting accounts like crazy.
|
||||||
@ -859,11 +862,11 @@ func (s *Session) walletStatus() (*walletStatus, error) {
|
|||||||
if response.Data[2] != 2 || response.Data[3] != 1 || response.Data[5] != 2 || response.Data[6] != 1 || response.Data[8] != 1 || response.Data[9] != 1 {
|
if response.Data[2] != 2 || response.Data[3] != 1 || response.Data[5] != 2 || response.Data[6] != 1 || response.Data[8] != 1 || response.Data[9] != 1 {
|
||||||
return nil, fmt.Errorf("invalid response tag format")
|
return nil, fmt.Errorf("invalid response tag format")
|
||||||
}
|
}
|
||||||
fmt.Println("asn1 response", response)
|
|
||||||
status := &walletStatus{
|
status := &walletStatus{
|
||||||
PinRetryCount: int(response.Data[4]),
|
PinRetryCount: int(response.Data[4]),
|
||||||
PukRetryCount: int(response.Data[7]),
|
PukRetryCount: int(response.Data[7]),
|
||||||
Initialized: (response.Data[10] == 0xff),
|
Initialized: (response.Data[10] == 0xff),
|
||||||
|
SupportsPKDerivation: true, /* Cards that don't aren't supported */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user