Running EncryptExtended
The EncryptExtended sample application encrypts the following sample file for two recipients and decrypts the result.
etjava/examples/data/xml/encrypt/encryptForAandB.xmlTo 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.jarcom.entrust.toolkit.examples.xml.encrypt.EncryptExtended data\userdata\RSAUser1.epf data\userdata\DSAUser1.epfdata\userdata\RSAUser2.epf ~Sample7~ file:/d:/java/etjava/examples/data/xml/init/properties/init.propertiesdata/xml/encrypt/encryptForAandB_encrypted.xml data/xml/encrypt/encryptForAandB_decrypted.xmlInitializing 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.epfLogging in to: data\userdata\DSAUser1.epfLogging in to: data\userdata\RSAUser2.epfEncrypting for: cn=DSA User1,ou=PKI7,o=Java Toolkit Samples,c=CAEncrypting for: cn=RSA User2,ou=PKI7,o=Java Toolkit Samples,c=CARecipient set 0 contains 5 EncryptedData elements that are encrypted by 2 EncryptedKeysSet:0, Element:0 has Id = Encrypted_0Set:0, Element:1 has Id = Encrypted_1Set:0, Element:2 has Id = Encrypted_2Set:0, Element:3 has Id = EncryptedContent_0Set:0, Element:4 has Id = EncryptedContent_1Set:0, Key:0 has Id = Key0Set:0, Key:1 has Id = Key1Recipient set 1 contains 5 EncryptedData elements that are encrypted by 1 EncryptedKeysSet:1, Element:0 has Id = EncryptedForA_0Set:1, Element:1 has Id = EncryptedForA_1Set:1, Element:2 has Id = EncryptedForA_2Set:1, Element:3 has Id = EncryptedContentForA_0Set:1, Element:4 has Id = EncryptedContentForA_1Set:1, Key:0 has Id = Key2Recipient set 2 contains 5 EncryptedData elements that are encrypted by 1 EncryptedKeysSet:2, Element:0 has Id = EncryptedForB_0Set:2, Element:1 has Id = EncryptedForB_1Set:2, Element:2 has Id = EncryptedForB_2Set:2, Element:3 has Id = EncryptedContentForB_0Set:2, Element:4 has Id = EncryptedContentForB_1Set:2, Key:0 has Id = Key3Writing to: data/xml/encrypt/encryptForAandB_encrypted.xmlDecrypting..."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