CITI Previous | Index | Next

Select and Run the Applet

An applet can be set to run whenever the card is powered up. Or you can load multiple applets and select the one you want at run time. We are going to select our applet and send it eight bytes of data to encrypt. Then we will send it the 8 bytes of encrypted data and have it decrypt them.

% sectok
sectok> f #secbdes.bin
sectok> apdu -c 4 e 0 0 8 1 2 3 4 5 6 7 8
1:1f 2:c9 3:7b 4:b9 5:a6 6:d9 7:55 8:e1 
9000 ok
sectok> apdu -c 4 10 0 0 8 1f c9 7b b9 a6 d9 55 e1
1:1 2:2 3:3 4:4 5:5 6:6 7:7 8:8 
9000 ok
sectok> q

Notice that when we sent the encrypted data to the card, we got back the original data. You can try this with less trivial data if you want. The last eight bytes of the APDU is the data.

Now go back and look at the applet source code. Notice that the APDUs that we sent, with INS of 0x0e and 0x10, correspond to the Encrypt and Decrypt cases in the process method.