CLASSPATH basics

How to use Crionics products

jPDF is a self-managed application programming interface (API) which requires no additional software to read, process and generate PDF documents. In most cases, you can access the jPDF API by referencing jpdf.jar in your classpath. This will grant access to all public classes in the package com.crionics.jpdf

Information regarding the API can be found:

  1. By reading the Java Doc API
  2. By browsing the list of online tutorials
  3. By reading the Sample code and other demos part of the evaluation package
  4. By getting in touch with the Crionics support team

If you want to use PDF Encryption or Signatures, you may have to perform the steps explains right below.

Installing a cryptography provider

jPDF uses the Java Cryptography Extension to instantiate algorithms: MD2, MD5, SHA1, RSA, DSA, AES and ARC4. Depending on the JDK deployed with your operating system (or application server), you may have to install a JCE providers.

The Java Cryptography Extensions (JCE) is a standard Java API organized in two layers: * A framework layer - referenced as jce122.jar is bundled in the distribution. Starting with JDK 1.4 the framework is already part of the default classpath and does not need to be manually added. Also, if you plan to use jPDF from an application server, chances are the jce-provider is already pre-configured. * A JCE implementation layer - where cryptography providers can plug-in their own cryptography algorithms.

a FREE JCE provider is available from Bouncy Castle at http://www.bouncycastle.org/latest_releases.html. But you are welcome to use any other JCE compliant providers as long as they support the algorithms mentioned above.

Installing the Bouncy Castle provider

In this tutorial, we explain how to install the Bouncy Castle JCE into your JDK. The installation may differ if you are trying to install a new JCE provider in an application server.

  1. Go to http://www.bouncycastle.org/latest_releases.html and download one of the following JARs depending on the JVM version you have: (Please note that the version level might be different.)
  2. Copy the file bcprov-jdk*.jar to JDKHOME/jre/lib/ext - This folder contains the global libraries for the JVM.
  3. If you have a JDK version better than 1.3, please copy the JCE framework from JPDF-DISTRIBUTION/lib/jce122.jar to JDK-HOME/jre/lib/ext. You may also have to install a policy file to unlock encryption for keys 40 bits. See the JCE homepage for more info.
  4. Edit the file _JDK-HOME>/jre/lib/security/java.security - it describes the JCE providers installed in your system.
  5. Pay attention to the lines security.provider.N=className. There is typically a number on this line describing the order in which providers are looked up by the JCE framework.
  6. Add the Bouncy Castle provider to the list. Your list should look like this: security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider security.provider.2=sun.security.provider.Sun security.provider.3=com.sun.rsajca.Provider

That's it! You are ready to sign and encrypt pdf documents.