Servlet sample
The samples in the servlet folder run a servlet application.
Compiling the servlet sample files
Run the following command line in the etjava/examples directory.
javac -sourcepath source -d classes -classpath ../lib/enttoolkit.jar;<jakarta.servlet-api.jar> \source/com/entrust/toolkit/examples/servlet/PKCS7SampleClient.java \source/com/entrust/toolkit/examples/servlet/PKCS7SampleServlet.java \source/com/entrust/toolkit/examples/servlet/PKCS7Util.java |
Parameter |
Value |
|
<jakarta.servlet-api.jar> |
The path on your computer of the third-party Jakarta servlet library downloaded from https://projects.eclipse.org/projects/ee4j.servlet |
Configuring the applications server
Copy the required libraries in the application server folder. For example, when using Tomcat, copy the following files of the etjava90.zip distribution file into the Tomcat home directory.
|
Source |
Destination |
|
etjava/examples/data/servlet/entrust-sample-servlet |
webapps |
|
etjava/examples/classes/com/entrust/toolkit/examples/servlet/PKCS7SampleServlet.class |
webapps/entrust-sample-servlet/WEB-INF/classes/com/entrust/toolkit/examples/servlet |
|
etjava/examples/classes/com/entrust/toolkit/examples/servlet/PKCS7Util.class |
webapps/entrust-sample-servlet/WEB-INF/classes/com/entrust/toolkit/examples/servlet |
|
etjava/lib/enttoolkit.jar |
webapps/entrust-sample-servlet/WEB-INF/lib |
|
data/userdata/RSAUser1.epf |
webapps/entrust-sample-servlet |
Running PKCS7SampleClient
Run the following command line in the etjava/examples directory.
java -classpath classes;../lib/enttoolkit.jar com.entrust.toolkit.examples.servlet.PKCS7SampleClient <epf_file> <epf_pwd> <message> <servlet> [-dir <ip]|
Parameter |
Value |
|
<epf_file> |
The path of an Entrust user profile in .epf file format. |
|
<epf_pwd> |
The password for accessing the Entrust profile. |
|
<message> |
The message to display on the servlet. |
|
<servlet> |
The servlet URL. |
|
<ip> |
|
For example:
C:\etjava\examples>java -classpath classes;../lib/enttoolkit.jar com.entrust.toolkit.examples.servlet.PKCS7SampleClient data/userdata/RSAUser1.epf ~Sample7~ "Hello World" http://localhost:8080/entrust-sample-servlet/PKCS7SampleServletLogging in User... DONEUser online: falseSTART: Communication with servletSending PKCS #7 message to servlet... Protecting message as encrypted/signed PKCS #7 message... DONEMessage sent- Start of sent message -Hello World- End of sent message -Receiving PKCS #7 message from servlet... Extracting message from encrypted/signed PKCS#7 message... DONE Signature and encryption information: - operation: 1 - encryption alg: CAST5-CBC - number of signatures: 1 - signature 0 - digest algorithm: SHA - signer certificate subject name: cn=RSA User1,ou=PKI7,o=Java Toolkit Samples,c=CA - included certificates: - cn=RSA User1,ou=PKI7,o=Java Toolkit Samples,c=CA - cn=RSA User1,ou=PKI7,o=Java Toolkit Samples,c=CA - ou=PKI7,o=Java Toolkit Samples,c=CAMessage received- Start of recieved message -I have received the following secret message from you: Hello World- End of received message -END: Communication with servlet