Precondition |
JCShell Command |
Command-Description |
Parameter n) is numbering |
Param-Description n) is corresponding numbering |
Required / Optional |
|---|---|---|---|---|---|
| help ? |
Displays available commands (if is used without parameters) or syntax information for a particular command. List of CardManager-Commands or help to those commands are available only when CardManager has been activated (prompt is cm>). |
Command | display usage of desired command e.g. "help /mode" |
Optional | |
| quit | Exit JCShell | ||||
| version | Display the current jcshell program version and it's build timestamp. | ||||
| > | Redirect shell output. usage: > {0|1|2|3} [-|[+]file] |
1) [0|1|2|3] 2) - 3) file 4) +file |
1) select default output channels (0=no output, 1=stdout, 2=logfile, 3=stdout and log file 2) close log file 3) create log file 4) append to log file |
1) Required 2-4) Optional |
|
| /applet | Switch to specified applet plugin. By default a new instance of the desired plugin is created.
If a plugin instance (with the same nickname) currenlty active onanother logical channel is to be reused, then the reuse option must be set.
Reusing might make sense when communicating with a multi-selectable applet. If no nickname is provided, all registered plugins are listed. usage: /applet [nickname [--reuse|-r]] |
1) nickname 2) --reuse|-r |
1) nickname of the specified plugin 2) Reuse another logical channel for a currenlty active plugin instance with the same nickname. |
1) Required / 2) Optional | |
| Terminal connected (>) | /atr | Resets the card (requests an Answer To Reset) without selecting an applet. Waiting for card with timeout only with given param. Uses only the reader selected with term-command. usage: /atr [[-t|time num[s|ms]]] examples: /atr --> no wait for card insertion /atr time 10 --> waits max. 10 sec. for card insertion /atr time 50ms --> waits max. 50 millisec. for card insertion |
-t|time num[s|ms] | Wait specified time until card is inserted (num = number of seconds or milliseconds) | Optional |
| variable "bugz-classpath" set before |
/bugz | Starting a BUGZ-Session Required: set variable "bugz-classpath" with the path to bugz and JRE before: /set-var bugz-classpath "c:/Projekte/ibm/nJCOP/lib/bugz.jar;c:/jdk1.4.2_04/lib/tools.jar" |
|||
| existing CAP-File | /cap-clear | Remove DAP and Delegated Management information from a CAP-file. usage: /cap-clear [-p|--package package-name] CAP-file |
1) -p|--package package-name 2) CAP-file |
1) Specify the Java package name to search for in the CAP-file. If this option isn't set, the information for the first package found will be removed (package-name --> Java package name). 2) CAP filename |
1) Optional / 2) Required |
| existing CAP-File | /cap-info | Displays information about a particular CAP-file. usage: /cap-info [-p|--package package-name] CAP-file e.g. /cap-info "C:/Projecte/testen/bin/showBug/javacard/showBug.cap" |
1) -p|--package package-name 2) CAP-file |
1) Specify the Java package name to search for in the CAP-file. If this option isn't set, the first package found will be examined (package-name --> Java package name). Wrong package name results in "Incomplete CAP file, missing mandatory component: Header.cap at com.ibm.jc.CapFile.loadCode(CapFile.java:444)" 2) CAP-filename |
1) Optional / 2) Required |
| existing CAP-File | /cap-inst-auth | Authorize a package in a CAP-file for delegated installation of an applet of this package. The resulting Install Token information is stored in the CAP-file. usage: /cap-inst-auth [-e|--delegation][-l|--cm-lock][-t|--terminate][-d|--default][-c|--pin-change][-s|--security-domain][-b|--sd-dap] [-m|--mandated-dap][-p|--package package-name][-i|--instaid AID][-u|--params parameters][-n|--tokenpin PIN][-f|--target CAP-file] applet-AID CAP-file tokenspec Possible token definitions are: "pkcs11:<dllname>" | "windows" | "<PKCS#12-file>" | "<PKCS#8-file>" | "<hex-signature>". |
1) -e|--delegation 2) -l|--cm-lock 3) -t|--terminate 4) -d|--default 5) -c|--pin-change 6) -s|--security-domain 7) -b|--sd-dap 8) -m|--mandated-dap 9) -p|--package package-name 10) -i|--instaid AID 11) -u|--params parameters 12) -n|--tokenpin PIN 13) -f|--target CAP-file 14) applet-AID 15) CAP-file 16) tokenspec |
1) Security Domain with delegated management. 2) Card Manager lock permission. 3) Card terminate permission. 4) Implicit selectable (default) applet. 5) PIN change permission. 6) A Security Domain. 7) Security Domain with DAP verification. 8) Security Domain with mandated DAP verification. 9) Specify the Java package name to search for in the CAP-file. If this option isn't set, the first package found will be authorized for delegated installation (package-name --> Java package name). 10) Specify the desired instance AID (applet AID is default). AID --> Instance AID. 11) Application and/or system specific install parameters in TLV format. Tags: 0xC9 - application specific parameters 0xEF - system specific parametes: 0xC6 - non volatile code space limit 0xC7 - volatile data space limit 0xC8 - non volatile data space limit (parameters --> Install parameters (TLV format)). 12) Specify the PIN to open the token. Only used if token is PIN protected (PIN --> PIN to open the token referenced by tokenspec). 13) If the CAP-file to be authorized shall not be modified this option can be used to specify the location and name of the target CAP-file (CAP-file --> File name of the authorized CAP-file). 14) AID of the applet in the package to be installed. 15) CAP filename 16) Specify the token holding the private key to be used for signature generation. The string "windows" means to search your Windows system (CAPI) for a private key. You can also pass the signature directly. |
1-13) Optional / 14-) Required |
| existing CAP-File | /cap-load-auth | Authorize a package in a CAP-file for delegated loading. The resulting Load Token information is stored in the CAP-file. usage: /cap-load-auth [-p|--package package-name][-i|--tokenpin PIN][-s|--sdaid AID][-l|--params parameters][-t|--target CAP-file] CAP-file tokenspec Possible token definitions are: "pkcs11:<dllname>" | "windows" | "<PKCS#12-file>" | "<PKCS#8-file>" | "<hex-signature>". |
1) -p|--package package-name 2) -i|--tokenpin PIN 3) -s|--sdaid AID 4) -l|--params parameters 5) -t|--target CAP-file 6) CAP-file 7) tokenspec |
1) Specify the Java package name to search for in the CAP-file. If this option isn't set, the first package found will be authorized for delegated loading (package-name --> Java package name). 2) Specify the PIN to open the token. Only used if token is PIN protected (PIN --> PIN to open the token referenced by tokenspec). 3) Specify the AID of the Security Domain to be associated with the package and it's applications (Card Manager is default) (AID --> AID of Security Domain). 4) Load parameters (parameters --> Load parameters in raw (TLV) format). 5) If the CAP-file to be authorized shall not be modified this option can be used to specify the location and name of the target CAP-file (CAP-file --> File name of the authorized CAP-file). 6) CAP filename 7) Specify the token holding the private key to be used for signature generation. The string "windows" means to search your Windows system (CAPI) for a private key. You can also pass the signature directly. |
1-5) Optional / 6-) Required |
| existing CAP-File | /cap-sign | Sign a package in a CAP-file. The resulting DAP information is stored in the CAP-file. Note: Signing a CAP-file implies invalidating (removing) all Load/Install Tokens in the CAP-file. usage: /cap-sign [-d|--debug][-p|--package package-name][-i|--tokenpin PIN][-t|--target CAP-file][-a|--algorithm VOP201|GP211] CAP-file AID tokenspec |
1) -d|--debug 2) -p|--package package-name 3) -i|--tokenpin PIN 4) -t|--target CAP-file 5) -a|--algorithm VOP201|GP211 6) CAP-file 7) AID 8) tokenspec |
1) If this option is set, the DESCRIPTOR/DEBUG components are included in the signatue. 2) Specify the Java package name to search for in the CAP-file. If this option isn't set, the first package found will be signed (package-name --> Java package name). 3) Specify the PIN to open the token. Only used if token is PIN protected (PIN --> PIN to open the token referenced by tokenspec). 4) If the CAP-file to be signed shall not be modified this option can be used to specify the location and name of the target (signed) CAP-file (CAP-file --> File name of the signed CAP-file). 5) Defines whether the DAP generation algorithm defined in VOP 2.0.1' or the one defined in Global Platform 2.1.1 is to be used. The default value is VOP201 (VOP201|GP211 --> DAP generation algorithm). 6) CAP filename 7) AID of Security Domain to verify this signature. 8) Specify the token holding the key to be used for signature generation. In case of PK DAP possible token definitions are: "pkcs11:<dllname>" | "windows" | "<PKCS#12-file>" | "<PKCS#8-file>" | "<hex-signature>". For symetric DAP the tokenspec must be the 16 byte DES key (as HEX string) to be used for DAP generation. The string "windows" means to search the Windows system (CAPI) for a private key. You can also pass the signature directly. |
1-5) Optional / 6-) Required |
| Terminal connected (>) | /card | Resets the inserted card, gets the ATR and selects the CardManager (default=GlobalPlatform CardManager) via the default logical channel (zero). Uses only the reader selected with term-command. usage: /card [-t|time num[s|ms]][-c|card-manager class-name][-a|card-manager-aid aid][-v|--verbose] Optionally: - wait for insertion, - define a card manager AID and/or a specific Card Manager implementation. The default Card Manager AID is 0xA000000003000000 and the default implementation behaves in accordance with Global Plaform 2.1.1 (VOP 2.0.1'). This command implicitely registers the Card Manager plugin referencing the desired Card Manager implementation with the JCShell under the nickname "cm". examples: /card -a a000000003000000 -c com.ibm.jc.CardManager --> selects the default Card Manager and reset card with timeout: 0 (ms) /card -t 10ms --> selects the default Card Manager and reset card with timeout: 10 (ms) |
1) -t|time num[s|ms] 2) -c|card-manager class-name 3) -a|card-manager-aid aid 4) -v|--verbose |
1) Wait specified time until card is inserted (num = number of seconds or milliseconds) on the selected reader. 2) Defines which off-card Card Manager implementation to use. class-name --> Class which implements the Card Manager (subclassed com.ibm.jc.CardManager). 3) Desired Card Manager AID to be used. aid --> Card Manager AID 4) Print some FCI information. |
Optional |
| connected to a card (cm>) | /channel | List applets (JCShellPlugins) and their channels usage: /channel [<0-3>] ISO 7816-4/Global Platform MANAGE CHANNEL command. Either opens the next available supplementary logical channel or closes the current logical channel. Upon opening a channel the new channel becomes the current channel. Upon closing a supplementary channel the default channel (zero) becomes the current channel. If no channel parameter is provided, this command only lists the logical channels currently open. The channel with the "*" is the one currently active within the JCShell. |
<0-3> | Logical channel to switch to. | Optional |
| /clear-vars | Clear variable pool usage: /clear-vars (see also: /list-vars or /set-var) |
||||
| Terminal or card connected (> / cm>) | /close | Closes the connection to the terminal (also card disconnection). Terminal now is waiting for new connections. | |||
| /dialog | Display message dialog and wait for OK. usage: /dialog [-V|--split-value][-c|--choice][-s|--sound sound][-l|--loop][title [text [label..]* examples: /dialog Title Message Yes No Cancel --> Display a Dialog with 3 buttons "Yes", "No" and "Cancel" --> If a button has the name "Cancel" and will be selected then NULL is returned otherwise the name of the selected button.
|
1) -V|--split-value 2) -c|--choice 3) -s|--sound sound 4) -l|--loop 5) title 6) text 7) label |
1) Arguments list label/value pairs - return value separated from displayed label 2) Display a list of choices instead of many buttons 3) Play some sounds while dialog is showing 4) Play sound in a loop 5) Dialog heading 6) message text 7) Text of button or choice |
||
| /echo | Arguments to be output/echoed. usage: /echo[-0|1|2|3] args.. |
1) [-0|1|2|3] 2) args.. |
1) Channel selector - will not be echoed (ee also: redirection) 2) This content will be echoed! |
Optional | |
| /error | Abort execution of DEFUN or SCRIPT and set arguments as error string (${last.error} - can be checked in try/catch). usage: /error args.. |
args.. | Error code | Required | |
| /exec | Execute/kill/wait a subprocess. usage: /exec [[-a|--async][-s|--silent][-l|--label label][-k|--kill][command [argument..]* |
1) -a|--async 2) -s|--silent 3) -l|--label label 4) -k|--kill 5) command 6) argument.. |
1) Start process asynchronously 2) Suppress process output 3) Attach this label to identify process 4) Kill process - pass label as command name. Omitted command kills all processes. 5) Command. Omitted command/args kills or lists all processes. 6) List of arguments to pass on to process. |
Optional | |
| /expr | Arguments are evaluated as expression and the result is set as return value. usage: /expr args.. examples: X=$(/expr ${X} + 1) --> increment internal variable "X" |
args | Argument list | Optional | |
| /glob | Collect all file name matching given patterns and as return value. E.g. X[*]=$(/glob *.jcsh) usage: /glob pattern.. |
pattern.. | Filename pattern | Required | |
| Card connected | /identify | Show card information data (only if card is connected). usage: identify [-q] |
-p | Shows only the APDU-buffer without interpretion. | Optional |
| /list-vars | Displays matching/all JCShell internal variables, e.g. keys. usage: /list-vars [[pattern|!pattern]..] (see also: /clear-vars or /set-var) |
[pattern|!pattern].. | List only variables matching the listed patterns. A leading !means the pattern must not match the variable name. | Optional | |
| Card connected | /manage-channel | ISO 7816-4/Global Platform MANAGE CHANNEL command. Either opens the next available supplementary logical channel or closes the current logical channel. Upon opening a channel the new channel becomes the current channel. Upon closing a supplementary channel the default channel (zero) becomes the current channel. usage: /manage-channel open|close |
open|close | open --> opens the next available supplementary logical channel close --> closes the current logical channel |
Required |
| /mode | Set the JCShell mode of operation, e.g., whether full APDU command tracing shall be enabled or not. usage: /mode [trace=on|off|num][echo=on|off][verbose=on|off][debug=on|off] |
1) trace=on|off|num 2) echo=on|off 3) verbose=on|off 4) debug=on|off |
1) Turn APDU tracing on/off or log at most num lines of each APDU 2) Echo command lines 3) Turn verbose mode on/off 4) Turn debug mode on/off |
Optional | |
| /printf | Format args according to format specification (like C printf). usage: /printf [-0|1|2|3] format args.. %x %X : format argument as lowercase/uppercase hexadecimal number %d %u : format argument as decimal number (signed/unsigned) %s : format argument as a string %Ns : N is a decimal number or '*', specifies padding width. * reads padding from respetive argument list %.Ms : M is a decimal number or '*', specifies maximum item length. * reads max length from respetive argument list %N.Ms : truncate string to M chars and pad to length N %-Ns : string is left aligned, padding to the right %+Ns : string is right aligned, padding to the left (default if +/- is missing) %|Ns : string is centered, padding on both sides %0Ns : pad with zero characters %[C]Ns : pad with C character, C can be any character \[rnt] : replace with carriage return, line feed, and tab |
1) [-0|1|2|3] | 1) the logical channel number | 1) Optional / 2-) Required | |
| /register | Without param: List the applets introduce to the shell. With param: Introduce an applet to the shell. The meaning of "applet" is a JCShellPlugin - a class with additional JCShell commands. usage: /register [name aid [plugin] ] |
1) name 2) aid 3) plugin |
1) Nick name of the applet 2) AID data (syntax see :send) 3) A fully qualified class name specifying a class implementing com.ibm.jc.tools.JCShellPlugin interface. If omitted com.ibm.jc.tools.OPAppletPlugin is used. The class com.ibm.jc.tools. |
Optional | |
| RemoteJCTerminal connected | /remote | Send commands to nJCOP simulation and print returned information. Some commands also set a return value. This command is for development purposes only. usage: /remote [-0|1|2|3] command... nJCOP simulation command list (some commands depends on configuration):
examples: /remote imon --> open the communication with HAL imonitor; prompts with "jcop>" in Eclipse-Console --> see following IMON session: JCOP imonitor session example |
1) [-0|1|2|3] 2) command... |
1) select default output channels (0=no output, 1=stdout, 2=logfile, 3=stdout and log file 2) List of commands can be retrieved from halio.c |
1) Optional 2) Required |
| /robot | Include java.awt.Robot class functionality. This class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed. The primary purpose of Robot is to facilitate automated testing of Java platform implementations. Using the class to generate input events differs from posting events to the AWT event queue or AWT components in that the events are generated in the platform's native input queue. For example, Robot.mouseMove will actually move the mouse cursor instead of just generating mouse move events. Note that some platforms require special privileges or extensions to access low-level input control. If the current platform configuration does not allow input control, an AWTException will be thrown when trying to construct Robot objects. For example, X-Window systems will throw the exception if the XTEST 2.2 standard extension is not supported (or not enabled) by the X server. usage: /robot click <x> <y> usage: /robot type [<strings>]+ (emacs-like syntax: C-x2 M-TAB RET...) usage: /robot getcolor <x> <y> [<var>] usage: /robot getscreen <x> <y> <w> <h> [<var>] usage: /robot waitscreen <x> <y> <w> <h> <hash> <timeout (ms)> |
1) click <x> <y> 2) type [<strings>]+ 3) getcolor <x> <y> [<var>] 4) getscreen <x> <y> <w> <h> [<var>] 5) waitscreen <x> <y> <w> <h> <hash> <timeout (ms)> |
1) click simulate a single mouse click at the given x-y-position. 2) type keys. Possible keynames are all number and digits, special characters and predefined: "RET", "ESC", "SPC", "TAB", "DEL", "LEFT", "RIGHT", "DOWN", "UP", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12" You may use the following modifiers: "S-" --> shift "A-" --> alt "M-" --> alt "C-" --> cntrl 3) getcolor read the pixel color at the given x-y-position. If "var" was specified save the color-value in the given variable otherwise print out. 4) getscreen get screen hash. Compute CCITT-CRC for RGB values of specified screen rectangle. If "var" was specified save the value in the given variable otherwise print out. 5) waitscreen wait (poll 1/10 sec) for specified screen hash (HEX-chars) at the specified screen rectangle. Wait time is given timeout (default 100 ms). |
||
| /r-echo | Echo arguments to be output (remotely). usage: /r-echo args.. |
args.. | Arguments to be echoed | Optional | |
| Card connected (cm>) | /select | Selects the applet with the given AID on the card either on the current logical channel or optionally on another, possibly new, logical channel. If the target channel is already open the assigned applet plugin, if any, is reused. If the select FCI returned by the applet includes a remote object reference and there is no applet plugin selected or the current applet plugin is the Card Manager plugin, then it is automatically switched to the JCRMI plugin. usage: /select AID [<0-3>] examples: /select |TESTA.01 --> selects applet with AID 0x54455354412E3031 APDU is: 00 A4 04 00 08 54 45 53 54 41 2E 30 31 00 |
1) AID 2) <0-3> |
1) AID (HEX) of applet to be selected. Prefixing the AID with "|" converts the given ASCII-String into HEX-Code. 2) Target logical channel (current channel is default). | 1) Required / 2) Optional |
| CardManager connected (cm>) | /send | Send an APDU unconditional, bypassing the plugin(s), using negotiated protocol/channel or raw. usage: /send [-r|--raw][nad=NAD][-t|--timeout num] apdu [pattern..] examples: "/send 0102|ab|03 04|cd" ==> 01 02 61 62 03 04 63 64 "/send 01#(|ab|#{FE FF})" ==> 01 05 61 62 02 FE FF |
1) -r|--raw 2) nad=NAD 3) -t|--timeout num 4) apdu 5) pattern.. |
1) data is sent in raw mode (not encapsulated in any protocol)
2) APDU is sent to this node address (T=1) NAD --> node address (high nibble=DAD, low=SAD) 3) max time to wait for response data in raw mode (time unit is device-dependent) 4) The APDU data to send. Data syntax: HEX[|CHARS[|HEX...]] (see also Data Considerations) 5) Description of expected responses. Each argument is pattern describing response as sequence of hexdigits with embedded wild cards (*,?,[..]). A leading ! char means NOT. Arguments '&' and '|' are interpreted as the respective logical operators. The response is ok if it matches the pattern and the logical expression. |
APDU is required / the rest is optional |
| Card connected | /set-channel | Sets the logical channel number used in any subsequent APDU communication. The CLA byte of any APDU header sent to the card is automatically modified to reflect the logical channel number as defined in ISO 7816-4. Modification only takes place if the original CLA byte indicates channel zero, otherwise the given channel info is maintained. By default the logical channel number is zero. usage: /set-channel [{0|1|2|3}] |
[{0|1|2|3}] | the logical channel number | Optional / default=0 |
| /set-var | Sets the named JCShell internal variable. usage: /set-var [-d|--def][-g|--global][-q|--quote] varname [expr..] (see also: /list-vars or /clear-vars) examples:
|
1) varname 2) -d|--def 3) -g|--global 4) -q|--quote 5) expr.. |
1) Name of the variable. 2) Update/create variable in defining scope. If var not defined use local scope. 3) Update/create variable in global scope 4) Do not evaluate arguments as expression. If multiple arguments create an array. 5) Shell expression |
1) Required 2-5) Optional |
|
| /sleep | Delay execution for given amount of time. usage: /sleep time[s|ms] |
time[s|ms] | Time to sleep. | Required | |
| /terminal | Connects to a given terminal (smart card reader device) or obtains status information if already connected. Select Card-Terminal or Simulation. usage: /terminal [-p|--pop] [term[|term_param]] Create an instance of the specified terminal. The terminal specifier is first checked against the definitions in the system and personal setup files. The referred setup value or the supplied specifier is evaluated as listed below:
|
1) -p|--pop 2) term[|term_param] |
1) Pop top most filter (filter is a terminal) 2) Specify either the name of a terminal or a name plus some terminal parameter. The parameter must be separated by a `|' character. |
Optional | |
| /test-suite | Control test suite (Only for special tests - not inside Eclipse plug-in). usage: /test-suite [[--details][{--test-suite ...|--summary ...|--start-gui|--stop-gui|--open-folder ...|--enlist-test ...|--close-folder|-- test-start ...|--test-passed|--test-not-run|--test-failed ...|--test-not-applicable ...}]] Test suite must be used with multiple calls like: /test-suite --test-suite "My special Tests" "c:/temp/mylog.txt" /test-suite --open-folder "Folder short name" "Folder full name" c:/Projekte/ibm/offcard/tests /test-suite --start-gui /test-suite ...... /test-suite --stop-gui |
1) --details 2) --test-suite short-text [logfile] 3) --summary infomsg 4) --start-gui 5) --stop-gui 6) --open-folder short-text long-text scriptname 7) --enlist-test short-text long-text scriptname funcname 8) --close-folder 9) --test-start scriptname funcname [logfile] 10) --test-passed 11) --test-not-run 12) --test-failed [errmsg] 13) --test-not-applicable scriptname funcname [infomsg] |
1) Show test details. With --summary display state of each test. 2) Announce a new test suite (short-text --> Short descriptive text; logfile --> Log file receiving output of test scripts) 3) Display test summary and update log file (if set) (infomsg --> Information message) 4) Start up GUI for set up test suite. 5) Stop displaying GUI. 6) Open a new test folder and enlist (short-text --> Short descriptive text; long-text --> Long descriptive text; scriptname --> File name of test script) 7) Enlist test in current test folder (short-text --> Short descriptive text; long-text --> Long descriptive text; scriptname --> File name of test script; funcname --> Name of test function) 8) Close current test folder. 9) Test has been started (scriptname --> File name of test script; funcname --> Name of test function; logfile --> Log file receiving output of test scripts) 10) Started test has been completed and passed. 11) Revert state of test to 12) Started test failed(errmsg --> Error message) 13) Test not applicable (scriptname --> File name of test script; funcname --> Name of test function; infomsg --> Information message) |