EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Sign .docx file from inputStream (Java)

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#23417
Posted: 02/13/2013 05:08:50
by Ulrich Laursen (Standard support level)
Joined: 02/13/2013
Posts: 4

Hi, we've successfully created a test that signs a .docx file using the Java API.
The test loads the file from the filesystem using:
Code
TElOfficeDocument doc = new TElOfficeDocument();

Code
doc.Open("C:\\test.docx");


But for the API to have any value to us, we need to load the file from a File object, an InputStream or a byte[]. We're having trouble loading the document in these formats and we cannot seem to find a method for outputting the signed .docx file as one of these formats either.

How do we do this?

Best regards

Ulrich
#23418
Posted: 02/13/2013 05:59:32
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

TElOfficeDocument already includes Open() method that accepts java.io.InputStream as a parameter.
#23419
Posted: 02/13/2013 06:10:58
by Ulrich Laursen (Standard support level)
Joined: 02/13/2013
Posts: 4

Hi,

I know, and I've tried it: with the following:

Code
TElOfficeDocument doc = new TElOfficeDocument();
File f = new File("c:\\test.docx");
InputStream is = new FileInputStream(f);
doc.open(is);


Which results in the following Exception:

Code
SecureBlackbox.Office.EElOfficePackageError: Failed to create part (package is read-only)
   at SecureBlackbox.Office.TElOfficePackage.CreatePart(SBOfficePackage.pas:605)
   at SecureBlackbox.Office.TElOfficePackage.CreatePart(SBOfficePackage.pas:595)...


And it's the same file that is able to be loaded with the
Code
doc.Open("C:\\test.docx");

So i don't really see the problem here.

But anyway that's only part 1 of the problem.

Part 2 is: How do I convert a TElOfficeDocument to a byte[] or an OutputStream?

Best regards
Ulrich
#23420
Posted: 02/13/2013 06:47:42
by Vsevolod Ievgiienko (EldoS Corp.)

Answered in Helpdesk.
#23421
Posted: 02/13/2013 06:58:39
by Ulrich Laursen (Standard support level)
Joined: 02/13/2013
Posts: 4

Thank you for the quick replies - works like a charm :)

Best regards
Ulrich
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

Topic viewed 1355 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!