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:
Guillaume Ballet 2019-03-19 23:14:31 +01:00
parent 42c76a2ba1
commit 7ec6fa03d3

View File

@ -88,6 +88,9 @@ const (
insLoadKey = 0xD0 insLoadKey = 0xD0
insDeriveKey = 0xD1 insDeriveKey = 0xD1
insStatus = 0xF2 insStatus = 0xF2
P1DeriveKeyFromMaster = uint8(0x00)
P1DeriveKeyFromParent = uint8(0x01)
P1DeriveKeyFromCurrent = uint8(0x10)
deriveP1Assisted = uint8(0x01) deriveP1Assisted = uint8(0x01)
deriveP1Append = uint8(0x80) deriveP1Append = uint8(0x80)
deriveP2KeyPath = uint8(0x00) deriveP2KeyPath = uint8(0x00)
@ -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 */
} }
/* /*