EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Creating a signed xml

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#22450
Posted: 11/12/2012 04:54:27
by Dmytro Bogatskyy (EldoS Corp.)

Quote
The error only occurs the first time we start the signing threads.
When we start it again, everything works fine.

Are you starting several signing threads at the same time?

Please try to add a dummy call in a main thread:
Code
SBChSConv.Unit.GetCharsetNameByAlias('');

This method internally will call InitCharsets method. It looks like that this method (InitCharsets) is not thread safe. I'll fix this for the next build.
#22461
Posted: 11/13/2012 01:27:32
by Chris Sennrich (Standard support level)
Joined: 10/17/2012
Posts: 12

Cool thanks - that helped!

Yes we are starting several signing threads at the same time.

Each thread uses the same certificate and store which is initialized once before the threads are started.
#22492
Posted: 11/16/2012 01:27:47
by Chris Sennrich (Standard support level)
Joined: 10/17/2012
Posts: 12

So we are getting closer now an can sign XML-Documents without any error!

The only thing we discovered is that the process uses a lot of memory.
When signing 1000 documents the usage increases several MBs for each document
and stops at about 1000MB.

We are signing XML-Documents (size ist about 150kb each) with an embedded PDF (base64 encoded). We add some references and objects to the TElXMLDOMDocument and it seems that the highest memory increasing happens when adding an object.

We use the following code (where objectValue is the OuterXML-string of an XMLDocument):

Code
TElXMLDOMDocument doc = new TElXMLDOMDocument();
MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(objectValue));
doc.LoadFromStream(stream, "UTF-8", true);
obj.DataList.Add(doc.DocumentElement);
Signer.Signature.Objects.Add(obj);
stream.Close();
stream = null;
doc.Dispose();
doc = null;


When we call:

Code
GC.Collect()


after a XML is signed the memory usage don't increases but usually in .NET the garbage collector should not be forced to collect manually.

Do you have any idea whats wrong?
#22499
Posted: 11/16/2012 06:26:14
by Dmytro Bogatskyy (EldoS Corp.)

Quote
When signing 1000 documents the usage increases several MBs for each document
and stops at about 1000MB.

Usage of the several MBs for each document (150kb each) while signing seems to be okay, for example only a DOM structure would take about 0.5 MB for such document, because internally all data are stored in unicode and there is some overhead for each DOM node.
Quote
after a XML is signed the memory usage don't increases but usually in .NET the garbage collector should not be forced to collect manually.

Signing 1000 documents would have a high CPU usage for a long period. In this case, I think, if the system has enough free memory, then a garbage collector would not be forced to invoke too often, and usage about 1GB seems to be reasonable.
#34258
Posted: 08/17/2015 14:29:37
by Manuel Velazquez (Basic support level)
Joined: 06/12/2012
Posts: 1

Hi:

In our code we have a exception when loading in a multithread and loading TELTElXMLDOMDocument for xmlsignature. Do you have a bugfix for this scenario???

I Want to know if you can answer us in this thread or if we need to open a new thread for a support ticket with our license.

The exception:

Thread Name: Win32 ThreadId:4640
Message: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at SBXMLCore.__Global.InitializeXMLCharProps()
at SBXMLCore.TElXMLParser..ctor(TElXMLDOMDocument aDoc, Boolean DoInitStream, String DefaultEncoding, Boolean NormNEL)
at SBXMLCore.TElXMLDOMDocument.LoadFromStream(Stream aStream, String DefaultEncoding, Boolean NormalizeNEL)
#34259
Posted: 08/17/2015 15:10:38
by Dmytro Bogatskyy (EldoS Corp.)

Thank you for contacting us,

Quote
In our code we have a exception when loading in a multithread and loading TELTElXMLDOMDocument for xmlsignature. Do you have a bugfix for this scenario???

What SecureBlackbox version are you using?
As far as I remember, this issue was fixed in version 12.0.263
#34260
Posted: 08/17/2015 15:40:00
by Eugene Mayevski (EldoS Corp.)

Quote
Manuel Velazquez wrote:
I Want to know if you can answer us in this thread or if we need to open a new thread for a support ticket with our license.


If upgrading to the latest build doesn't help, then yes, please create a support request in the HelpDesk and please remember to link the support access ticket to your user account, when using HelpDesk.

Asking new questions in related forum threads is not exactly a perfect idea as it creates mess and prevents users, who read the forum posts later, from understanding what the thread is about.


Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.

Reply

Statistics

Topic viewed 6725 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!