cancel
Showing results for 
Search instead for 
Did you mean: 

Signature Keystore via groovy script

Visitor

Signature Keystore via groovy script

I am trying to setup my outgoing ws security configuration via groovy script

 

My script is as below, how do I load the keystore and set the keystore values for the outgoing signature (see screenshot) 

 

 

 

def keystorePath = context.expand('${projectDir}') + "\\Certs\\stage1\\mycert.p12"
def keystorePassword = "changeit"
SoapUI.settings.setString(SSLSettings.KEYSTORE, keystorePath)
SoapUI.settings.setString(SSLSettings.KEYSTORE_PASSWORD, keystorePassword)

def project = testRunner.testCase.testSuite.project;

def WssC = project.getWssContainer();
if (!WssC.getOutgoingWssList().contains("testing")) {
    def owss = WssC.addOutgoingWss("testing");
    owss.setMustUnderstand(true);
    def signature = owss.addEntry("Signature")
    signature.setPassword("changeit")
    signature.setKeyIdentifierType(1)
    signature.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256")
    signature.setSignatureCanonicalization("http://www.w3.org/2001/10/xml-exc-c14n#")
    signature.setDigestAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1")

}

SoapUI.getSettings().setBoolean(HttpSettings.AUTHENTICATE_PREEMPTIVELY, true)
SoapUI.saveSettings()
1 REPLY 1
Contributor

Re: Signature Keystore via groovy script

I know this is old, but I am curious if you ever found a solution.