Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. Fatal error: Uncaught SoapFault exception: [ns1:InvalidSecurity] An error was discovered processing the <wsse:Security> header
  2.  
  3. <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
  4.  
  5. <wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  6.  
  7. <wsse:Username>userID</wsse:Username>
  8.  
  9. <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">passwd</wsse:Password>
  10.  
  11. <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">ZTQ3YmJjZmM1ZTU5ODg3YQ==</wsse:Nonce>
  12.  
  13. <wsu:Created>2013-07-05T19:55:36.458Z</wsu:Created>
  14.  
  15. </wsse:UsernameToken>
  16. </wsse:Security>
  17.  
  18. ZTQ3YmJjZmM1ZTU5ODg3YQ==
  19.  
  20. $nonce = sha1(mt_rand());
  21.  
  22. dabddf9dbd95b490ace429f7ad6b55c3418cdd58
  23.  
  24. $NASC = substr(md5(uniqid('the_password_i_am _using', true)), 0, 16);
  25. $nonce = base64_encode($NASC);
  26.  
  27. NzJlMDQ4OTAyZWIxYWU5ZA==
  28.  
  29. string usn = "MyUsername";
  30. string pwd = "MyPassword";
  31.  
  32. DateTime created = DateTime.Now.ToUniversalTime();
  33. var nonce = getNonce();
  34. string nonceToSend = Convert.ToBase64String(Encoding.UTF8.GetBytes(nonce));
  35. string createdStr = created.ToString("yyyy-MM-ddTHH:mm:ssZ");
  36. string passwordToSend = GetSHA1String(nonce + createdStr + pwd);
  37.  
  38. protected string getNonce()
  39. {
  40. string phrase = Guid.NewGuid().ToString();
  41. return phrase;
  42.  
  43. }
  44.  
  45. protected string GetSHA1String(string phrase)
  46. {
  47. SHA1CryptoServiceProvider sha1Hasher = new SHA1CryptoServiceProvider();
  48. byte[] hashedDataBytes = sha1Hasher.ComputeHash(Encoding.UTF8.GetBytes(phrase));
  49. string test = Convert.ToString(hashedDataBytes);
  50. return Convert.ToBase64String(hashedDataBytes);
  51. }
  52.  
  53. The nonce is 16 bytes long and is passed along as a base64 encoded value.
  54.  
  55. $prefix = gethostname();
  56. $nonce = base64_encode( substr( md5( uniqid( $prefix.'_', true)), 0, 16));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement