Decrypting binary data using XML

The procedure to decrypt binary data is as follows.

Logging the user

Log in the user with the selected credentials.

user.login(credReader, <password>);

Initializing the IXSIL library

Retrieve the init.properties file and initialize the IXSIL library.

iaik.ixsil.util.URI initProps = new URI(<init_properties_file_URI>);
IXSILInit.init(initProps);

Refer to the readme file for more information on editing the init.properties file.

etjava\examples\source\com\entrust\toolkit\examples\xml\xml_readme.html

Refer also to the Javadoc documentation of the following class.

iaik.ixsil.init.IXSILInit

Initializing the toolkit

Initialize the toolkit classes for XML encryption and decryption..

iaik.ixsil.util.ExternalReferenceResolverImpl res = new ExternalReferenceResolverImpl(initProps);
com.entrust.toolkit.xencrypt.init.XMLEInit initializer = new XMLEInit(initProps);

Decrypting the data

Add a user to decrypt the data.

decryptor.addUser(recipient);

Decrypt the data.

decryptor.decrypt();

Writing the decrypted data

Retrieve the decrypted octet sequence as a byte array and write it to a local file.

byte[ ] decryptedByte = (byte[ ])
decryptor.getDecryptedBinary().elementAt(0); FileOutputStream fos = new FileOutputStream(<path to local file>);
fos.write(decryptedByte);
fos.close();