Discuss this help topic in SecureBlackbox Forum
SOAP: Change signature settings
To change the settings of XMLDSig signer (TElXMLSigner class), used for signing, you need to handle OnPrepareSignature, OnBeforeSign or OnAfterSign events of your signature handler. The OnPrepareSignature event is used to set the properties of TElXMLSigner, such as SignatureMethod, KeyName and etc.. OnPrepareSignature event is fired before OnBeforeSign event. The OnBeforeSign event is used to modify TElXMLSigner.Signature properties, for example, alter ID attributes.
The sample below changes signature method to from RSA-SHA1 to RSA-SHA256:
C#:
Handler.OnPrepareSignature += new TSBXMLSOAPSignEvent(handler_OnPrepareSignature);
private void handler_OnPrepareSignature(object Sender, TElXMLSigner Signer)
{
Signer.SignatureMethod = SBXMLSec.Unit.xsmRSA_SHA256;
}
Delphi:
Handler.OnPrepareSignature := HandlerPrepareSignature;
...
procedure HandlerPrepareSignature(Sender : TObject; Signer : TElXMLSigner);
begin
Signer.SignatureMethod := xsmRSA_SHA256;
end;