what's the formula of ONVIF #PasswordDigest -
i'm working on onvif of send "getdeviceinformation". that's required wsse:usernametoken. after searching data authority, there 2 faormula:
(1) "onvif-core-specification-v241.pdf", "5.12.2.1 password derivation"
pe_ua = base64(hmac_sha-1(ua+p_ua,nep+”onvif password”))
(2) soap of web protocol
digest = b64encode( sha1( b64decode( nonce ) + date + password ) )
i confused!!which 1 correct?
moreover, when test onvif test tool wireshark
the xml got as:
<wsse:usernametoken> <wsse:username>admin</wsse:username> <wsse:password type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#passworddigest">lu9ywjdwst8ow7m4tmjcb50/xrg=</wsse:password> <wsse:nonce>tgbyfhxsc3oo8ypzwnqn8a==</wsse:nonce> <wsu:created>2014-06-20t04:41:45z</wsu:created> </wsse:usernametoken>
ok, i've try figure out formula data.
a> username: "admin"
b> password: "pass" ( un-entropy)
c> nonce: "tgbyfhxsc3oo8ypzwnqn8a=="
d> created: "2014-06-20t04:41:45z"
somehow final password: "lu9ywjdwst8ow7m4tmjcb50/xrg="
the "nonce" may converted base64 original should be"4e0058147c527373a8f323f3c27427f0"
i've try use
base64(sha1("tgbyfhxsc3oo8ypzwnqn8a==2014-06-12t04:03:45zpass"))
or
base64(sha1("4e0058147c527373a8f323f3c27427f0==2014-06-12t04:03:45zpass"))
but still can't password send test tool "lu9ywjdwst8ow7m4tmjcb50/xrg="
any 1 me figure out exact formula used onvif test tool?
do need help!!! thanks!!
finally, device send ok me!
after reference gsoap
at first, formula is:
digest = b64encode( sha1( b64decode( nonce ) + date + password ) )
for nonce, should 20 bytes random "numeric" value as:
char canoncetest[20]={0x9e,0xbd,0xbb,0x53,0x7c,0x96,0xb4,0xc1,0xce,0xeb, 0xfb,0x06,0x17,0x31,0x41,0x4e,0x5b,0x68,0x86,0x93};
it generated method (event make it)
after getting, canoncetest, above, string should looked "艋|蹉鋿1an[h?昍昍昍昍"
and xml send device, base64 should "nr27u3ywtmho6/ggfzfbtltohppmzmzmzmzmzbq="
this key point of correct foramte! (not ascii string!) moreover, feed sha-1 function canoncetest (no need convert base64)
for created , password, feed sha-1 string format (ex. "2014-07-08t09:26:13z" , "pass")
then, world peace!
Comments
Post a Comment