### GpjNG tutorial

 connect to an actively running simplytapp simulator:java -jar gpj.jar -t 192.168.0.102:3000 should return something like this:Found card in terminal: SimplyTapp ATR: 3B 00 > help (list all commands)help put-key (list put-key details)>help /select reset the card with /atr:>/atr ATR: 3B 00 > reset the card and select into card manager with /card:>/card ATR: 3B 00 Command APDU: 00 A4 04 00 07 A0 00 00 01 51 00 00 Response APDU: 6F 0F 84 08 A0 00 00 01 51 00 00 A5 04 9F 65 01 FF 90 00 (61 ms) Successfully selected Security Domain GP211 A0 00 00 01 51 00 00 > authenticate to the card and open a secure channel with the set keys with auth [enc|mac|plain] [keyset]>auth Command APDU: 80 50 00 00 08 0B BD E5 4F 71 A8 7A 0C Response APDU: 00 00 00 00 00 00 00 00 00 00 FF 02 00 00 6C 55 44 79 7A 91 11 33 50 82 BB 4D 38 5E 90 00 (87 ms) Command APDU: 84 82 00 00 10 20 81 D5 47 A5 06 A3 FC E1 4F CE 56 41 62 57 6C Response APDU: 90 00 (7 ms) >auth enc Command APDU: 80 50 00 00 08 E8 E3 C0 63 E7 72 A8 E5 Response APDU: 00 00 00 00 00 00 00 00 00 00 FF 02 00 01 2A A2 AB 70 03 9C 61 40 07 F0 A4 4B 5E EA 90 00 (7 ms) Command APDU: 84 82 03 00 10 87 63 38 B3 7F 2D 0D 81 76 2F BF 30 D6 56 09 6E Response APDU: 90 00 (11 ms) > change the keys on the card with put-key. in this example we are going to add a keyset to the card.the parameters are:-m (mode) addfollowed by 3 keys in this format:1/1/DES/ffffffffffffffffffffffffffffffff ^ ^ ^ ^ | | | +- 16 bytes of new key data | | +- key type (DES|DES-ECB|DES-CBC) | +- key id (1-ENC or 2-MAC or 3-DEK) +- key set id (1 through 127) >put-key -m add 1/1/DES/ffffffffffffffffffffffffffffffff 1/2/DES/ffffffffffffffffffffffffffffffff 1/3/DES/ffffffffffffffffffffffffffffffff Command APDU: 80 D8 00 81 43 01 81 10 DA 43 DD 48 30 F8 DD 5A DA 43 DD 48 30 F8 DD 5A 03 CA AA AF 81 10 DA 43 DD 48 30 F8 DD 5A DA 43 DD 48 30 F8 DD 5A 03 CA AA AF 81 10 DA 43 DD 48 30 F8 DD 5A DA 43 DD 48 30 F8 DD 5A 03 CA AA AF Response APDU: 01 CA AA AF CA AA AF CA AA AF 90 00 (7 ms) > set the keys for the shell to use during auth routines:>set-key 1/1/DES/ffffffffffffffffffffffffffffffff 1/2/DES/ffffffffffffffffffffffffffffffff 1/3/DES/ffffffffffffffffffffffffffffffff >auth plain 1 Command APDU: 80 50 01 00 08 2F 30 48 4B 84 54 F3 2D Response APDU: 00 00 00 00 00 00 00 00 00 00 01 02 00 01 5D CA B0 2A 0E 3D E6 02 5F DA 59 3D DC 45 90 00 (7 ms) Command APDU: 84 82 00 00 10 8F 6B C5 43 40 83 F4 06 EF C1 16 0B B9 19 EC 7E Response APDU: 90 00 (7 ms) > set a script variable:>/set-var path "c:\my\path\to\script\" > run a script called "test.jcsh" from the path above:>test install an applet in the card manager# install -i C9#([install-params]) # # We allow use of a pipe symbol in these commands which converts ascii # symbols into hex. For example: # # |com.st is shorthand for: 636f6d2e7374 # |CardApplet is shorthand for: 436172644170706c6574 >install -i A0000000031010 -q C9#() |com.st |CardApplet Command APDU: 80 E6 0C 00 20 06 63 6F 6D 2E 73 74 0A 43 61 72 64 41 70 70 6C 65 74 07 A0 00 00 00 03 10 10 01 00 02 C9 00 00 Response APDU: 00 90 00 (89 ms) > delete a registered applet from the card manager# #delete [-r|--delete-related] # delete -r A0000000031010 /selectselect#/select #escape secure channel encoding (send raw) # #select #encode with secure channel protocol # >/select a0000000031010 Command APDU: 00 A4 04 00 07 A0 00 00 00 03 10 10 Response APDU: 90 00 (7 ms) > /sendsend#/send #escape secure channel encoding (send raw) # #send #encode with secure channel protocol # >/send 00a4040007a000000003101000 Command APDU: 00 A4 04 00 07 A0 00 00 00 03 10 10 00 Response APDU: 90 00 (5 ms) > exit shell>exit