Running EncryptExtended

The EncryptExtended sample application encrypts the following sample file for two recipients and decrypts the result.

etjava/examples/data/xml/encrypt/encryptForAandB.xml

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.EncryptExtended <encryptor_efp_file> <recipient_1_epf_file> <recipient_2_epf_file> <epf_pwd> <init.properties> <encrypted_xml> <decrypted_xml> [<recipient_2_cert>]

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_1_file>

The file path of the "Recipient 1" Entrust user profile.

<recipient_epf_2_file>

The file path of the "Recipient 2" Entrust user profile.

<epf_pwd>

The password shared by the three Entrust profiles.

<init.properties>

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

<encrypted_xml>

A file path for the encrypted XML.

<decrypted_xml>

A file path for the decrypted XML.

<recipient_2_cert>

The file path of the "Recipient 2" certificate. The application uses the certificate in the "Recipient 2" user profile if this optional parameter is omitted.

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.EncryptExtended data\userdata\RSAUser1.epf data\userdata\DSAUser1.epf
data\userdata\RSAUser2.epf ~Sample7~ file:/d:/java/etjava/examples/data/xml/init/properties/init.properties
data/xml/encrypt/encryptForAandB_encrypted.xml data/xml/encrypt/encryptForAandB_decrypted.xml
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
Logging in to: data\userdata\RSAUser2.epf
 
 
Encrypting for: cn=DSA User1,ou=PKI7,o=Java Toolkit Samples,c=CA
Encrypting for: cn=RSA User2,ou=PKI7,o=Java Toolkit Samples,c=CA
 
Recipient set 0 contains 5 EncryptedData elements that are encrypted by 2 Encryp
tedKeys
Set:0, Element:0 has Id = Encrypted_0
Set:0, Element:1 has Id = Encrypted_1
Set:0, Element:2 has Id = Encrypted_2
Set:0, Element:3 has Id = EncryptedContent_0
Set:0, Element:4 has Id = EncryptedContent_1
Set:0, Key:0 has Id = Key0
Set:0, Key:1 has Id = Key1
 
Recipient set 1 contains 5 EncryptedData elements that are encrypted by 1 Encryp
tedKeys
Set:1, Element:0 has Id = EncryptedForA_0
Set:1, Element:1 has Id = EncryptedForA_1
Set:1, Element:2 has Id = EncryptedForA_2
Set:1, Element:3 has Id = EncryptedContentForA_0
Set:1, Element:4 has Id = EncryptedContentForA_1
Set:1, Key:0 has Id = Key2
 
Recipient set 2 contains 5 EncryptedData elements that are encrypted by 1 Encryp
tedKeys
Set:2, Element:0 has Id = EncryptedForB_0
Set:2, Element:1 has Id = EncryptedForB_1
Set:2, Element:2 has Id = EncryptedForB_2
Set:2, Element:3 has Id = EncryptedContentForB_0
Set:2, Element:4 has Id = EncryptedContentForB_1
Set:2, Key:0 has Id = Key3
 
Writing to: data/xml/encrypt/encryptForAandB_encrypted.xml
 
 
Decrypting...
"cn=DSA User1,ou=PKI7,o=Java Toolkit Samples,c=CA" is a recipient.
"cn=RSA User2,ou=PKI7,o=Java Toolkit Samples,c=CA" is a recipient.
 
Writing to: data/xml/encrypt/encryptForAandB_decrypted.xml