DerivePublicKey::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @author Threema GmbH
4
 * @copyright Copyright (c) 2015-2016 Threema GmbH
5
 */
6
7
8
namespace Threema\Console\Command;
9
10
use Threema\Console\Common;
11
use Threema\MsgApi\Tools\CryptTool;
12
13
class DerivePublicKey extends Base {
14
	public function __construct() {
15
		parent::__construct('Derive Public Key',
16
			array(self::argPrivateKey),
17
			'Derive the public key that corresponds with the given private key.');
18
	}
19
20
	protected function doRun() {
21
		$privateKey = $this->getArgumentPrivateKey(self::argPrivateKey);
22
23
		Common::required($privateKey);
24
25
		$cryptTool = CryptTool::getInstance();
26
27
		$publicKey = $cryptTool->derivePublicKey($privateKey);
28
		Common::l(Common::convertPublicKey($cryptTool->bin2hex($publicKey)));
29
	}
30
}
31