title: what's the formula of ONVIF #PasswordDigest
body: <p>I'm working on ONVIF of send "GetDeviceInformation". That's required wsse:UsernameToken.
  After searching data for authority, there are two faormula:</p>
  
  <p>(1) by "ONVIF-Core-Specification-v241.pdf", "5.12.2.1 Password derivation"</p>
  
  <pre><code>PE_UA = base64(HMAC_SHA-1(UA+P_UA,NEP+”ONVIF password”))
  </code></pre>
  
  <p>(2) by soap of WEB protocol</p>
  
  <pre><code>Digest = B64ENCODE( SHA1( B64DECODE( Nonce ) + Date + Password ) )
  </code></pre>
  
  <p>I am confused!!which one is correct?</p>
  
  <p>Moreover, when i test ONVIF test tool by wireshark</p>
  
  <p>the XML i got as:</p>
  
  <blockquote>
  <pre><code>&lt;wsse:UsernameToken&gt;
  &lt;wsse:Username&gt;admin&lt;/wsse:Username&gt;
  &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"&gt;lu9ywjDwSt8oW7M4tMjCb50/xRg=&lt;/wsse:Password&gt;
  &lt;wsse:Nonce&gt;TgBYFHxSc3Oo8yPzwnQn8A==&lt;/wsse:Nonce&gt;
  &lt;wsu:Created&gt;2014-06-20T04:41:45Z&lt;/wsu:Created&gt;
  &lt;/wsse:UsernameToken&gt;
  </code></pre>
  </blockquote>
  
  <p>ok, then I've try to figure out the formula by those data.</p>
  
  <p>a> username: <strong>"admin"</strong></p>
  
  <p>b> password: <strong>"pass"</strong> ( un-entropy)</p>
  
  <p>c> Nonce: <strong>"TgBYFHxSc3Oo8yPzwnQn8A=="</strong></p>
  
  <p>d> created: <strong>"2014-06-20T04:41:45Z"</strong></p>
  
  <p>somehow to get the final password: "<strong>lu9ywjDwSt8oW7M4tMjCb50/xRg=</strong>"</p>
  
  <p>the "nonce" may converted by Base64 so the original should be"4E0058147C527373A8F323F3C27427F0"</p>
  
  <p>I've try use</p>
  
  <pre><code>base64(SHA1("TgBYFHxSc3Oo8yPzwnQn8A==2014-06-12T04:03:45Zpass"))
  </code></pre>
  
  <p>or</p>
  
  <pre><code>base64(SHA1("4E0058147C527373A8F323F3C27427F0==2014-06-12T04:03:45Zpass"))
  </code></pre>
  
  <p>but I still can't get the password send by Test tool as "lu9ywjDwSt8oW7M4tMjCb50/xRg="</p>
  
  <p>any one could help me to figure out what the exact formula used by ONVIF test tool?</p>
  
  <p>Do need your help!!! thanks!!</p>