Git Product home page Git Product logo

keycard-cli's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

keycard-cli's Issues

keycard-generate-mnemonic not found

Having the script file generate-mnemonic.sh:

keycard-select
keycard-set-secrets 123456 12345678 abcdefg
keycard-pair

keycard-open-secure-channel
keycard-verify-pin {{ session_pin }}

keycard-generate-mnemonic

Then run:

keycard shell -l debug < generate-mnemonic.sh

Gives an error.

ERROR[12-02|20:31:58.447] error executing command                  package=status-go/cmd/keycard command=shell error="command not found: keycard-generate-mnemonic"

Error executing this command "keycard init -l debug"

Dear all,
Do you know how to manage this error ? (Windows10 with keycard.exe 64bits installed)

Thanks a lot !

\Users\valen\Desktop>keycard info
�[32mINFO �[0m[07-08|17:30:52.129] waiting for a card                       �[32mpackage�[0m=status-go/cmd/keycard
�[32mINFO �[0m[07-08|17:30:52.157] card found                               �[32mpackage�[0m=status-go/cmd/keycard �[32mindex�[0m=0
�[32mINFO �[0m[07-08|17:30:52.160] info started                             �[32mpackage�[0m=status-go/cmd/keycard
�[32mINFO �[0m[07-08|17:30:52.162] select keycard applet                    �[32mpackage�[0m=status-go/cmd/keycard
�[32mINFO �[0m[07-08|17:30:52.181] select cash applet                       �[32mpackage�[0m=status-go/cmd/keycard
Keycard Applet:
  Installed: true
  Initialized: false
  Key Initialized: false
  InstanceUID: 0x
  SecureChannelPublicKey: 0x0458fdfaa9a447ec4faa12d
  Version: 0x
  AvailableSlots: 0x
  KeyUID: 0x
  Capabilities:
    Secure channel:true
    Key management:false
    Credentials Management:true
    NDEF:false
Cash Applet:
  Installed: true
  PublicKey: 0x0435b4d3
  Address: 0x7f3a56
  Public Data: 0x
  Version: 0x0300

C:\Users\valen\Desktop>keycard init -l debug
�[32mINFO �[0m[07-08|17:31:06.004] waiting for a card                       �[32mpackage�[0m=status-go/cmd/keycard
�[32mINFO �[0m[07-08|17:31:06.030] card found                               �[32mpackage�[0m=status-go/cmd/keycard �[32mindex�[0m=0
�[36mDEBUG�[0m[07-08|17:31:06.032] using reader                             �[36mpackage�[0m=status-go/cmd/keycard �[36mname�[0m="ACS CCID USB Reader 0"
�[36mDEBUG�[0m[07-08|17:31:06.036] connecting to card                       �[36mpackage�[0m=status-go/cmd/keycard �[36mreader�[0m="ACS CCID USB Reader 0"
�[36mDEBUG�[0m[07-08|17:31:06.323] card protocol                            �[36mpackage�[0m=status-go/cmd/keycard �[36mT�[0m=1
�[32mINFO �[0m[07-08|17:31:06.323] initialization started                   �[32mpackage�[0m=status-go/cmd/keycard
�[32mINFO �[0m[07-08|17:31:06.366] select keycard applet                    �[32mpackage�[0m=status-go/cmd/keycard
�[36mDEBUG�[0m[07-08|17:31:06.366] apdu command                             �[36mpackage�[0m=io                    �[36mhex�[0m="00 A4 04 00 09 A0 00 00 08 04 00 01 01 01 00"
�[36mDEBUG�[0m[07-08|17:31:06.392] apdu response                            �[36mpackage�[0m=io                    �[36mhex�[0m="80 41 04 58 FD FA A9 A4 47 EC 4F AA 12 D3 3D 51 B6 05 08 9D EC 7B 96 A9 B0 88 5E 6F E5 AA 83 01 8A FD 55 C5 7F E7 69 16 7B 94 B7 54 83 15 87 B4 E8 53 1D 26 64 5C 5D C3 58 10 C2 29 61 54 FC 35 F9 96 80 90 00"
�[32mINFO �[0m[07-08|17:31:06.393] initializing                             �[32mpackage�[0m=status-go/cmd/keycard
�[36mDEBUG�[0m[07-08|17:31:06.393] apdu command                             �[36mpackage�[0m=io                    �[36mhex�[0m="80 FE 00 00 92 41 04 6D 03 78 73 92 13 F8 30 CF 28 2E 53 9F D2 1E C2 82 6D 10 A9 0C BD 6C 82 68 6A 05 AF C8 3C 3B 73 89 6A 9E F8 81 5D 95 12 45 20 8F 0E 7D 41 7D CD D7 47 88 59 A9 06 68 AB 2C 6B A1 BC 16 82 E8 49 53 CE 92 5E C0 BF 02 F0 F3 68 0B C1 7E E0 20 AA E1 F6 9E BE 15 E3 EE 4C C8 D2 50 85 9B 8D 1B 49 D7 55 54 F9 4C 82 FA C9 81 A8 DC 83 CA 99 CF C6 20 30 D8 0B 0F 99 E2 9E E1 28 26 64 FA BB 9D 60 C6 27 D7 29 71 26 62 3B EA DE A5 B0 A7 B5 2A 0A"
�[31mERROR�[0m[07-08|17:31:06.571] error executing command                  �[31mpackage�[0m=status-go/cmd/keycard �[31mcommand�[0m=init �[31merror�[0m="scard: error(c000002b): winapi error #3221225515"

C:\Users\valen\Desktop>keycard init
�[32mINFO �[0m[07-08|17:35:11.165] waiting for a card                       �[32mpackage�[0m=status-go/cmd/keycard
�[32mINFO �[0m[07-08|17:35:11.190] card found                               �[32mpackage�[0m=status-go/cmd/keycard �[32mindex�[0m=0
�[32mINFO �[0m[07-08|17:35:11.477] initialization started                   �[32mpackage�[0m=status-go/cmd/keycard
�[32mINFO �[0m[07-08|17:35:11.519] select keycard applet                    �[32mpackage�[0m=status-go/cmd/keycard
�[32mINFO �[0m[07-08|17:35:11.546] initializing                             �[32mpackage�[0m=status-go/cmd/keycard
�[31mERROR�[0m[07-08|17:35:11.722] error executing command                  �[31mpackage�[0m=status-go/cmd/keycard �[31mcommand�[0m=init �[31merror�[0m="scard: error(c000002b): winapi error #3221225515"

pairing key encoding/hex: invalid byte

I am unable to access my keycard using this software. When I enter my pairing code it gives this error:

encoding/hex: invalid byte: and the first letter of the pairing key.

Seems like its expecting me to enter it in hexadecimal. Why not accept plain text, as this is what humans use?

Adopt a CLI specific library

At the moment the arguments are read and parsed using os.Args. This approach leaves little room for improvement of the CLI tools.

I suggest the adoption of a specialized library, like github.com/spf13/cobra or github.com/urfave/cli. A huge number of improvements would be possible out of the box.

Please refer to their documentation for an extensive list of features.

Unable to install Keycard Apple on NXP J3R180 Java card

rutvishah@Rutvis-Laptop keycard % ./keycard install -l debug -a keycard.cap -f INFO [07-10|17:44:25.562] waiting for a card package=status-go/cmd/keycard INFO [07-10|17:44:25.565] card found package=status-go/cmd/keycard index=0 DEBUG[07-10|17:44:25.565] using reader package=status-go/cmd/keycard name="SCM Microsystems Inc. SCR 3310" DEBUG[07-10|17:44:25.565] connecting to card package=status-go/cmd/keycard reader="SCM Microsystems Inc. SCR 3310" DEBUG[07-10|17:44:25.565] card protocol package=status-go/cmd/keycard T=1 INFO [07-10|17:44:25.566] installation started package=status-go/cmd/keycard INFO [07-10|17:44:25.566] check if keycard is already installed package=status-go/cmd/keycard DEBUG[07-10|17:44:25.566] apdu command package=io hex="00 A4 04 00 09 A0 00 00 08 04 00 01 01 01 00" DEBUG[07-10|17:44:25.579] apdu response package=io hex="6A 82" INFO [07-10|17:44:25.579] select ISD package=status-go/cmd/keycard DEBUG[07-10|17:44:25.579] apdu command package=io hex="00 A4 04 00 00" DEBUG[07-10|17:44:25.595] apdu response package=io hex="6F 10 84 08 A0 00 00 01 51 00 00 00 A5 04 9F 65 01 FF 90 00" INFO [07-10|17:44:25.595] opening secure channel package=status-go/cmd/keycard DEBUG[07-10|17:44:25.596] apdu command package=io hex="80 50 00 00 08 A9 73 FA 95 E6 AC 10 97 00" DEBUG[07-10|17:44:25.656] apdu response package=io hex="00 00 23 45 56 41 81 20 48 39 01 03 10 71 E4 AF 02 AB 6E 19 2C 42 02 70 69 C6 E8 E7 75 00 00 04 90 00" DEBUG[07-10|17:44:25.656] initialize session package=keycard/globalplatform keys=keycard ERROR[07-10|17:44:25.656] open secure channel failed package=status-go/cmd/keycard error="bad response 9000: bad data length, expected 28, got 32" ERROR[07-10|17:44:25.656] error executing command package=status-go/cmd/keycard command=install error="bad response 9000: bad data length, expected 28, got 32"

Applet AID mismatch between CLI and cap file

The CLI expects the applets to have AIDS :

A0 00 00 08 04 00 01 01 01
A0 00 00 08 04 00 01 02 01
A0 00 00 08 04 00 01 03 01
A0 00 00 08 04 00 01 04 01

But the CAP file distributed by keycard (https://github.com/status-im/keycard-cli/releases)
is configured in such a way that the applets will have the following AIDs when they are installed:

A0 00 00 08 04 00 01 01
A0 00 00 08 04 00 01 02
A0 00 00 08 04 00 01 03
A0 00 00 08 04 00 01 04

eg without the last '01'

As a result keycard CLI cannot interface the card

[32mINFO ←[0m[11-17|08:58:33.615] select keycard applet                    ←[32mpackage←[0m=keycard-cli
←[36mDEBUG←[0m[11-17|08:58:33.618] apdu command                             ←[36mpackage←[0m=keycard-go/io ←[36mhex←[0m="00 A4 04 00 09 A0 00 00 08 04 00 01 01 01 00"
←[36mDEBUG←[0m[11-17|08:58:33.641] apdu response                            ←[36mpackage←[0m=keycard-go/io ←[36mhex←[0m="6A 82"
←[32mINFO ←[0m[11-17|08:58:33.641] select cash applet                       ←[32mpackage←[0m=keycard-cli
←[36mDEBUG←[0m[11-17|08:58:33.643] apdu command                             ←[36mpackage←[0m=keycard-go/io ←[36mhex←[0m="00 A4 04 00 09 A0 00 00 08 04 00 01 03 01 00"
←[36mDEBUG←[0m[11-17|08:58:33.659] apdu response                            ←[36mpackage←[0m=keycard-go/io ←[36mhex←[0m="6A 82"

There doesn't seem to have any way to configure the keycard CLI to change the AIDs (eg they are hardcoded)

Unpair a client when no available slots

I've been playing with keycard-cli, following this tutorial. Despite I've run the commands always with a keycard-unpair {{ session_pairing_index }} command, the AvailableSlots indicator was in decrease.

Right now the card has no available slots and I have no idea how can I really unpair the slots. As a last resort, I've tried to:

./keycard-cli shell <<END
  keycard-select
  keycard-set-secrets 123 1234 dnaxx
  keycard-open-secure-channel
  keycard-verify-pin {{ session_pin }}
  keycard-unpair {{ session_pairing_index }}
END

but the API returns

cannot open secure channel without setting pairing info

Install fails

I have "white" card (from Prague) and install with cli fails for me:

Card info:

$ ./keycard info -l trace
INFO [04-17|18:17:43.333] waiting for a card                       package=status-go/cmd/keycard
INFO [04-17|18:17:43.335] card found                               package=status-go/cmd/keycard index=0
DEBUG[04-17|18:17:43.335] using reader                             package=status-go/cmd/keycard name="ACS ACR 38U-CCID"
DEBUG[04-17|18:17:43.335] connecting to card                       package=status-go/cmd/keycard reader="ACS ACR 38U-CCID"
DEBUG[04-17|18:17:43.336] card protocol                            package=status-go/cmd/keycard T=1
INFO [04-17|18:17:43.337] info started                             package=status-go/cmd/keycard
INFO [04-17|18:17:43.337] select keycard applet                    package=status-go/cmd/keycard
DEBUG[04-17|18:17:43.337] apdu command                             package=io                    hex="00 A4 04 00 09 A0 00 00 08 04 00 01 01 01 00"
DEBUG[04-17|18:17:43.351] apdu response                            package=io                    hex="6A 82"
Installed: false
Initialized: false
InstanceUID: 0x
SecureChannelPublicKey: 0x
Version: 0x
AvailableSlots: 0x
KeyUID: 0x
Capabilities:
  Secure channel:false
  Key management:false
  Credentials Management:false
  NDEF:false

Delete command:

$ ./keycard delete -l trace
INFO [04-17|18:20:41.454] waiting for a card                       package=status-go/cmd/keycard
INFO [04-17|18:20:41.456] card found                               package=status-go/cmd/keycard index=0
DEBUG[04-17|18:20:41.456] using reader                             package=status-go/cmd/keycard name="ACS ACR 38U-CCID"
DEBUG[04-17|18:20:41.456] connecting to card                       package=status-go/cmd/keycard reader="ACS ACR 38U-CCID"
DEBUG[04-17|18:20:41.458] card protocol                            package=status-go/cmd/keycard T=1
INFO [04-17|18:20:41.458] select ISD                               package=status-go/cmd/keycard
DEBUG[04-17|18:20:41.458] apdu command                             package=io                    hex="00 A4 04 00 00"
DEBUG[04-17|18:20:41.471] apdu response                            package=io                    hex="6F 10 84 08 A0 00 00 01 51 00 00 00 A5 04 9F 65 01 FF 90 00"
INFO [04-17|18:20:41.471] opening secure channel                   package=status-go/cmd/keycard
DEBUG[04-17|18:20:41.471] apdu command                             package=io                    hex="80 50 00 00 08 52 E4 DE D9 D5 82 AE E3 00"
DEBUG[04-17|18:20:41.531] apdu response                            package=io                    hex="00 00 72 01 00 98 25 07 24 13 FF 02 02 41 BD FE 35 61 B2 3C 25 C8 75 C7 F7 62 FF 5A 90 00"
DEBUG[04-17|18:20:41.531] initialize session                       package=keycard/globalplatform keys=keycard
DEBUG[04-17|18:20:41.531] initialize session                       package=keycard/globalplatform keys=globalplatform
DEBUG[04-17|18:20:41.531] wrapping apdu command                    package=keycard/globalplatform hex="84 82 01 00 08 C8 D6 A3 53 2C 8C C7 89"
DEBUG[04-17|18:20:41.531] apdu command                             package=io                     hex="84 82 01 00 10 C8 D6 A3 53 2C 8C C7 89 CD 31 8C 29 59 02 08 DE"
DEBUG[04-17|18:20:41.569] apdu response                            package=io                     hex="90 00"
INFO [04-17|18:20:41.569] delete old version                       package=status-go/cmd/keycard
DEBUG[04-17|18:20:41.569] wrapping apdu command                    package=keycard/globalplatform hex="80 E4 00 00 09 4F 07 D2 76 00 00 85 01 01"
DEBUG[04-17|18:20:41.569] apdu command                             package=io                     hex="84 E4 00 00 11 4F 07 D2 76 00 00 85 01 01 FB 0B EF 58 52 12 EB B4"
DEBUG[04-17|18:20:41.605] apdu response                            package=io                     hex="6A 88"
DEBUG[04-17|18:20:41.605] wrapping apdu command                    package=keycard/globalplatform hex="80 E4 00 00 0B 4F 09 A0 00 00 08 04 00 01 01 01"
DEBUG[04-17|18:20:41.605] apdu command                             package=io                     hex="84 E4 00 00 13 4F 09 A0 00 00 08 04 00 01 01 01 20 95 87 B8 53 89 C9 60"
DEBUG[04-17|18:20:41.642] apdu response                            package=io                     hex="6A 88"
DEBUG[04-17|18:20:41.642] wrapping apdu command                    package=keycard/globalplatform hex="80 E4 00 00 09 4F 07 A0 00 00 08 04 00 01"
DEBUG[04-17|18:20:41.642] apdu command                             package=io                     hex="84 E4 00 00 11 4F 07 A0 00 00 08 04 00 01 F6 B5 15 BA 3C 85 94 7C"
DEBUG[04-17|18:20:41.791] apdu response                            package=io                     hex="69 85"
ERROR[04-17|18:20:41.791] delete keycard instances and package failed package=status-go/cmd/keycard  error="bad response 6985: unexpected response"
ERROR[04-17|18:20:41.791] error executing command                  package=status-go/cmd/keycard  command=delete error="bad response 6985: unexpected response"

Install command:

$ ./keycard install -l trace -a ~/Downloads/keycard_v2.2.1.cap
INFO [04-17|18:18:02.513] waiting for a card                       package=status-go/cmd/keycard
INFO [04-17|18:18:02.515] card found                               package=status-go/cmd/keycard index=0
DEBUG[04-17|18:18:02.515] using reader                             package=status-go/cmd/keycard name="ACS ACR 38U-CCID"
DEBUG[04-17|18:18:02.515] connecting to card                       package=status-go/cmd/keycard reader="ACS ACR 38U-CCID"
DEBUG[04-17|18:18:02.517] card protocol                            package=status-go/cmd/keycard T=1
INFO [04-17|18:18:02.517] installation started                     package=status-go/cmd/keycard
INFO [04-17|18:18:02.517] check if keycard is already installed    package=status-go/cmd/keycard
DEBUG[04-17|18:18:02.517] apdu command                             package=io                    hex="00 A4 04 00 09 A0 00 00 08 04 00 01 01 01 00"
DEBUG[04-17|18:18:02.532] apdu response                            package=io                    hex="6A 82"
INFO [04-17|18:18:02.532] select ISD                               package=status-go/cmd/keycard
DEBUG[04-17|18:18:02.532] apdu command                             package=io                    hex="00 A4 04 00 00"
DEBUG[04-17|18:18:02.544] apdu response                            package=io                    hex="6F 10 84 08 A0 00 00 01 51 00 00 00 A5 04 9F 65 01 FF 90 00"
INFO [04-17|18:18:02.544] opening secure channel                   package=status-go/cmd/keycard
DEBUG[04-17|18:18:02.545] apdu command                             package=io                    hex="80 50 00 00 08 EB 4C 9C 5C EB D2 95 24 00"
DEBUG[04-17|18:18:02.604] apdu response                            package=io                    hex="00 00 72 01 00 98 25 07 24 13 FF 02 02 3D AF A6 18 57 08 D5 77 C3 D0 D5 4E 7C 5E F4 90 00"
DEBUG[04-17|18:18:02.604] initialize session                       package=keycard/globalplatform keys=keycard
DEBUG[04-17|18:18:02.604] initialize session                       package=keycard/globalplatform keys=globalplatform
DEBUG[04-17|18:18:02.605] wrapping apdu command                    package=keycard/globalplatform hex="84 82 01 00 08 CD 84 3C 31 27 C8 17 BD"
DEBUG[04-17|18:18:02.605] apdu command                             package=io                     hex="84 82 01 00 10 CD 84 3C 31 27 C8 17 BD 1B 66 2D 15 29 55 BB E3"
DEBUG[04-17|18:18:02.642] apdu response                            package=io                     hex="90 00"
INFO [04-17|18:18:02.642] delete old version (if present)          package=status-go/cmd/keycard
DEBUG[04-17|18:18:02.642] wrapping apdu command                    package=keycard/globalplatform hex="80 E4 00 00 09 4F 07 D2 76 00 00 85 01 01"
DEBUG[04-17|18:18:02.642] apdu command                             package=io                     hex="84 E4 00 00 11 4F 07 D2 76 00 00 85 01 01 DB 23 50 8C 23 8B 3C 61"
DEBUG[04-17|18:18:02.678] apdu response                            package=io                     hex="6A 88"
DEBUG[04-17|18:18:02.678] wrapping apdu command                    package=keycard/globalplatform hex="80 E4 00 00 0B 4F 09 A0 00 00 08 04 00 01 01 01"
DEBUG[04-17|18:18:02.678] apdu command                             package=io                     hex="84 E4 00 00 13 4F 09 A0 00 00 08 04 00 01 01 01 8A 77 41 51 91 C1 98 58"
DEBUG[04-17|18:18:02.714] apdu response                            package=io                     hex="6A 88"
DEBUG[04-17|18:18:02.714] wrapping apdu command                    package=keycard/globalplatform hex="80 E4 00 00 09 4F 07 A0 00 00 08 04 00 01"
DEBUG[04-17|18:18:02.714] apdu command                             package=io                     hex="84 E4 00 00 11 4F 07 A0 00 00 08 04 00 01 C1 C6 62 2E 8F B9 E9 46"
DEBUG[04-17|18:18:02.865] apdu response                            package=io                     hex="69 85"
ERROR[04-17|18:18:02.865] delete keycard instances and package failed package=status-go/cmd/keycard  error="bad response 6985: unexpected response"
ERROR[04-17|18:18:02.865] error executing command                  package=status-go/cmd/keycard  command=install error="bad response 6985: unexpected response"

keycard CLI 64 bits windows installer detected as a potential virus by virus total

image

This is what virus total displays when the installer is scanned (keycard-windows-amd64.exe)
The date: 14 November 2023

Either it is a false positive, or somehow a tampered version is present in the download website.
5 AVs that detects the presence on a virus in virus total is 7% which is already not a simple problem. (usually on virus total a false positive is a virus detection by just one AV )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.