Discuss this help topic in SecureBlackbox Forum

XML: Add data to KeyInfo element

To add additional X509Data element or custom node or etc. to the KeyInfo element of the signature you need to modify TElXMLKeyInfo object, which is generated in TElXMLSigner.GenerateSignature() and GenerateSignatureAsync() methods. This object is accessed via TElXMLSigner.Signature.KeyInfo property.

This code sample adds a custom node to KeyInfo element:

C#:


Signer.GenerateSignature();
...
TElXMLKeyInfoNode KeyInfoNode = new TElXMLKeyInfoNode(true);
KeyInfoNode.Value = XMLDocument.CreateElementNS("namespace-uri", "NodeName");
Signer.Signature.KeyInfo.Add(KeyInfoNode);
Delphi:

Signer.GenerateSignature();
...
KeyInfoNode := TElXMLKeyInfoNode.Create(true);
KeyInfoNode.Value := XMLDocument.CreateElementNS('namespace-uri', 'NodeName');
Signer.Signature.KeyInfo.Add(KeyInfoNode);

How To articles about XML signing (XMLDSig and XAdES)

Discuss this help topic in SecureBlackbox Forum