OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

OCF Installation - Answers

Frequently Asked Questions

Background and legal details


Installation HOW-TO Section

1: What are the steps for installing OCF on a Unix Workstation

This HOWTO section details the list of commands you will have to launch in order to install OCF on a Unix Workstation (e.g., under Linux, Solaris, AIX, etc.).

Note that the steps below are generic guidelines on how to install a running OCF platform for any type of computer, however, the specified path and idiosyncrasies correspond more to Unix platforms. If you wish to have install instructions dedicated to the Windows platform (e.g., with windows-style PATHs, etc.), please see the next section instead.

The steps are:

  1. Download and install a Java Development Kit (or RunTime Environment)

    • In the Java Distribution Page, select Java for your platform and OS (between Solaris, Linux, and Windows) and download either a JRE (for using only) or a SDK (for developing too). E.g., this gives: '/tmp/j2sdk-1_3_1-linux-i386.bin'

    • Then install Java in '/usr/local/' or anywhere else you might choose:

      
         $ mv -i /tmp/j2sdk-1_3_1-linux-i386.bin /usr/local/
         $ cd /usr/local/
         $ chmod a+x j2sdk-1_3_1-linux-i386.bin
         $ ./j2sdk-1_3_1-linux-i386.bin
         $ mv -i jdk1.3.1 java
         $ PATH=/usr/local/java/bin:$PATH ; export PATH
      

  2. Download and install the Comm API

  3. Download and install the OpenCard Framework

    • In the OCF Distribution Page, select to download "OpenCard Framework Base" Zip'ed, e.g., '/tmp/BaseOCF.zip'

    • install OCF 1.2 core and optional parts:

      
         $ cd /usr/local/
         $ unzip /tmp/BaseOCF.zip
      

    • in the OCF Distribution Page, select to download "The OpenCard Framework Reference Implementaion V1.2" Zip'ed, e.g., '/tmp/Reference_Impl.zip'

    • install OCF 1.2 reference components and demos:

      
         $ cd /usr/local/
         $ unzip /tmp/Reference_Impl.zip
      

    • finally, install all OCF 1.2 JAR files in Java:

      
         $ cd /usr/local/OCF1.2/lib/
         $ cp -i base-core.jar base-opt.jar sb-demo.jar
         /usr/local/java/jre/lib/ext/
      

  4. Download and install the Gemplus Components

    • in the CardTerminals Distribution Page, select to download 'gemplus-terminals-4.1.tar.gz'

    • in the Generic CardServices Distribution Page, select to download 'gemplus-service-0.2.tar.gz'

    • in the GPK CardServices Distribution Page, select to download 'gemplus-gpk-0.2.tar.gz'

    • install the Gemplus components in the centralized OCF zone:

      
         $ cd /usr/local/OCF1.2
         $ gzip -dc /tmp/gemplus-terminals-4.1.tar.gz | tar xvf -
         $ gzip -dc /tmp/gemplus-service-0.2.tar.gz | tar xvf -
         $ gzip -dc /tmp/gemplus-gpk-0.2.tar.gz | tar xvf -
      

    • install all Gemplus JAR files in Java:

      
         $ cd /usr/local/OCF1.2/lib
         $ cp -i gemplus-terminals-4.1.jar gemplus-service-0.2.jar
         gemplus-gpk-0.2.jar /usr/local/java/jre/lib/ext/
      

    • check OCF and Gemplus components (CardTerminal at least) by typing the lines below (Note: the OpenCard.terminals line is not cut):

      
         $ cd /usr/local/OCF1.2/components/sb-demo/src/demos/samples/
         $ emacs opencard.properties
      ------
      OpenCard.services = opencard.opt.util.PassThruCardServiceFactory
      OpenCard.terminals = com.gemplus.opencard.terminal.GemplusCardTermi
      nalFactory|mygcr|GCR410|COM1
      ------
         $ java demos.samples.GetCardID
      

      and insert a card. You should get the card ATR displayed.

    • optionally, you can install a 'gempluscardterminal.properties' file, which can be used for tuning Gemplus CardTerminal parameters.

      
         $ cd /usr/local/java/jre/lib/
         $ emacs gempluscardterminal.properties
      ------
      # If you want to let OCF poll the reader status then add:
      # polling = usespollinglist
      # or to define a thread to poll the reader at sleeptime add:
      polling = usesthread
      #
      # Time used to stop the thread for a period of time (in miliseconds):
      sleeptime = 500
      ------
      

Return to questions

2: What are the steps for installing OCF on a Windows Workstation

This HOWTO section details the list of commands you will have to launch in order to install OCF on a Windows Workstation (e.g., under Win32 system: Win9x, NT or 2000).

We have chosen to give examples using an installation location that is 'C:\ocf', of course you can specify whatever folder name you wish.

The steps are:

  1. Create 'C:\ocf' folder for gathering all necessary software.

  2. Download and install a Java Development Kit (or RunTime Environment)

    • In the Java Distribution Page, select Java for the Windows platform and download either a JRE (for using only) or a SDK (for developing too). E.g., this gives: 'C:\Temp\j2re1_3_1-win.exe'

    • Then install Java in 'C:\ocf\java' or anywhere else you might choose (note that there is no obligation for Java to be installed under the OCF space, you can also choose 'C:\java' etc.).

      
         double-click on j2re1_3_1-win.exe
         select for install folder   C:\ocf\java 

    • check by opening an MSDOS Command Prompt window and type:

      
         > java -verbose -version
      

      to test that Java is found and can be run.

      From now on, if you have installed a Java Runtime Environment (JRE) please replace the 'C:\ocf\java' paths below by the one you actually have, e.g., 'C:\ocf\java\jre1.3'. On the other hand, if you have chosen to install a Java Development Kit (JDK), then replace the 'C:\ocf\java' paths below by your 'jre' portion of the JDK, e.g., 'C:\ocf\java\jdk1.3\jre'.

      So for instance, in the JDK case, when we say 'C:\ocf\java\lib\ext', you should read 'C:\ocf\java\jdk1.3\jre\lib\ext'.

  3. Download and install the Comm API

    • In the Comm API HomePage, select a Java Communications API implementation for Windows. E.g., this will give you: 'C:\Temp\javaxcomm20-win32.zip'

    • install Comm API in 'C:\ocf\commapi'

      1. double-click on 'C:\Temp\javaxcomm20-win32.zip'

      2. extract all files in 'C:\ocf' (this will create a 'C:\ocf\commapi' folder)

      3. then, in an MSDOS Command Prompt window, type:

        
           > cd C:\ocf\commapi\ 
           > copy comm.jar C:\ocf\java\lib\ext\ 
           > copy javax.comm.properties C:\ocf\java\lib\ 
           > copy win32com.dll C:\ocf\java\bin\ 
        

    • check by opening an MSDOS Command Prompt window and type

      
         > cd C:\ocf\commapi\samples\BlackBox\ 
         > java -cp BlackBox.jar BlackBox
      

      to test that Comm API is found and can find the ports.

      Note: if PC/SC is running on your PC (especially in Windows2000, where PC/SC is pre-installed and started by defaults), then you will have to shutdown it; otherwise, as PC/SC locks the ports, you will get a "port in use" execption. To shutdown PC/SC, select Start / ControlPanel / GemplusSmartCardReader, and remove the line corresponding to the port you want to use with OCF.

  4. Download and install the OpenCard Framework

  5. Download and install the Gemplus Components

See also the troubleshooting section below in case of problems.

Return to questions

Installation Troubleshooting

This section gives a list of commands to try in order to see whether each layer of the needed software infrastructure is installed and working properly.

It then gives a list of classical errors you might get and how to fix the related problem.

3: Java test command: java -verbose -version

The following command allows to test that Java has been installed and runs correctly.


	$ java -verbose -version

Return to questions

4: I've got a "command not found" error

If you have an error of the following type:


$ java -verbose -version
java: command not found

Check that Java is installed and in your PATH (e.g., in Unix 'java/bin' or 'java/jre/bin')

Return to questions

5: OpenCard test command: java demos.samples.GetCardID

The following command allows to test that OpenCard and the necessary Java optional part (e.g., Comm API) have all been installed and run correctly.


	$ java demos.samples.GetCardID

Note that here there can be many types of errors when trying to launch this OCF demo. Please see the (non-exhaustive) list below for some possible problems and their solution.

Return to questions

6: I've got a "Can't find class xxx" error

If you have an error of the following type:


$ java demos.samples.GetCardID
Can't find class xxx

Check that all JAR files for OCF "base", "opt", and "demos" parts have been installed (i.e., in 'java/jre/lib/ext'). Check also that the needed components (for your application) have been installed, e.g., "gemplus-terminal", "gemplus-service", and/or "gemplus-gpk".

Return to questions

7: I've got a "property file not found" error

If you have an error of the following type:


------------------------------------------------------------
start use case: get a card ID

OpenCardPropertyLoadingException: 
property file not found

finished use case: get a card ID
------------------------------------------------------------

Check that there is at least one property file that exist and is readable for your current account. In order to find where OCF is looking for 'opencard.properties', you can run the following command:


	$ java demos.tools.findOCP

If findOCP is not yet in your OCF distrib (it is not in the default 1.2 distrib) see the appendix for how to compile and install this useful program (a contrib from Jan Peter Hecking).

See also the "Configuring OCF" section of the Programmer's Guide for a good reference on how to configure the framework (i.e., what information to put in the properties file(s) and where they must be located).

Return to questions

8: I've got a "CardTerminalException: null" error

If you have an error of the following type:


------------------------------------------------------------
start use case: get a card ID

CardTerminalException: 
null

finished use case: get a card ID
------------------------------------------------------------

There are two possible cause for this same message here: one is a mis-installation of the Comm API's properties file, while the other is a bad spelling for the actual serial port you want to use, this name being most of the time dependant on the platform, the OS, and sometimes also on the type of JDK...

  1. Firstly, check that the Comm API layer has been installed, i.e., 'comm.jar' in 'jre/lib/ext', 'javax.comm.properties' in 'jre/lib/', and the '.so' or '.DLL' file (as specified by 'javax.comm.properties') in a location that can be found by the Operating System, e.g., in 'jre/lib/sparc' or 'jre/lib/i386' (respectively on Solaris and Linux) or in 'jre\bin' (on Windows).

    Note: with a properties file but without the '.so' or '.DLL' file , Java can give a different type of error but which still includes the "null" message, e.g., here on Solaris:

    
    	Error loading SolarisSerial: java.lang.UnsatisfiedLinkError:
    	no SolarisSerialParallel in java.library.path
    	Caught java.lang.UnsatisfiedLinkError: readRegistrySerial while 
    	loading	driver com.sun.comm.SolarisDriver
    	CardTerminalException: 
    	null
    

  2. Secondly, if everything is working well at the Comm layer, check that you have not misspelled the name of the serial port you intend to use. These names are different on different platforms, e.g., on Linux, Solaris, or Windows, you can have respectively '/dev/ttyS0' (S1, etc.), '/dev/term/a' (/b, etc.), or 'COM1' (COM2, etc.). Also be warned that the Comm API that comes with JDK1.3 for Linux from IBM is using windows name on Linux :-( (e.g., 'COM1', 'COM2', etc.) so on Linux you should also check which kind of JDK you are using!

    A very convenient way of: 1) finding the available ports and their names and 2) test that you can open them, is actually to try to run one of the demos of the Comm API:

    
    	$ cd commapi/samples/SerialDemo/
    	$ java SerialDemo
    

    which will open a GUI with a menu containing all known ports (if this menu is empty, then the Comm API has not well been installed!). Try to select the one you want to use, Open, then Close the port.

Return to questions

9: I've got a "Can't open Communication port" error

If you have an error of the following type:


------------------------------------------------------------
start use case: get a card ID

CardTerminalException: 
 Can't open Communication port

finished use case: get a card ID
------------------------------------------------------------

Then again, check the name of serial port(s) that is (are) specified in the properties file. For Windows it should be 'COM1', 'COM2', etc. For Linux '/dev/sttyS0', '/dev/sttyS1', etc. and for Solaris '/dev/term/a', '/dev/term/b', etc.

On a Unix platform, check also that the user account you are using has the right to use the ports, i.e., that the file access permissions are as below:


$ ls -ls /dev/ttyS*
   0 crw-rw-rw-    1 root     tty        4,  64 May 31 09:09 /dev/ttyS0
   0 crw-rw-rw-    1 root     tty        4,  65 May 31 09:09 /dev/ttyS1
   0 crw-rw-rw-    1 root     tty        4,  66 May  5  1998 /dev/ttyS2
   0 crw-rw-rw-    1 root     tty        4,  67 May  5  1998 /dev/ttyS3

If not, become root and change the rights.

One good test is to run the Comm API SerialDemo (see paragraph above) to get all the listed ports in a menu which is auto-discovered by the Comm API driver.

Return to questions

10: I've got an "Invalid reader" error

If you have an error of the following type:


------------------------------------------------------------
start use case: get a card ID

CardTerminalException: 
 Invalid reader!

finished use case: get a card ID
------------------------------------------------------------

You get this message when the specification of the reader type in the properties file does not match the actual reader type. First check that the reader type is the one specified. Then, if it is the case, try to reset the card reader (just unplug it and plug it again) because sometimes, either the Gemplus API or PC/SC can switch it to an OROS mode (for legacy applications) that is not coherent with what is declared in the properties file (e.g., GemPC410, for GemCore).

Return to questions

That's the end of the "Installation Troubleshooting" section. There certainly will be other troubleshooting entries added in the future: this page is a work in progress! Do not hesitate to contribute yourself!

Appendix

11: Contrib program: findOCP

In order to install a new program, "findOCP", in your OCF distribution, please follow the guidelines below. This program is a contribution from Jan Peter Hecking that I slightly modified to get platform-dependent file separtors (instead of "\" all the time).

  1. First, edit a file named 'findOCP.java' and include the code below:

    
    import java.io.File;
    import java.util.Properties;
    
    public class findOCP {
        public static void main(String[] argv) {
            final String sep = File.separator;
            Properties props = System.getProperties();
            String JavaHome  = props.getProperty("java.home");
            String UserHome  = props.getProperty("user.home");
            String UserDir   = props.getProperty("user.dir");
    
            System.out.println("Looking for OpenCard Properties file in:\n\t" 
                               + JavaHome + sep + "lib" + sep 
                               + "opencard.properties\n\t"
                               + UserHome + sep + ".opencard.properties\n\t"
                               + UserDir  + sep + "opencard.properties\n\t"
                               + UserDir  + sep + ".opencard.properties\n");
        }
    }
    

  2. Then compile it:

    
    	$ javac findOCP.java
    

  3. Finally install it in your Java Development Kit:

    
    	$ jar cvf findOCP.jar findOCP.class
    	$ cp -i findOCP.jar ..../java/jre/lib/ext
    

To run the program, simply type:


	$ java findOCP

This program is useful to dicover which 'opencard.properties' file is loaded and has priority. Note that when several files exist in the listed locations, they are all loaded by the framework and merged; the last entries overide the first ones, see the "OpenCardPropertyFileLoader" section of the Programmer's Guide for more details.

Return to questions



Last updated: June 07, 2001
HTML generated by FAQmaker, v0.3: 2000-07-27