protected function doRun()
 {
     $cryptTool = CryptTool::getInstance();
     $keyPair = $cryptTool->generateKeyPair();
     $privateKeyHex = $cryptTool->bin2hex($keyPair->privateKey);
     $publicKeyHex = $cryptTool->bin2hex($keyPair->publicKey);
     file_put_contents($this->getArgument(self::argPrivateKeyFile), Common::convertPrivateKey($privateKeyHex) . "\n");
     file_put_contents($this->getArgument(self::argPublicKeyFile), Common::convertPublicKey($publicKeyHex) . "\n");
     Common::l('key pair generated');
 }
Beispiel #2
0
 /**
  * @param string $pos
  * @return null|string
  */
 public function getArgumentPublicKey($pos)
 {
     $content = Common::getPublicKey($this->getArgumentStringOrFileContent($pos));
     $cryptTool = CryptTool::getInstance();
     if (null !== $content) {
         return $cryptTool->hex2bin($content);
     }
     return null;
 }