Written by

Question Yone Moreno · Feb 6, 2020

Call instance method inside WSCLIENTE, to set signature method?‽‽

Hello,

I would like to change signature's algorithm to be sha1.

I share the current code:

(BINARY SECURITY TOKEN and USERNAME TOKEN CODE omitted)

//SIGNATURE TOKEN
    set signSha1=##class(%XML.Security.Signature).%New()
    do signSha1.SetSignatureMethod($$$SOAPWSrsasha1)
    //..SetSignatureMethod($$$SOAPWSrsasha1)
    //$method(signSha1,"SetSignatureMethod",$$$SOAPWSrsasha1)
    //signSha1.SetSignatureMethod($$$SOAPWSrsasha1)
   set sig=signSha1.CreateX509(cert)

I have tried to use SetSignatureMethod, however in the Message Viewer we see:

As you see I have tried every other way I could think.

I have read:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…

https://cedocs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.c…

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cl…

https://docs.intersystems.com/irislatest/csp/docbook/Doc.View.cls?KEY=G…

How could we change signature algortihm?
 

Comments

Eduard Lebedyuk · Feb 6, 2020

You should initialize the Signature object not with %New method, but with Create or Create509 method.

set sig=##class(%XML.Security.Signature).CreateX509(cert)

do sig.SetSignatureMethod($$$SOAPWSrsasha1)
0