Field Service

Get Involved. Join the Conversation.

Topic

    Sunil Ainlod
    How to generate auth_string tag using SHA256
    Topic posted September 27, 2016 by Sunil AinlodRed Ribbon: 250+ Points 
    379 Views, 8 Comments
    Title:
    How to generate auth_string tag using SHA256
    Content:

    Hello,

    I am generating auth_string using  below procedure:

    SHA256("2016-09-27T19:01:31+0530" + SHA256( "password" + SHA256("soap")))

    soap --> 736BC2D4E0945110E88F7808A4A4D38D3479A0122DE1DE7AC84C920121928480
    password + 736BC2D4E0945110E88F7808A4A4D38D3479A0122DE1DE7AC84C920121928480 --> 0A2B6055D38BB1B58AA3FAB88DDCB974302EEA0E0175B152D2E36319E06A97A6
    2016-09-27T19:01:31+0530 + 0A2B6055D38BB1B58AA3FAB88DDCB974302EEA0E0175B152D2E36319E06A97A6 --> 4DD6D1CA07824B128AA468DA3C89A41287A2BE92A2DDBB41DCEB5B7353378DD5

     

    Final <auth_string> tag will have 4DD6D1CA07824B128AA468DA3C89A41287A2BE92A2DDBB41DCEB5B7353378DD5

     

    Is this correct? If yes still I am getting below error

    <result_code>33</result_code>
    <error_msg>Authentication failed</error_msg>

    Regards,

    Sunil

    Version:
    16.2

    Comment

     

    • saurabh suman

      Hi Sunil

      I assume u r speaking for the below issue:

      SHA256(PARAM1 + SHA256(PARMA2))

      Solution:

      Generate SHA256 for PARAM2 (Lets say : ASDFGHJ)

      So now u need to generate sha256 as PARAM1ASDFGHJ

      Final result is ur authcode.

      Please test and let me know if u get any result.

    • Sunil Ainlod

      Thanks Saurabh. I got the logic but it still I get Authentication failed message.

      As per OFSC Guide example below is the auth_string

      auth_string = SHA256( "2014-01-10T13:56:50Z" + SHA256( "Welcome1" +
      SHA256(“soap”))) =
      b477d40346ab40f1a1a038843d88e661fa293bec5cc63359895ab4923051002a

      But when you generate it differs as:​

      soap -> 736BC2D4E0945110E88F7808A4A4D38D3479A0122DE1DE7AC84C920121928480
      Welcome1736BC2D4E0945110E88F7808A4A4D38D3479A0122DE1DE7AC84C920121928480 --> 777860D8220C31556A3563886C6AC03DC86DE1D4DC6E3B89831F880BCE842B49
      2014-01-10T13:56:50Z777860D8220C31556A3563886C6AC03DC86DE1D4DC6E3B89831F880BCE842B49 --> 25BE8885071910434DDF3CCF2881D39B5487DB200A15E857ACC1B2278A48D55F

      Why my auth string is not matching with OFSC user guide?

       

    • Hardik Gupta

      Hi Sunil,

      I think the problem you are facing is the <now> time stamp. It should be a current value.

      The difference between the OFSC server time and <now> should not exceed 30 minutes and you are using a year "2014" now value.

       

    • Sunil Ainlod

      Hi Hardik,

      I have used today's value still same error

      Request Parameters used for sha256:

          <now>2016-09-28T02:09:28+05:30</now>
          <login>soap</login>
          <company>****.test</company>
          <auth_string>25BE8885071910434DDF3CCF2881D39B5487DB200A15E857ACC1B2278A48D55F</auth_string> 

      Request Parameters used for md5:

          <now>2016-09-28T02:09:28+05:30</now>
          <login>soap</login>
          <company>****.test</company>
          <auth_string>62469089f554d7a38bacd9be3f29a989</auth_string> 

      Regards,

      Sunil

    • Hardik Gupta

      Hi Sunil,

      Under User types do you have a SOAP user account ?

      Also under API access you have to provide access to the API for that user type.

      Have you done these?

      Regards,

      Hardik Gupta

    • Hardik Gupta

      Hi Sunil,

      If you have problem only in Auth string generation then you can use the below link for generating the auth string:

      http://hardik.xyz/

      I have tested the results generated and they are correct.

      Regards,

      Hardik Gupta

    • Sunil Ainlod

      Hi Hardik,

      I got the solution on this: We need to add below settings in SOAP UI and start SOAP UI from batch file. (soapui.bat)

      1. find the following file on your computer(Make sure you have write access to the file)
      C:\Program Files\SmartBear\SoapUI-5.2.1\bin\SoapUI-5.2.1.vmoptions
      2. Add the following line to the file
      -Dsoapui.https.protocols="SSLv3,TLSv1.2"
      3. Run soap ui with the .exe file (SoapUI-5.2.1.exe)

      Option 2: (if option 1 does not work for you).

      1. Edit the following batch file on your computer(Make sure you have write access to the file)
      C:\Program Files\SmartBear\SoapUI-5.2.1\bin\soapui.bat    
      2. Add the following line to the file (after: if "%SOAPUI_HOME%" == "" goto START)
      set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.https.protocols="SSLv3,TLSv1.2"
      3. Run Soap ui with the batch file (soapui.bat)

       

      Regards,

      Sunil

       

    • Hardik Gupta

      Hi Sunil,

      Yes this setup is required now for SOAP UI.

      I never thought you might be stuck at that setup step. I have setup using option 1 on my SOAP UI. It works for me.

      Regards,

      Hardik Gupta