2

I'm trying to use gSOAP to talk to a network camera that supports ONVIF, and I need a way to specify the time that soap_wsse_add_UsernameTokenDigest uses when it hashes the password.

At the moment I'm unable to insure that both the camera and my client have proper NTP time sync. Therefore, I'd like to take the approach used by tools like python-onvif and simply apply an offset to the time used in generating the UsernameToken. The camera's date/time can be retrieved without authentication, so computing such an offset is trivial.

My problem is that I can't see any way to get soap_wsse_add_UsernameTokenDigest to use anything except the current time when it computes the password hash.

Is there any way to change what time soap_wsse_add_UsernameTokenDigest uses, short of changing the system clock?

Michael Kohne
  • 11,888
  • 3
  • 47
  • 79
  • 1
    I suggest to post a [feature request](https://sourceforge.net/p/gsoap2/feature-requests/) with the gSOAP developers. It should be fairly easy to implement an extra API call that passes the time as a parameter instead of using the current time. – Dr. Alex RE Jul 06 '17 at 01:15
  • I did that, but it turns out it was already added in 2.8.49 as 'soap_wsse_add_UsernameTokenDigest_at'. Too slow on my part. – Michael Kohne Jul 15 '17 at 19:19

1 Answers1

0

And a look at the source code for soap_wsse_add_UsernameTokenDigest answers the question: NO, there's no way to specify that time or an offset because it simply calls time(NULL) directly.

So my options are to modify soap_wsse_add_UsernameTokenDigest, compute the hashes myself and call soap_wsse_add_UsernameTokenText, or find some way to insure time sync.

Michael Kohne
  • 11,888
  • 3
  • 47
  • 79
  • The path of least resistance turned out to be creating a modified copy of soap_wsse_add_UsernameTokenDigest in my code. – Michael Kohne Jul 06 '17 at 10:59