Commit 714675cd authored by Guillaume Ballet's avatar Guillaume Ballet

Upgrade to keycard app v2.1.1

parent 35b80f18
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
## Preparing the smartcard ## Preparing the smartcard
You can use status' [keycard-cli](https://github.com/status-im/keycard-cli) and you should get version 2.1 (**NOT** 2.1.1, this will be supported in a later update) of their [smartcard application](https://github.com/status-im/status-keycard/releases/download/2.1/keycard_v2.1.cap) You can use status' [keycard-cli](https://github.com/status-im/keycard-cli) and you should get version 2.1.1 of their [smartcard application](https://github.com/status-im/status-keycard/releases/download/2.1.1/keycard_v2.1.1.cap)
You also need to make sure that the PCSC daemon is running on your system. You also need to make sure that the PCSC daemon is running on your system.
...@@ -23,6 +23,17 @@ ...@@ -23,6 +23,17 @@
keycard init keycard init
``` ```
Finally, you need to have the card generate a new master key:
```
keycard shell <<END
keycard-select
keycard-set-pairing PAIRING_KEY PAIRING_INDEX
keycard-open-secure-channel
keycard-verify-pin CARD_PIN
keycard-generate-key
END
```
## Usage ## Usage
......
...@@ -849,30 +849,11 @@ func (s *Session) walletStatus() (*walletStatus, error) { ...@@ -849,30 +849,11 @@ func (s *Session) walletStatus() (*walletStatus, error) {
if err != nil { if err != nil {
return nil, err 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")
}
status := &walletStatus{
PinRetryCount: int(response.Data[4]),
PukRetryCount: int(response.Data[7]),
Initialized: (response.Data[10] == 0xff),
}
/* status := new(walletStatus)
if _, err := asn1.Unmarshal(response.Data, status); err != nil { if _, err := asn1.UnmarshalWithParams(response.Data, status, "tag:3"); err != nil {
//if _, err := asn1.UnmarshalWithParams(response.Data, status, "tag:3"); err != nil { return nil, err
fmt.Println("###### asn1 err", err) }
return nil, err
}*/
return status, nil return status, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment