diff options
author | Guillaume Ballet <gballet@gmail.com> | 2019-03-24 00:13:02 +0800 |
---|---|---|
committer | Guillaume Ballet <gballet@gmail.com> | 2019-04-08 19:21:22 +0800 |
commit | 714675cd2a4b3099a021fdb9b9b779be276926d9 (patch) | |
tree | b304a83437203def730f34a23a5cff89ec135c7b /accounts | |
parent | 35b80f18656437784238320b7258627ab8af5a93 (diff) | |
download | go-tangerine-714675cd2a4b3099a021fdb9b9b779be276926d9.tar go-tangerine-714675cd2a4b3099a021fdb9b9b779be276926d9.tar.gz go-tangerine-714675cd2a4b3099a021fdb9b9b779be276926d9.tar.bz2 go-tangerine-714675cd2a4b3099a021fdb9b9b779be276926d9.tar.lz go-tangerine-714675cd2a4b3099a021fdb9b9b779be276926d9.tar.xz go-tangerine-714675cd2a4b3099a021fdb9b9b779be276926d9.tar.zst go-tangerine-714675cd2a4b3099a021fdb9b9b779be276926d9.zip |
Upgrade to keycard app v2.1.1
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/scwallet/README.md | 13 | ||||
-rw-r--r-- | accounts/scwallet/wallet.go | 27 |
2 files changed, 16 insertions, 24 deletions
diff --git a/accounts/scwallet/README.md b/accounts/scwallet/README.md index b5f79149b..582b921bd 100644 --- a/accounts/scwallet/README.md +++ b/accounts/scwallet/README.md @@ -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 diff --git a/accounts/scwallet/wallet.go b/accounts/scwallet/wallet.go index 95a832543..82ba4b3af 100644 --- a/accounts/scwallet/wallet.go +++ b/accounts/scwallet/wallet.go @@ -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) - return nil, err - }*/ + status := new(walletStatus) + if _, err := asn1.UnmarshalWithParams(response.Data, status, "tag:3"); err != nil { + return nil, err + } return status, nil } |