private function getKeyContent(Key $key, string $header) : string { $match = null; preg_match('/[\\-]{5}BEGIN ' . $header . '[\\-]{5}(.*)[\\-]{5}END ' . $header . '[\\-]{5}/', str_replace([PHP_EOL, "\n", "\r"], '', $key->getContent()), $match); if (count($match) === 2) { return $match[1]; } throw new InvalidArgumentException('This is not a valid ECDSA key.'); }