Forum Discussion

anallagundla's avatar
anallagundla
Contributor
13 years ago

Load SSL certificates for different environments in settings

HI /Ole

We have different environments with different SSL certificates but with same password. Now we want to have a central groovy script library which holds all the SSL certificates in one file/folder, may be in one soapui-settings file

Is it possible? or is there a way i can write some script to hold all certificates at one place?

Right now we change <con:setting id="SSLSettings@keyStore">.\CP-Gateway\Groovy\stg-g\stg_all.p12</con:setting> for each environment, can i just put path for all certificates in one soapui-settings file?

Let me know if there is any work around you can provide me with this

Thanks
Abhinav

5 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    you can use the new environments feature in 4.5 to switch between certificates for different environments - the process is as follows:

    1) add all your keystores containing the different certs to the WS-Security tab in your project (under Keystores)
    2) define a custom project property containing the name of the default keystore to use
    3) set the SSL Keystore property (in the bottom left table of properties) of all requests that should use this certificate to ${#Project#<nameofproperty>}
    4) add environments in the project windows Environments tab and override the property value with the keystore names of those to use in the corresponding environment

    Now when you switch between the available environments your requests will use that environments specific keystore/certificate.

    Hope that makes sense :-)

    regards!

    /Ole
    SmartBear Software
  • Hi /Ole

    I tried out as you instructed but I got back error SSL Peer Unverified


    adult image hosting


    jpg image hosting

    Error Logs

    Fri Mar 23 15:54:02 PDT 2012:ERROR:javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
    javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
    at sun.security.ssl.SSLSessionImpl.getPeerCertificates(Unknown Source)
    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:390)
    at com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager$SoapUIClientConnectionOperator.openConnection(SoapUIMultiThreadedHttpConnectionManager.java:299)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
    at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:219)
    at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:329)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:251)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)


    Let me know if am doing something wrong

    Thanks
    Abhinav
  • I though i can try try this in soapui 4.0.0

    I just need to know if I can select Global Project property to SSLKeystore present in the REST step, something like this ${#Project#...


    image host

    Am not able to edit SSLKeystore property in REST Step, is it possible to edit or pull project property?


    image hosting jpg



    Please let me know

    Thanks
    Abhinav
    • deejmore's avatar
      deejmore
      New Contributor

      Hi,

       

      I wonder if this is possible for REST Services, for Ready API 1.5/1.7 I cannot type on the property "SSL Keystore" it is only a select list.  When will this feature be added?

       

      Best regards,

       

      DJ

    • Luffy's avatar
      Luffy
      Occasional Contributor

      SSL Keystore aint a property to set, so it wont work that way.
      Below has worked for me.

       

      import com.eviware.soapui.settings.SSLSettings
      import com.eviware.soapui.SoapUI 
      
      SoapUI.settings.setString( SSLSettings.KEYSTORE, pathToKeystore )
      SoapUI.settings.setString( SSLSettings.KEYSTORE_PASSWORD, keystorePassword )
      def KeyStore  = SoapUI.settings.getString( SSLSettings.KEYSTORE, "SSL KeyStore is not stored, Please set it" )
      testRunner.testCase.getTestStepByName('StateDetails').setPropertyValue("SSLKeystore", "$KeyStore")

       

       

      You like the reply. How to give a Kudos / Accept as solution?