1 | <?php |
||
17 | class PrivateKey implements SignatureInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | private $rawKey; |
||
23 | |||
24 | /** |
||
25 | * @var resource |
||
26 | */ |
||
27 | private $resource; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | private $details = []; |
||
33 | |||
34 | /** |
||
35 | * PublicKey constructor. |
||
36 | * @param string $privateKey Content of private key file |
||
37 | */ |
||
38 | 10 | public function __construct($privateKey) |
|
43 | |||
44 | /** |
||
45 | * Get a private key |
||
46 | * @link http://php.net/manual/en/function.openssl-pkey-get-private.php |
||
47 | * @return void |
||
48 | * @throws CertificateException An error has occurred when get private key |
||
49 | */ |
||
50 | 10 | protected function read() |
|
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | 5 | public function sign($content, $algorithm = OPENSSL_ALGO_SHA1) |
|
70 | |||
71 | /** |
||
72 | * Return the modulus of private key |
||
73 | * @return string |
||
74 | */ |
||
75 | public function modulus() |
||
82 | |||
83 | /** |
||
84 | * Return the expoent of private key |
||
85 | * @return string |
||
86 | */ |
||
87 | public function expoent() |
||
94 | |||
95 | /** |
||
96 | * Return raw private key |
||
97 | * @return string |
||
98 | */ |
||
99 | 1 | public function __toString() |
|
103 | } |
||
104 |