public static function GenerateKeys($password, $nonce)
 {
     $array = array("key", "key", "key", "key");
     $array2 = array(1, 2, 3, 4);
     $nonce .= '0';
     for ($j = 0; $j < count($array); $j++) {
         $nonce[strlen($nonce) - 1] = chr($array2[$j]);
         $foo = wa_pbkdf2("sha1", $password, $nonce, 2, 20, true);
         $array[$j] = $foo;
     }
     return $array;
 }
Example #2
0
 public static function GenerateKeys($password, $nonce)
 {
     $array = ['key', 'key', 'key', 'key'];
     $array2 = [1, 2, 3, 4];
     $nonce .= '0';
     for ($j = 0; $j < count($array); $j++) {
         $nonce[strlen($nonce) - 1] = chr($array2[$j]);
         $foo = wa_pbkdf2('sha1', $password, $nonce, 2, 20, true);
         $array[$j] = $foo;
     }
     return $array;
 }
Example #3
0
 protected function createAuthBlob()
 {
     if ($this->challengeData) {
         $key = wa_pbkdf2('sha1', base64_decode($this->password), $this->challengeData, 16, 20, true);
         $this->inputKey = new KeyStream($key[2], $key[3]);
         $this->outputKey = new KeyStream($key[0], $key[1]);
         $this->reader->setKey($this->inputKey);
         //$this->writer->setKey($this->outputKey);
         $phone = $this->dissectPhone();
         $array = "" . $this->phoneNumber . $this->challengeData . time() . static::WHATSAPP_USER_AGENT . " MccMnc/" . str_pad($phone["mcc"], 3, "0", STR_PAD_LEFT) . "001";
         $this->challengeData = null;
         return $this->outputKey->EncodeMessage($array, 0, strlen($array), false);
     }
     return null;
 }
 protected function createAuthBlob()
 {
     if ($this->challengeData) {
         $key = wa_pbkdf2('sha1', base64_decode($this->password), $this->challengeData, 16, 20, true);
         $this->inputKey = new KeyStream($key[2], $key[3]);
         $this->outputKey = new KeyStream($key[0], $key[1]);
         $this->reader->setKey($this->inputKey);
         //$this->writer->setKey($this->outputKey);
         $array = "" . $this->phoneNumber . $this->challengeData . time();
         $this->challengeData = null;
         return $this->outputKey->EncodeMessage($array, 0, strlen($array), false);
     }
     return null;
 }
Example #5
0
 protected function createAuthBlob()
 {
     //echo $this->parent->getChallengeData() + "\n";
     if ($this->parent->getChallengeData()) {
         //echo 'ChallengeData Exists' + "\n";
         //die;
         $key = wa_pbkdf2('sha1', base64_decode($this->password), $this->parent->getChallengeData(), 16, 20, true);
         $this->inputKey = new KeyStream($key[2], $key[3]);
         $this->outputKey = new KeyStream($key[0], $key[1]);
         $this->parent->reader->setKey($this->inputKey);
         //$this->writer->setKey($this->outputKey);
         $array = "" . $this->phoneNumber . $this->parent->getChallengeData() . time();
         $this->parent->setChallengeData(null);
         return $this->outputKey->EncodeMessage($array, 0, strlen($array), false);
     }
 }
Example #6
0
 /**
  * Add the authentication nodes.
  *
  * @return protocol_node Returns an authentication node.
  */
 protected function create_auth_node()
 {
     $data = null;
     if ($this->challenge_data) {
         $key = wa_pbkdf2('sha1', base64_decode($this->password), $this->challenge_data, 16, 20, true);
         $this->input_key = new KeyStream($key[2], $key[3]);
         $this->output_key = new KeyStream($key[0], $key[1]);
         $this->reader->setKey($this->input_key);
         $array = "" . $this->phone_number . $this->challenge_data . time();
         $this->challenge_data = null;
         $data = $this->output_key->EncodeMessage($array, 0, strlen($array), false);
     }
     return new protocol_node("auth", array('mechanism' => 'WAUTH-2', 'user' => $this->phone_number), null, $data);
 }