#
# $Id: README 68 2007-02-21 12:25:55Z wolfgang.glas $
#
# Author: Wolfgang Glas / ev-i Informationstechnologie GmbH
#

This is the PKCS#11 provider of the opensc project.

It is still in an embryonic state, but it is possible to issue
RSA/SHA1 signatures using a fully initialized card with a private
key and at least one certificate.

Installation
------------

opensc-java uses maven (http://maven.apache.org) for managing
builds and releases of the project.

In order to build the beast, try

 mvn pacakge

in the root directory. Maven will automagically
fetches some popular java libraries via http, if called for the
first time.

Please note, that when running main programs or JUnit tests of
the project you must supply the command line argument

-Djava.library.path=<opensc-java-root>/target/lib

to the java virtual machine in order to locate the jni
plugin libopensc-PKCS11-0.2.so resp. opensc-PKCS11-0.2.dll

Maven integration
------------------

If you like to use the PKCS11 provider inside a maven
project, you should add the following to your pom.xml file
  
<?xml version="1.0" encoding="UTF-8"?><project>
  <modelVersion>4.0.0</modelVersion>
  ...
  <build>
     ...
     <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.0-alpha-1-SNAPSHOT</version>
        <executions>
          <execution>
            <!-- Unpack all JNI zip dependencies (e.g. from opensc-java) -->
            <id>unpack-jni</id>
            <phase>process-sources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
             <type>zip</type>
             <excludeTypes>jar</excludeTypes>
             <outputDirectory>${project.build.directory}/lib</outputDirectory>
             </configuration>
           </execution>
         </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!-- Add JNI dependencies to java.library.path (e.g. from opensc-java) -->
          <argLine>-Djava.library.path=${project.build.directory}/lib</argLine>
        </configuration>
      </plugin>
      ...
    </plugins>
  </build>
  <repositories>
    <repository>
      <id>opensc-repo</id>
      <name>opensc-project.org repository.</name>
      <url>http://www.opensc-project.org/files/opensc-java/maven</url>
    </repository>
    ...
  </repositories>
  <pluginRepositories>
    <pluginRepository>
     <id>apache.snapshots</id>
     <name>Maven Plugin Snapshots</name>
     <url>http://people.apache.org/maven-snapshot-repository</url>
     <releases><enabled>false</enabled></releases>
     <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
    ...
  </pluginRepositories>
  <dependencies>
    <dependency>
      <groupId>org.opensc</groupId>
      <artifactId>opensc-PKCS11</artifactId>
      <version>0.2.0</version>
    </dependency>
    ...
  </dependencies>
  ...
</project>

Eclipse users are advised to use the Maven2 plugin for eclipse
available from the following update site

  http://m2eclipse.codehaus.org/

Developping opensc-PKCS11
-------------------------

opensc-PKCS11 comes with the necessary project files for
using the SVN-tree as an eclipse project.

The testcases are now located in a seperate project pkcs11-test, which
you can check out from

  http://www.opensc-project.org/svn/opensc-java/trunk/pkcs11-test/

This is necessary, because the jar-file of the cryptographic provider needs to
be signed and hence cannot be easily tested from within the same maven project.

Please also consider the fil conf/keystore/README, if you like to sign the
generated jar-file.

Credits
-------

The PKCS#11 provider is based on the 
RSA Security Inc. PKCS!#11 Cryptographic Token Interface (Cryptoki).

See also: http://www.rsasecurity.com/rsalabs/node.asp?id=2133

Many thank to andreas.schwier@cardcontact.de for donating a MSVC project
file and reviewing the C source code.
