DerivePublicKey   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A doRun() 0 10 1
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