Precondition |
RMICardManager Plugin Command |
Command-Description |
Parameter n) is numbering |
Param-Description n) is corresponding numbering |
Required / Optional |
|---|---|---|---|---|---|
| RMICardManager connected (rmi>) | clear | Clears the list of remote objects and methods currently known by the plugin. usage: clear |
|||
| RMICardManager connected (rmi>) | invoke | Invokes a previously defined remote method. Optionally, the return value can be stored in a
JCShell variable for later referencing. If a remote object reference is returned, it is automatically added to the list of objects known by this plugin. usage: invoke [-r|--return-value variable-name] ID [parameter..] |
1) -r|--return-value variable-name 2) ID 3) parameter.. |
1) Defines a JCShell variable that receives the return value of the remote method.
This is either the HEX string representing the return value (for basic return
types), the object ID if an object reference is returned, the string "null" if
null is returned or a zero length string if the return type is void. If an
exception/error occurs an appropriate exeption/error string is set. variable-name: The JCShell variable to receive the return value. 2) Method identifer of the remote method to be invoked. 3) List of method parameters. parameter: The method parameter. Parameters are to be defined as HEX strings representing the parameter values whereas null array references are represented by the string "null". Boolean values must be '00' (false) or '01' (true). |
1+3) optional / 2) required |
| RMICardManager connected (rmi>) | list | Lists the remote objects and methods currently known by the plugin. usage: list |
|||
| RMICardManager connected (rmi>) | method | Defines a remote method for a particular remote object. Optionally, the method ID can
be stored in a JCShell variable for later referencing. usage: method [-m|--method-id variable-name] OID method-name method-signature |
1) -m|--method-id variable-name 2) OID 3) method-name 4) method-signature |
1) Defines a JCShell variable that receives the method ID of the newly defined remote method. variable-name: The JCShell variable to receive the method ID. 2) Object reference identifer of the remote object this method belongs to (use the list command to list known object references). 3) The name of this remote method. 4) The signature of this remote method in the form: [ The return type must be either one of the basic types (byte; byte[]; short; short[]; boolean; boolean[]) or a fully qualified class name (e.g. java.rmi.Remote) indicating an object reference. Parameters can be of basic type (as listed above) only. The type void can be omitted. Examples: "byte[](byte[],short,short)" "()" "java.rmi.Remote(short)" |
1) optional / 2-4) required |
| RMICardManager connected (rmi>) | object | Allows to explicitely define remote objects within the plugin. This command should not be used
under normal cicumstances. usage: object [-c|--with-class][-i|--ins-byte ins-byte] FCI-or-descriptor |
1) -c|--with-class 2) -i|--ins-byte ins-byte 3) FCI-or-descriptor |
1) Defines that the object descriptor format >>with class<< is to be used. By default the
format >>with interfaces<< is used. 2) Defines the INVOKE instruction byte to be used. This option is only applicable if an object descriptor is used to describe the object. By default instruction byte 0x38 is used. ins-byte: Instruction byte (HEX). 3) The FCI or descriptor data (HEX) which describes the object to be created. |
1-2) optional / 3) required |
Load a RMIApplet with SampleInterface which is a result of the JCOP wizard.
The interface has only one method "sampleMethod "declared.
public short sampleMethod( short sh );
package com.ibm.rmi;
import javacard.framework.Applet;
import javacard.framework.service.CardRemoteObject;
import javacard.framework.service.Dispatcher;
import javacard.framework.service.RMIService;
import javacard.framework.APDU;
/**
* @author
*
*/
public class RmiApplet extends Applet implements SampleInterface {
private Dispatcher dispatcher;
private RmiApplet() {
CardRemoteObject.export(this);
dispatcher = new Dispatcher((short) 1);
dispatcher.addService(new RMIService(this), Dispatcher.PROCESS_COMMAND);
}
public static void install(byte[] bArray, short bOffset, byte bLength) {
new RmiApplet()
.register(bArray, (short) (bOffset + 1), bArray[bOffset]);
}
public void process(APDU apdu) {
dispatcher.process(apdu);
}
/**
* method from interface "SampleInterface"
* return sh * 2
*
* @param short sh: input value
* @return short
*/
public short sampleMethod( short sh ) {
return (short) (sh * 2) ;
}
}
- /term "Remote|localhost:8050"
--Opening terminal
> /card -a a000000003000000 -c com.ibm.jc.CardManager
resetCard with timeout: 0 (ms)
--Waiting for card...
ATR=3B E9 00 00 81 31 FE 45 4A 43 4F 50 34 31 56 32 32 A7
ATR: T=1, N=0, IFSC=254, BWI=4/CWI=5, Hist="JCOP41V22"
=> 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00 ..............
(0 msec)
<= 6F 10 84 08 A0 00 00 00 03 00 00 00 A5 04 9F 65 01 FF 90 00 ....
Status: No Error
cm> set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
cm> init-update 255
=> 80 50 00 00 08 FE BE 3E 77 46 67 BB 2E 00
(15 msec)
<= 00 00 55 B7 21 6C 62 5F C5 4E FF 02 00 00 93 73 3A B8 2C 0F 4B 2D 41 BC 3F 6C 5B 52 90 00
Status: No Error
cm> ext-auth plain
=> 84 82 00 00 10 40 98 F2 F9 F9 0E 19 64 98 7A 61 1A 53 E4 D5 88
(0 msec)
<= 90 00 ..
Status: No Error
cm> upload -d -b 250 "C:\Dokumente und Einstellungen\hruf\runtime-workspace\rmi\bin\com\ibm\rmi\javacard\rmi.cap"
=> 80 E6 02 00 14 07 54 45 53 54 52 4D 49 08 A0 00 ......TESTRMI...
00 00 03 00 00 00 00 00 00 00 ..........
(0 msec)
<= 00 90 00 ...
Status: No Error
=> 80 E8 00 00 FA C4 82 01 67 01 00 1D DE CA FF ED ........g.......
02 02 06 00 01 07 54 45 53 54 52 4D 49 0B 63 6F ......TESTRMI.co
6D 2F 69 62 6D 2F 72 6D 69 02 00 21 00 1D 00 21 m/ibm/rmi..!...!
00 0E 00 20 00 32 00 40 00 4A 00 0A 00 12 00 05 ... .2.@.J......
00 8E 02 B8 00 00 00 00 00 00 03 01 00 04 00 20 ...............
03 00 01 07 A0 00 00 00 62 00 03 02 01 07 A0 00 ........b.......
00 00 62 01 01 00 01 08 A0 00 00 00 62 01 01 01 ..b.........b...
03 00 0E 01 0A 54 45 53 54 52 4D 49 2E 30 31 00 .....TESTRMI.01.
25 06 00 40 00 02 02 44 A1 80 00 0F 53 61 6D 70 %..@...D....Samp
6C 65 49 6E 74 65 72 66 61 63 65 22 81 03 01 00 leInterface"....
01 07 02 00 00 00 39 00 42 00 04 01 08 80 00 00 ......9.B.......
01 97 9C 00 00 08 00 09 52 6D 69 41 70 70 6C 65 ........RmiApple
74 01 00 04 07 00 4A 00 04 10 18 8C 00 03 18 8D t.....J.........
00 04 18 8F 00 0B 3D 04 8C 00 09 87 00 AD 00 8F ......=.........
00 08 3D 18 8C 00 02 05 8B 00 05 7A 05 30 8F 00 ..=........z.0..
06 3D 8C 00 07 18 1D 04 41 18 1D 25 8B 00 0A 00 .=......A..%....
(16 msec)
<= 00 90 00 ...
Status: No Error
=> 80 E8 00 01 FA 7A 02 20 AD 00 19 8B 00 01 7A 02 .....z. ......z.
21 05 31 1D 1E 45 78 08 00 0A 00 00 00 00 00 00 !.1..Ex.........
00 00 00 00 0A 00 05 01 00 04 00 00 05 00 32 00 ..............2.
0C 02 00 17 00 03 82 06 04 06 82 04 00 06 81 03 ................
00 06 82 05 01 03 82 06 01 01 00 17 00 06 00 00 ................
01 01 82 04 00 06 82 06 00 03 81 03 02 01 82 06 ................
00 09 00 12 00 03 15 02 25 00 0B 05 04 04 05 07 ........%.......
05 04 06 04 0A 09 0B 00 8E 02 00 C1 00 04 00 00 ................
00 00 01 00 41 00 00 00 1A 00 00 00 00 00 00 01 ....A...........
01 00 17 02 00 01 00 04 00 04 80 00 00 02 00 17 ................
00 00 1C FF 82 00 01 00 20 00 22 00 00 00 00 00 ........ .".....
09 00 25 00 22 00 12 00 00 00 00 07 01 00 39 00 ..%.".........9.
25 00 07 00 00 00 00 08 01 00 42 00 1A 00 06 00 %.........B.....
00 00 00 00 0C 00 1C 00 25 00 29 00 20 00 29 00 ........%.). .).
2D FF FF 00 20 FF FF 00 32 00 22 FF FF 02 44 05 -... ...2."...D.
68 20 60 01 10 04 B4 31 06 68 10 A1 06 68 00 00 h `....1.h...h..
(16 msec)
<= 00 90 00 ...
Status: No Error
=> 80 E8 00 02 FA 01 07 68 20 03 10 02 41 0C 02 B8 .......h ...A...
00 1E 00 1B 63 6F 6D 2F 69 62 6D 2F 72 6D 69 2F ....com/ibm/rmi/
53 61 6D 70 6C 65 49 6E 74 65 72 66 61 63 65 00 SampleInterface.
10 6A 61 76 61 2F 6C 61 6E 67 2F 4F 62 6A 65 63 .java/lang/Objec
74 00 14 53 61 6D 70 6C 65 49 6E 74 65 72 66 61 t..SampleInterfa
63 65 2E 6A 61 76 61 00 0F 6A 61 76 61 2F 72 6D ce.java..java/rm
69 2F 52 65 6D 6F 74 65 00 0C 73 61 6D 70 6C 65 i/Remote..sample
4D 65 74 68 6F 64 00 04 28 53 29 53 00 15 63 6F Method..(S)S..co
6D 2F 69 62 6D 2F 72 6D 69 2F 52 6D 69 41 70 70 m/ibm/rmi/RmiApp
6C 65 74 00 19 6A 61 76 61 63 61 72 64 2F 66 72 let..javacard/fr
61 6D 65 77 6F 72 6B 2F 41 70 70 6C 65 74 00 0E amework/Applet..
52 6D 69 41 70 70 6C 65 74 2E 6A 61 76 61 00 0A RmiApplet.java..
64 69 73 70 61 74 63 68 65 72 00 27 4C 6A 61 76 dispatcher.'Ljav
61 63 61 72 64 2F 66 72 61 6D 65 77 6F 72 6B 2F acard/framework/
73 65 72 76 69 63 65 2F 44 69 73 70 61 74 63 68 service/Dispatch
65 72 3B 00 06 3C 69 6E 69 74 3E 00 03 28 29 00 er;....().
(0 msec)
<= 00 90 00 ...
Status: No Error
=> 80 E8 00 03 FA 56 00 04 74 68 69 73 00 17 4C 63 .....V..this..Lc
6F 6D 2F 69 62 6D 2F 72 6D 69 2F 52 6D 69 41 70 om/ibm/rmi/RmiAp
70 6C 65 74 3B 00 07 69 6E 73 74 61 6C 6C 00 07 plet;..install..
28 5B 42 53 42 29 56 00 06 62 41 72 72 61 79 00 ([BSB)V..bArray.
02 5B 42 00 07 62 4F 66 66 73 65 74 00 01 53 00 .[B..bOffset..S.
07 62 4C 65 6E 67 74 68 00 01 42 00 07 70 72 6F .bLength..B..pro
63 65 73 73 00 1C 28 4C 6A 61 76 61 63 61 72 64 cess..(Ljavacard
2F 66 72 61 6D 65 77 6F 72 6B 2F 41 50 44 55 3B /framework/APDU;
29 56 00 04 61 70 64 75 00 19 4C 6A 61 76 61 63 )V..apdu..Ljavac
61 72 64 2F 66 72 61 6D 65 77 6F 72 6B 2F 41 50 ard/framework/AP
44 55 3B 00 02 73 68 00 02 62 31 00 0B 63 6F 6D DU;..sh..b1..com
2F 69 62 6D 2F 72 6D 69 00 1D 00 02 00 00 06 21 /ibm/rmi.......!
00 04 00 01 00 02 01 00 00 00 01 00 03 00 04 00 ................
05 04 01 00 00 00 00 00 00 00 00 00 00 06 00 21 ...............!
00 17 00 07 00 08 02 00 01 00 04 00 00 00 03 00 ................
09 00 0A 00 02 00 00 00 00 00 0B 00 0C 00 02 00 ................
(0 msec)
<= 00 90 00 ...
Status: No Error
=> 80 E8 80 04 CF 00 01 02 00 22 00 01 00 05 00 00 ........."......
0D 00 0E 00 00 00 22 00 00 00 03 00 13 00 04 00 ......".........
07 00 14 00 08 00 12 00 15 00 13 00 20 00 16 00 ............ ...
21 00 21 00 17 00 0F 00 10 00 09 00 25 02 00 12 !.!.........%...
00 03 00 03 00 00 11 00 12 00 00 00 12 01 00 13 ................
00 14 00 00 00 12 02 00 15 00 16 00 00 00 12 00 ................
00 00 06 00 1A 00 07 00 10 00 1B 00 11 00 11 00 ................
1C 00 17 00 18 00 01 00 39 02 00 07 00 02 00 02 ........9.......
00 00 0D 00 0E 00 00 00 07 01 00 19 00 1A 00 00 ................
00 07 00 00 00 05 00 1F 00 06 00 06 00 20 00 04 ............. ..
00 05 00 01 00 42 02 00 06 00 03 00 02 00 00 0D .....B..........
00 0E 00 00 00 06 01 00 1B 00 14 00 00 00 06 02 ................
00 1C 00 14 00 02 00 04 00 00 00 01 00 2A 00 02 .............*..
00 05 00 2B 00 ...+.
(0 msec)
<= 00 90 00 ...
Status: No Error
Load report:
1207 bytes loaded in 0.2 seconds
effective code size on card:
+ package AID 7
+ applet AIDs 17
+ classes 67
+ methods 77
+ statics 0
+ exports 8
------------------------------
overall 176 bytes
cm> install -i 54455354524d492e3031 -q C9#() 54455354524d49 54455354524d492e3031
=> 80 E6 0C 00 24 07 54 45 53 54 52 4D 49 0A 54 45 ....$.TESTRMI.TE
53 54 52 4D 49 2E 30 31 0A 54 45 53 54 52 4D 49 STRMI.01.TESTRMI
2E 30 31 01 00 02 C9 00 00 00 .01.......
(0 msec)
<= 90 00 ..
Status: No Error
cm> card-info
=> 80 F2 80 00 02 4F 00 00 .....O..
(0 msec)
<= 08 A0 00 00 00 03 00 00 00 01 9E 90 00 .............
Status: No Error
=> 80 F2 40 00 02 4F 00 00 ..@..O..
(16 msec)
<= 0A 54 45 53 54 52 4D 49 2E 30 31 07 00 90 00 .TESTRMI.01....
Status: No Error
=> 80 F2 10 00 02 4F 00 00 .....O..
(0 msec)
<= 07 A0 00 00 00 03 53 50 01 00 01 08 A0 00 00 00 ......SP........
03 53 50 41 07 54 45 53 54 52 4D 49 01 00 01 0A .SPA.TESTRMI....
54 45 53 54 52 4D 49 2E 30 31 90 00 TESTRMI.01..
Status: No Error
Card Manager AID : A000000003000000
Card Manager state : OP_READY
Application: SELECTABLE (--------) "TESTRMI.01"
Load File : LOADED (--------) A0000000035350 (Security Domain)
Module : A000000003535041
Load File : LOADED (--------) "TESTRMI"
Module : "TESTRMI.01"
cm> /sel |TESTRMI.01
=> 00 A4 04 00 0A 54 45 53 54 52 4D 49 2E 30 31 00 .....TESTRMI.01.
(7594 msec)
<= 6F 21 6E 1F 5E 1D 02 02 38 81 DE 47 00 0B 63 6F o!n.^...8..G..co
6D 2F 69 62 6D 2F 72 6D 69 09 52 6D 69 41 70 70 m/ibm/rmi.RmiApp
6C 65 74 90 00 let..
Status: No Error
Remote Object:
JC RMI server applet: "TESTRMI.01"
JC RMI version: '0202'
INVOKE instruction byte: '38'
Remote ref. ID: 'DE47'
Hash modifier: 'null'
Class: com.ibm.rmi.RmiApplet
rmi> method -m meth_sample DE47 sampleMethod "short(short)"
rmi> /list-vars
Global:____________________________________________
meth_sample=979C
rmi> list
------- Remote Object 1 -------
Remote Object:
JC RMI server applet: "TESTRMI.01"
JC RMI version: '0202'
INVOKE instruction byte: '38'
Remote ref. ID: 'DE47'
Hash modifier: 'null
Class: com.ibm.rmi.RmiApplet
Remote Method:
Name: sampleMethod
Signature: short(short)
Descriptor: (S)S
ID: '979C'
rmi> invoke -r req_result ${meth_sample} 1000
=> 00 38 02 02 06 DE 47 97 9C 10 00 00
(11297 msec)
<= 81 20 00 90 00 . ...
Status: No Error
Return value: 2000