EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Problem with ValidateSignature() of TElXMLVerifier

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 11/11/2011 02:32:48
by Velin Achev (Standard support level)
Joined: 09/19/2011
Posts: 9

Hello everyone!

I have the following problem:
I'm trying to verify a signed XML with the ValidateSignature() method of TElXMLVerifier. But the verification fails when the supplied XmlDocument does not have its PreserveWhitespace property set to true.
So, when i set PreserveWhitespace = true of the XmlDocument, then convert it to TElXMLDOMDocument and the validation succeeds, otherwise fails.

Can you please give some directions on how i can overcome this - should i do something else when creating the TElXMLDOMDocument object? Currently, i load the xml into TElXMLDOMDocument using LoadFromStream(memorystream, "utf-8", true).

Also, I do not set Verifier.KeyData property.

Thanks in advance.
Posted: 11/11/2011 02:38:12
by Eugene Mayevski (Team)

Setting PreserveWhitespace to false changes the document, so it's no wonder that validation fails. Why would you need to set it to false?

Sincerely yours
Eugene Mayevski
Posted: 11/11/2011 02:49:46
by Velin Achev (Standard support level)
Joined: 09/19/2011
Posts: 9

Hi Eugene,
setting PreserveWhiteSpace to true/false does not affect my xml because it is already stripped from white spaces - i've already checked this, and the validation of signedXml.CheckSignature() succeeds, where signedXml is an instance of SignedXml .NET class.

Regards, Velin
Posted: 11/11/2011 03:08:34
by Dmytro Bogatskyy (Team)

After CheckSignature(), then do you save a document with PreserveWhitespace property set to false?
From MSDN:
If PreserveWhitespace is true before Save is called, white space in the document is preserved in the output; otherwise, if this property is false, XmlDocument auto-indents the output.
Posted: 11/11/2011 04:18:24
by Velin Achev (Standard support level)
Joined: 09/19/2011
Posts: 9

Thanks Dmytro,

the problem came out to be exactly that auto-indentation of the output when PreserveWhiteSpace is false... so actually I did not have any white spaces, but calling Save to the stream give the generated TElXMLDOMDocument additional indentation. Setting PreserveWhiteSpace = true before Save actually kept the lack of white spaces :)

Thanks again,
how can I close this thread? Or mark this as done?

Posted: 11/11/2011 04:36:24
by Eugene Mayevski (Team)

Velin Achev wrote:
how can I close this thread? Or mark this as done?

Forums (unlike HelpDesk tickets) don't need to be closed or marked as done since there can be other users who might want to ask a question on the same topic.

Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.



Topic viewed 1410 times

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


Back to top

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

Got it!