keygenPath; $cmd .= ' -f pubsec'; $cmd .= ' -t duniter'; $cmd .= ' "'. $salt .'"'; $cmd .= ' -p "'. $pepper .'"'; $output=null; $result_code=null; exec($cmd, $output, $result_code); // die($cmd . '
'. print_r($output, true) . '
'. print_r($result_code, true)); if (empty($output) or empty($output[0])) { throw new Exception('Keygen me calcule pas (la G1 pub)'); } return $output[0]; } public function getIPNSPub ($salt, $pepper) { $salt = str_replace('"', '\"', $salt); $pepper = str_replace('"', '\"', $pepper); $cmd = $this->keygenPath; $cmd .= ' -t b36mf'; $cmd .= ' "'. $salt .'"'; $cmd .= ' -p "'. $pepper .'"'; $output=null; $result_code=null; exec($cmd, $output, $result_code); // die($cmd . '
'. print_r($output, true) . '
'. print_r($result_code, true)); if (empty($output) or empty($output[0])) { throw new Exception('Keygen me calcule pas (la pub IPNS) :
' . $cmd . '
'); } return $output[0]; } public function generatePubsec ($salt, $pepper) { $salt = str_replace('"', '\"', $salt); $pepper = str_replace('"', '\"', $pepper); $userPubkey = $this->getG1Pub($salt, $pepper); if (!file_exists($this->pubsecDir)) { mkdir($this->pubsecDir, 0777, true); } if (!file_exists($this->pubsecDir . $userPubkey . '.dunikey')) { $cmd = $this->keygenPath; $cmd .= ' -f pubsec'; $cmd .= ' -t duniter'; $cmd .= ' "'. $salt .'"'; $cmd .= ' -p "'. $pepper .'"'; $cmd .= ' -o '. $this->pubsecDir . $userPubkey . '.dunikey'; $output=null; $result_code=null; exec($cmd, $output, $result_code); // die($cmd . '
'. print_r($result_code, true)); if ($result_code != 0) { throw new Exception('Keygen me calcule pas (la dunikey)'); } } } }