1 | <?php declare(strict_types=1); |
||
7 | trait HasSignature |
||
8 | { |
||
9 | private $cmdLineSign = <<<CMD |
||
10 | openssl smime -sign -signer %signer% -engine gost -gost89 -binary -noattr -nocerts -outform DER -in %in% -out %out% |
||
11 | CMD; |
||
12 | |||
13 | private $cmdLineAsn = <<<CMD |
||
14 | openssl asn1parse -inform DER -in %in% |
||
15 | CMD; |
||
16 | |||
17 | /** |
||
18 | * Get message digest by GOST Р 34.11-94. |
||
19 | * |
||
20 | * @param array $values List arguments |
||
21 | * |
||
22 | * @return string |
||
23 | */ |
||
24 | private function digest(array $values): string |
||
30 | |||
31 | /** |
||
32 | * Get serial number of X509. |
||
33 | * |
||
34 | * @param string $path |
||
35 | * @return string |
||
36 | */ |
||
37 | private function getSerialNumber(string $path): string |
||
43 | |||
44 | /** |
||
45 | * Calculate signature from digest message. |
||
46 | * |
||
47 | * @param array|string $message |
||
48 | * @return string |
||
49 | */ |
||
50 | private function sign($message): string |
||
75 | |||
76 | /** |
||
77 | * Get file name from a file resource. |
||
78 | * |
||
79 | * @param resource $resource |
||
80 | * @return string |
||
81 | */ |
||
82 | private function getFilename($resource): string |
||
86 | } |
||
87 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: