Running EncryptArbitraryData

The EncryptArbitraryData sample application encrypts binary data and decrypts the result.

To run this sample application, execute the following command line in the etjava/examples directory.

java -classpath ../lib/enttoolkit.jar;<xalan.jar>;<xercesImpl.jar>;<xml-apis.jar> com.entrust.toolkit.examples.xml.encrypt.EncryptArbitraryData <encryptor_efp_file> <recipient_epf_file> <epf_pwd> <init.properties> <encrypted_xml> <decrypted_xml>

Parameter

Value

<xalan.jar>

The path of the xalan.jar third-party library.

<xercesImpl.jar>

The path of the xercesImpl.jar third-party library.

<xml-apis.jar>

The path of the xml-apis.jar third-party library.

<encryptor_efp_file>

The file path of the Entrust profile for the user that encrypts the message.

<recipient_epf_file>

The file path of the Entrust profile for message recipient. You can reuse the <encryptor_efp_file> value for a trivial example.

<epf_pwd>

The password shared by both the Entrust profiles.

<init.properties>

The URI of the init.properties initialization file for the IXSIL library.

<binary_url>

The URL of binary data to encrypt.

<encrypted_xml>

A file path for the encrypted XML.

<decrypted_xml>

A file path for the decrypted XML.

For example:

D:\java\etjava\examples>java -classpath classes;..\lib\enttoolkit.jar;..\lib\xalan.jar;..\lib\xercesImpl.jar;..\lib\xml-apis.jar
com.entrust.toolkit.examples.xml.encrypt.EncryptArbitraryData data\userdata\RSAUser1.epf data\userdata\DSAUser1.epf
~Sample7~ file:/d:/java/etjava/examples/data/xml/init/properties/init.properties
file:d:/testing/test.gif data/xml/encrypt/encryptArbitrary_encrypted.xml
data/xml/encrypt/encryptArbitrary_decrypted.gif
Initializing IXSIL properties from "file:/d:/java/etjava/examples/data/xml/init/properties/init.properties"...
Initializing XMLE properties from "file:/d:/java/etjava/examples/data/xml/init/properties/init.properties"...
Logging in to: data\userdata\RSAUser1.epf
Logging in to: data\userdata\DSAUser1.epf
Encrypting "file:d:/testing/test.gif" for "cn=DSA User1,ou=PKI7,o=Java Toolkit Samples,c=CA"
Writing to: data/xml/encrypt/encryptArbitrary_encrypted.xml
Decrypting...
"cn=DSA User1,ou=PKI7,o=Java Toolkit Samples,c=CA" is a recipient.
"cn=DSA User1,ou=PKI7,o=Java Toolkit Samples,c=CA" will decrypt.
Writing to: data/xml/encrypt/encryptArbitrary_decrypted.gif