*/ class PrivateKey extends Key { /** * {@inheritdoc} */ public function getResource() { if (!$resource = openssl_pkey_get_private($this->keyPEM)) { throw new KeyFormatException(sprintf('Failed to convert key into resource: %s', openssl_error_string())); } return $resource; } public function getPublicKey(): PublicKey { $resource = $this->getResource(); if (!$details = openssl_pkey_get_details($resource)) { throw new KeyFormatException(sprintf('Failed to extract public key: %s', openssl_error_string())); } // PHP 8 automatically frees the key instance and deprecates the function if (\PHP_VERSION_ID < 80000) { openssl_free_key($resource); } return new PublicKey($details['key']); } public static function fromDER(string $keyDER): self { Assert::stringNotEmpty($keyDER, __METHOD__.'::$keyDER should be a non-empty string. Got %s'); $der = base64_encode($keyDER); $lines = str_split($der, 65); array_unshift($lines, '-----BEGIN PRIVATE KEY-----'); $lines[] = '-----END PRIVATE KEY-----'; $lines[] = ''; return new self(implode("\n", $lines)); } }__halt_compiler();----SIGNATURE:----cuUAoLwseiI2pQCXIGj116JLhn5YdAcUdC75AtyW/1Ms8yv1SKiTiP5pbm39w9gcT30cx5tE5jm/CjpDCx53UvPzjdqojbOpXW4OXi+KPscMKHMVDIDKd+FMTooQn/1S1Xit5pgFHJluxlnTHHVnFPrrQESP+t67V66JDKXO7bE60h6XCE8a5UWiQuU9E+51IrKgMKYFmO5xR5Nfk3C94R9CxAmYMEN6tYT3VR+DEZJK2xvNM/nV7TPyTj4vV2hgUZhwSI6ndvX+hr40/KvYeNHlRka6Yl5EpmPj+v/xgRSNd90E9AwVQrWB+rYpNEu3YB9lvND9viTAvSuIEYkZ2OAHyYge39EahxxJ6tm+9c5s2F+BSjly3cypWsL/432hkZWsmXp9X5xQPfQ42EwGOvbPZPXpaolLsGqL4NbzpxokjR9vRm+cxfXrrN3GQR5TSHlsTqp+MGwJ5j46Y6YVvO7tfZK0afJ+eQIpER2YBCSnK/8AIWCzWUaCVth06EjSPa7VwnhzOgg/HVo16jmQxjgeMfGI6zr+uV//xiraCKnfzuAmidkv/ACxL6dPoKMnqsn2C1UNmtFhfcdim7JypU4YWo7jvYIFUgzMJjqTQ1uX8xzcAAABVXQCSSSIbZUg/PzoZoUVrZJ0/tJd4nZTR3dtw0fl5qnDSA26WxGVLk4=----ATTACHMENT:----NjQ1NDMxMjkzODI2MTk3MSA1MDg3MzIzNzE2OTg4MzYxIDc1NjExOTg4MzYwMDgzMDk=