good morning!!!!

Skip to content
Snippets Groups Projects
Commit 42c76a2b authored by Guillaume Ballet's avatar Guillaume Ballet
Browse files

Temporary fix to the ADBU status call

parent 5617dca1
Loading
......@@ -847,10 +847,31 @@ func (s *Session) walletStatus() (*walletStatus, error) {
if err != nil {
return nil, err
}
status := new(walletStatus)
if _, err := asn1.UnmarshalWithParams(response.Data, status, "tag:3"); err != nil {
return nil, err
// There is an issue with ASN1 decoding that I am struggling with,
// so I unpack it manually, like is being done in the status-im
// card management code.
if len(response.Data) != int(response.Data[1])-1 {
return nil, fmt.Errorf("invalid response length %d", len(response.Data))
}
if response.Data[0] != 0xA3 {
return nil, fmt.Errorf("invalid tag %v, expected 0xA3", response.Data[0])
}
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")
}
fmt.Println("asn1 response", response)
status := &walletStatus{
PinRetryCount: int(response.Data[4]),
PukRetryCount: int(response.Data[7]),
Initialized: (response.Data[10] == 0xff),
}
/*
if _, err := asn1.Unmarshal(response.Data, status); err != nil {
//if _, err := asn1.UnmarshalWithParams(response.Data, status, "tag:3"); err != nil {
fmt.Println("###### asn1 err", err)
return nil, err
}*/
return status, nil
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment