Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. include('phpseclib1.0.16/Crypt/RSA.php');
  3. include('/phpseclib1.0.16/Math/BigInteger.php');
  4.  
  5. $client = Yii::$app->soapApi;
  6.  
  7. $sha256Pass = hash("sha256", Yii::$app->params['passCode']); //perform SHA-256 of the password
  8.  
  9. $result = new \Math_BigInteger($sha256Pass, 16); //in base-16
  10. $exponent= Yii::$app->params['exponent']; //this value will be replaced with what was documented
  11. $modulus= Yii::$app->params['modulus']; //this value will be replaced with what was documented
  12.  
  13. $crypt_rsa = new \Crypt_RSA();
  14. $crypt_rsa->loadKey(
  15. array(
  16. 'e' => new \Math_BigInteger($exponent),
  17. 'n' => new \Math_BigInteger($modulus)
  18. )
  19. );
  20.  
  21. $encryptedPassword = base64_encode($crypt_rsa->encrypt($result));
  22.  
  23. $parameters = [
  24. 'username' =>'usertest1a',
  25. 'password' => $encryptedPassword,
  26. 'orgid' => '1184'
  27. ];
  28.  
  29. var_dump($client->createTokenString($parameters));
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement