EldoS | Feel safer!

Software components for data protection, secure storage and transfer

[JAVA] XAdES, remove UnsignedProperties

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#31546
Posted: 12/01/2014 08:34:54
by Mickaël Bénès (Standard support level)
Joined: 02/26/2013
Posts: 74

Hello.

I had to remove the UnsignedProperties from a XAdES signature and the only way I found to do it was like this (right after the TElXMLSigner.Save( TSBObject ) function :
Code
TElXMLDOMNode nodeToRemove = TElXMLSignature.GetQualifyingProperties().GetXMLElement().GetLastChild();
TElXMLSignature.GetQualifyingProperties().GetXMLElement().RemoveChild( nodeToRemove );

Is there another way ? I tried with :
Code
TElXMLSignature.GetQualifyingProperties().GetUnsignedProperties().Clear();
but never managed to make it work.

Mickaël Bénès
#31547
Posted: 12/01/2014 08:49:12
by Dmytro Bogatskyy (EldoS Corp.)

Thank you for contacting us.

Quote
Is there another way ?

No. The only solution is to remove UnsignedProperties element from the xml. The Clear() method clears UnsignedProperties structure prior signing (prior saving to xml), it doesn't modify xml tree.
By the way, it would be safer to use a following code:
Code
TElXMLDOMNode nodeToRemove = TElXMLSignature.GetQualifyingProperties().GetUnsignedProperties().GetXMLElement();
if (nodeToRemove != null)
  TElXMLSignature.GetQualifyingProperties().GetXMLElement().RemoveChild( nodeToRemove );
#31548
Posted: 12/01/2014 08:59:12
by Mickaël Bénès (Standard support level)
Joined: 02/26/2013
Posts: 74

Quote
Dmytro Bogatskyy wrote:
No. The only solution is to remove UnsignedProperties element from the xml. The Clear() method clears UnsignedProperties structure prior signing (prior saving to xml), it doesn't modify xml tree.
Roger that !
Quote
Dmytro Bogatskyy wrote:
By the way, it would be safer to use a following code:
Indeed, I updated my code.

Thank you very much !

Reply

Statistics

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