mclear / OMNI-Ring

Quick setup tutorial on how to set up toolchain & build Javacard applets.
MIT License
35 stars 5 forks source link

Playing with scriptgen to generate scripts to push out to rings #3

Open JohnMcLear opened 5 years ago

JohnMcLear commented 5 years ago

java -jar /home/jose/dev-ring-getting-started/sdks/jc212_kit/lib/scriptgen.jar MyApplet.cap -o test.scr -nobanner -nobeginend

Example of grepped & parsed w/ sed output

// ExampleProject/javacard/Header.cap
80 B2 01 00 00 7F
80 B4 01 00 12 01 00 0F DE CA FF ED 01 02 04 00 00 05 01 02 03 04 05 7F
80 BC 01 00 00 7F

// ExampleProject/javacard/Directory.cap
80 B2 02 00 00 7F
80 B4 02 00 20 02 00 1F 00 0F 00 1F 00 0C 00 15 00 2A 00 0C 00 5D 00 19 00 10 00 00 00 61 00 02 00 01 00 0C 02 7F
80 B4 02 00 02 01 00 7F
80 BC 02 00 00 7F

// ExampleProject/javacard/Import.cap
80 B2 04 00 00 7F
80 B4 04 00 18 04 00 15 02 04 01 07 A0 00 00 00 62 01 01 00 01 07 A0 00 00 00 62 00 01 7F
80 BC 04 00 00 7F

// ExampleProject/javacard/Applet.cap
80 B2 03 00 00 7F
80 B4 03 00 0F 03 00 0C 01 08 01 02 03 04 05 06 07 08 00 13 7F
80 BC 03 00 00 7F

// ExampleProject/javacard/Class.cap
80 B2 06 00 00 7F
80 B4 06 00 0F 06 00 0C 00 80 03 00 FF 00 07 01 00 00 00 21 7F 
80 BC 06 00 00 7F 

// ExampleProject/javacard/Method.cap
80 B2 07 00 00 7F 
80 B4 07 00 20 07 00 5D 00 05 40 18 8C 00 00 18 19 1E 04 41 19 1E 25 8B 00 01 7A 05 30 8F 00 02 3D 18 1D 1E 8C 7F 
80 B4 07 00 20 00 03 3B 7A 05 21 18 8B 00 04 60 03 7A 19 8B 00 05 2D 1A 04 25 75 00 24 00 01 00 00 00 09 7B 00 7F 
80 B4 07 00 20 06 03 1A 08 7B 00 06 92 5B 8D 00 07 3B 19 08 7B 00 06 92 5B 8B 00 08 70 08 11 6D 00 8D 00 09 7A 7F 
80 BC 07 00 00 7F 

// ExampleProject/javacard/StaticField.cap
80 B2 08 00 00 7F 
80 B4 08 00 1C 08 00 19 00 02 00 01 00 01 03 00 0C 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 00 00 00 00 7F 
80 BC 08 00 00 7F 

// ExampleProject/javacard/ConstantPool.cap
80 B2 05 00 00 7F 
80 B4 05 00 20 05 00 2A 00 0A 06 80 03 00 03 80 03 02 01 00 00 00 06 00 00 01 03 80 03 03 03 80 0A 01 05 00 00 7F 
80 B4 05 00 0D 00 06 80 10 01 03 80 0A 08 06 80 07 01 7F 
80 BC 05 00 00 7F 

// ExampleProject/javacard/RefLocation.cap
80 B2 09 00 00 7F 
80 B4 09 00 13 09 00 10 00 00 00 0C 05 0B 06 07 08 07 10 06 05 06 05 08 7F
80 BC 09 00 00 7F 

Unfortunately as I don't have working APDU auth yet I can't test playing this script into a ring ;-(

benbenbenbenbenben commented 4 years ago

See the installForLoad function in node-gp where we build an array of APDUs. This would be 99% of a cap to script tool.

PaddeK commented 4 years ago

Now i finally got node-gp working i could put some time into this. Don't know if i should make a pull request to node-gp with some kind of cap to script export method or start from scratch, what do you guys think?

benbenbenbenbenben commented 4 years ago

Now i finally got node-gp working i could put some time into this. Don't know if i should make a pull request to node-gp with some kind of cap to script export method or start from scratch, what do you guys think?

I'm all for it. It sounds like a useful function to have albeit still dependent on authentication which will have to be dynamic.

In other news it would be great if anyone could give attention to the mobile phone as a PC reader endeavor. This idea overlaps because if we can create a link between Android NFC and "any computer" over webrtc for example (with peerjs and QR codes for pairing?) then we can feasibly allow remote (and thereby support desk friendly) ring admin. As well as removing the need for anyone to buy a dedicated NFC reader.