*/ 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:----F2wvk0Fxed5Vlav41jxtQXkDAYoeOIaO0hK8cRkueRurAm0noOFeQCH4PxlrY/WuNAsxPM+TBlswyK9/xiUx1ztlRtSdofTUhHPeu7eIRQwwC+rbZN+Q1awucmTxtvOsREQfz/jS+Q8duYULJPtkyTs01wrycKAo0METZtVyn3jJ8LlMioRApdL6vPFhMsbUHqL6IIHw/x8aQVobernTWzd3hpRMTnH+6cV3aqG4WW6ZBGQcfSTaKaUP6Zjy1iehByjO/EOpRH3fPlP4Uewrvdn+0Ya9Z4bpomPxQMT7PyjQ/jtM5jQtBKop1az9UboWwwdlln2Ln39yqINrK79Ynt2itLIwVOs+vtxkRptQ2zUhI3LQi1qJ6y8RiZrAJtuWnZGfTm5heXpS4fnKMRUshNeByrlO5ywU8Drv/rGbmomixKikXrjIP3mJsDsxfAzIgmtJ96rspocmdiHLfNSU45jxqVvAiQQjeUXESnJx550OlrzsxvzFj058zZC8EcAgR/pRByDCi43AWYgPG8mWipqG8T3P1uN0ic0f53tG763EG0nd5BYBtsaWLy1txovStuL4xf8YDXk+uUPDOj9x9KxCPxz2WWv5ofdPFC5A3V0p2Jq/HcfCDiBoOc3ci3KN/io9dxwsSqVL9zRvpVzFZ0y+UdGwhtQ2e+Ipkt1DHso=----ATTACHMENT:----MTQ5NzA2Mzg0NjY3NzQ4NiAyMzI4ODk5NzY1OTkzNzIgMTMxNjA3NjQ3MTUwMDk0OA==