Discuss this help topic in SecureBlackbox Forum

XML: Change prefix of signature elements

By default the signature element is generated with "ds" prefix:


<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
...signature content...
</ds:Signature>

If you need to change the signature prefix or to remove it, you need to use TElXMLSignature.SignaturePrefix property. The instance of TElXMLSignature class could be accessed using TElXMLSigner.Signature property after it was generated (i.e. after the TElXMLSigner.GenerateSignature() method call).

The default value of SignaturePrefix property is "ds" string. To remove the prefix from the signature element you need to set this property to "#default" value. If the prefix is defined in the parent element and you need to use that one, then you need to set SignaturePrefix property to empty string.

C#:


TElXMLSigner Signer = new TElXMLSigner();
...
Signer.Sign();
...
Signer.Signature.SignaturePrefix = "#default";
Delphi:

var
  Signer : TElXMLSigner;
...
Signer := TElXMLSigner.Create(nil);
Signer.Sign();
...
Signer.Signature.SignaturePrefix := '#default';

Generated XML:


<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
...signature content...
</Signature>

Also see: https://www.eldos.com/security/articles/7443.php.

How To articles about XML signing (XMLDSig and XAdES)

Discuss this help topic in SecureBlackbox Forum