EldoS | Feel safer!

Software components for data protection, secure storage and transfer

XML Document, place of the signature

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#11130
Posted: 09/24/2009 07:37:25
by David MICHEL (Standard support level)
Joined: 09/23/2009
Posts: 48

Hello,

I have a problem which I do not manage to solve.

When I sign a document xml, the node signature position on the last node, at the end of the structure xml.
<DocumentXML>
<Part1>
</Part1>
<Part2>
</Part2>
<---Here

</DocumentXML>

with the following code :
Code
      Signer.Sign;
      Signer.Signature.SignaturePrefix := 'ds';

      SigNode := FXMLDocument.DocumentElement;

      try
        Signer.Save(SigNode);
      except
        on E: Exception do
          raise EElXMLError.CreateFmt('Signature data loading failed. (%s)', [E.Message]);
      end;


However, I would like which node of the signature is placed at the desired place.

<DocumentXML>
<Part1>
</Part1>
<---now, here

<Part2>
</Part2>
</DocumentXML>

Best regards.


Sincerely yours,
David MICHEL.
#11131
Posted: 09/24/2009 09:14:48
by Dmytro Bogatskyy (EldoS Corp.)

Quote
However, I would like which node of the signature is placed at the desired place.

<DocumentXML>
<Part1>
</Part1>
<---now, here

<Part2>
</Part2>
</DocumentXML>

The signature is always placed as a last child of the node passed as a parameter (if the signature type is enveloped),
You can move the Signature node to the desired place using this code:
Code
SignatureNode := ElXMLSigner.Signature.XMLElement;
SignatureNode.ParentNode.InsertBefore(SignatureNode.CloneNode(True), Part2Node);
SignatureNode.ParentNode.RemoveChild(SignatureNode);
#11132
Posted: 09/24/2009 10:20:23
by David MICHEL (Standard support level)
Joined: 09/23/2009
Posts: 48

Thank you very much.


Sincerely yours,
David MICHEL.

Reply

Statistics

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