Upgrade to keycard app v2.1.1

This commit is contained in:
Guillaume Ballet 2019-03-23 17:13:02 +01:00
parent 35b80f1865
commit 714675cd2a
2 changed files with 16 additions and 24 deletions

View File

@ -7,7 +7,7 @@
## 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.
@ -23,6 +23,17 @@
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

View File

@ -849,30 +849,11 @@ func (s *Session) walletStatus() (*walletStatus, error) {
if 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")
}
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)
status := new(walletStatus)
if _, err := asn1.UnmarshalWithParams(response.Data, status, "tag:3"); err != nil {
return nil, err
}*/
}
return status, nil
}