Discuss this help topic in SecureBlackbox Forum

Change settings of XML signature

To change the settings of XMLDSig signer (TElXMLSigner class), used for signing, you need to handle OnPrepareSignature, OnBeforeSign or OnAfterSign events of one of TElOfficeBinaryXMLSignatureHandler, TElOfficeOpenXMLSignatureHandler, TElOfficeOpenXPSSignatureHandler, or TElOpenOfficeSignatureHandler classes.

OnPrepareSignature event is used to set TElXMLSigner properties, such as SignatureMethod, KeyName and etc.. It is fired before OnBeforeSign event. OnBeforeSign event is used to modify TElXMLSigner.Signature properties, for example ID attributes.

The sample code below changes signature method from RSA-SHA1 to RSA-SHA256:


Handler.OnPrepareSignature += new TSBOfficeXMLSignEvent(handler_OnPrepareSignature);

private void handler_OnPrepareSignature(object Sender, TElXMLSigner Signer)
    Signer.SignatureMethod = SBXMLSec.Unit.xsmRSA_SHA256;

Handler.OnPrepareSignature := HandlerPrepareSignature;
procedure TMyClass.HandlerPrepareSignature(Sender : TObject; Signer : TElXMLSigner);
  Signer.SignatureMethod := xsmRSA_SHA256;

How To articles about XML-based signature handlers

Discuss this help topic in SecureBlackbox Forum